Java 类org.newdawn.slick.state.StateBasedGame 实例源码

项目:Generic-Zombie-Shooter-Redux    文件:LoadingState.java   
@Override
public void update(GameContainer gc, StateBasedGame game, int delta) throws SlickException {
    percentLoaded = (float)AssetManager.assetsLoaded() / (float)AssetManager.assetsToLoad();
    if(AssetManager.assetsLoaded() == AssetManager.assetsToLoad()) {
        game.addState(new MenuState());
        game.addState(new GameState());
        game.addState(new ShopState());
        game.addState(new TrainState());
        game.addState(new GameOverState());
        game.addState(new CreditsState());
        game.addState(new BlankState());

        game.init(gc);
        game.enterState(MenuState.ID); // we're done loading
    }
}
项目:trashjam2017    文件:RotateTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) throws SlickException {
    g.translate(container.getWidth()/2, container.getHeight()/2);
    g.scale(scale,scale);
    g.rotate(0, 0, ang);
    g.translate(-container.getWidth()/2, -container.getHeight()/2);
    if (background != null) {
        Color c = g.getColor();
        g.setColor(background);
        g.fillRect(0,0,container.getWidth(),container.getHeight());
        g.setColor(c);
    }
    prev.render(container, game, g);
    g.translate(container.getWidth()/2, container.getHeight()/2);
    g.rotate(0, 0, -ang);
    g.scale(1/scale,1/scale);
    g.translate(-container.getWidth()/2, -container.getHeight()/2);
}
项目:Generic-Zombie-Shooter-Redux    文件:ShopState.java   
@Override
public void enter(GameContainer gc, StateBasedGame game) {
    exit = false;

    if(Globals.player.getInventory().getCapacity() != inventorySize) {
        // Inventory size has changed. Re-build inventory layout.
        inventorySize = Globals.player.getInventory().getCapacity();
        int cols = SHOP_COLS;
        int rows = (int)(Math.ceil((float)inventorySize / (float)cols));
        if(inventoryBoxes == null) {
            inventoryBoxes = new Rectangle[rows][cols];
        }

        for(int r = 0; r < rows; r++) {
            for(int c = 0; c < cols; c++) {
                float x = INVENTORY_CONTAINER.x + 3.0f + ((c * ITEM_BOX_SIZE) + (c * 2.0f));
                float y = INVENTORY_CONTAINER.y + 3.0f + ((r * ITEM_BOX_SIZE) + (c * 2.0f));
                inventoryBoxes[r][c] = new Rectangle(x, y, ITEM_BOX_SIZE, ITEM_BOX_SIZE);
            }
        }
    }
}
项目:BaseClient    文件:BlobbyTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void preRender(StateBasedGame game, GameContainer container,
        Graphics g) throws SlickException {
    prev.render(container, game, g);

    MaskUtil.defineMask();
    for (int i=0;i<blobs.size();i++) {
        ((Blob) blobs.get(i)).render(g);
    }
    MaskUtil.finishDefineMask();

    MaskUtil.drawOnMask();
    if (background != null) {
        Color c = g.getColor();
        g.setColor(background);
        g.fillRect(0,0,container.getWidth(),container.getHeight());
        g.setColor(c);
    }
}
项目:BaseClient    文件:BlobbyTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    if (blobs.size() == 0) {
        for (int i=0;i<blobCount;i++) {
            blobs.add(new Blob(container));
        }
    }

    for (int i=0;i<blobs.size();i++) {
        ((Blob) blobs.get(i)).update(delta);
    }

    timer -= delta;
    if (timer < 0) {
        finish = true;
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:ShopState.java   
@Override
public void init(GameContainer gc, StateBasedGame game) throws SlickException {
    shopBoxes = new Rectangle[SHOP_ROWS][SHOP_COLS];
    for(int r = 0; r < SHOP_ROWS; r++) {
        for(int c = 0; c < SHOP_COLS; c++) {
            float x = SHOP_CONTAINER.x + 3.0f + ((c * ITEM_BOX_SIZE) + (c * 2.0f));
            float y = SHOP_CONTAINER.y + 3.0f + ((r * ITEM_BOX_SIZE) + (c * 2.0f));
            shopBoxes[r][c] = new Rectangle(x, y, ITEM_BOX_SIZE, ITEM_BOX_SIZE);
        }
    }

    inventoryBoxes = null;
    selected = null;
    selectedInInventory = false;

    buyButton = new TransactionButton(new Pair<Float>((float)((Globals.WIDTH / 2) - 58.0f), (Globals.HEIGHT - 70.0f)), TransactionButton.Type.BUY);
    sellButton = new TransactionButton(new Pair<Float>((float)((Globals.WIDTH / 2) + 58.0f), (Globals.HEIGHT - 70.0f)), TransactionButton.Type.SELL);

    inventorySize = 0;
    exit = false;
}
项目:HCMIU_PlantsAndZombies    文件:PlayUI.java   
/**
 * Draw sun collected
 * @param gc    GameContainer
 * @param sbg   StateBasedGame
 * @param g Graphics
 * @throws SlickException
 */
public static void showSunCollected(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    float iconPosX = 10 * PZGUI.getResolutionRateWidth();
    float iconPosY = 5  * PZGUI.getResolutionRateHeight();
    float iconW = 80 * PZGUI.getResolutionRateWidth();
    float iconH = 80 * PZGUI.getResolutionRateHeight();

    float textPosX = 120 * PZGUI.getResolutionRateWidth();
    float textPosY = 22  * PZGUI.getResolutionRateHeight();

    float posX = 60 * PZGUI.getResolutionRateWidth();
    float posY = 20 * PZGUI.getResolutionRateHeight();
    float W = 150 * PZGUI.getResolutionRateWidth();
    float H = 45  * PZGUI.getResolutionRateHeight();

    g.setColor(new Color(0, 0, 0, 150));
    g.fillRoundRect(posX, posY, W, H, 20);
    SunUI.drawIcon(iconPosX, iconPosY, iconW, iconH);

    sunView.render(textPosX, textPosY, SunUI.getSunCollected().toString(), Color.white);
    g.setColor(new Color(255, 255, 255));
}
项目:Generic-Zombie-Shooter-Redux    文件:LoadingState.java   
@Override
public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
    g.resetTransform();
    g.clear();

    float lw = 400.0f;
    float lh = 50.0f;
    float lx = (Globals.WIDTH / 2) - (lw / 2);
    float ly = (Globals.HEIGHT / 2) - (lh / 2);
    float loadWidth = lw * percentLoaded;

    g.setColor(new Color(0x808080));
    g.fillRect(lx, ly, lw, lh);
    g.setColor(new Color(0x9B2111));
    g.fillRect(lx, ly, loadWidth, lh);
    g.setColor(Color.white);
    g.drawRect(lx, ly, lw, lh);

    g.setColor(Color.white);
    UnicodeFont uni = assets.getFont("PressStart2P-Regular_large");
    if(uni != null) {
        g.setFont(uni);
        FontUtils.drawCenter(uni, "Loading...", ((Globals.WIDTH / 2) - 200), (int)(ly - uni.getLineHeight() - 10), (int)lw, g.getColor());
    }
}
项目:BaseClient    文件:SelectTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void preRender(StateBasedGame game, GameContainer container,
        Graphics g) throws SlickException {
    if (moveBackDone) {
        g.translate(xp1,yp1);
        g.scale(scale1, scale1);
        g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
        prev.render(container, game, g);
        g.resetTransform();
        g.clearClip();
    }

    g.translate(xp2,yp2);
    g.scale(scale2, scale2);
    g.setClip((int) xp2,(int) yp2,(int) (scale2*container.getWidth()),(int) (scale2*container.getHeight()));
}
项目:Progetto-C    文件:SelectTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#preRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void preRender(StateBasedGame game, GameContainer container,
        Graphics g) throws SlickException {
    if (moveBackDone) {
        g.translate(xp1,yp1);
        g.scale(scale1, scale1);
        g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
        prev.render(container, game, g);
        g.resetTransform();
        g.clearClip();
    }

    g.translate(xp2,yp2);
    g.scale(scale2, scale2);
    g.setClip((int) xp2,(int) yp2,(int) (scale2*container.getWidth()),(int) (scale2*container.getHeight()));
}
项目:Progetto-C    文件:BlobbyTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    if (blobs.size() == 0) {
        for (int i=0;i<blobCount;i++) {
            blobs.add(new Blob(container));
        }
    }

    for (int i=0;i<blobs.size();i++) {
        ((Blob) blobs.get(i)).update(delta);
    }

    timer -= delta;
    if (timer < 0) {
        finish = true;
    }
}
项目:BaseClient    文件:FadeInTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) {
    Color old = g.getColor();
    g.setColor(color);

    g.fillRect(0, 0, container.getWidth()*2, container.getHeight()*2);
    g.setColor(old);
}
项目:Generic-Zombie-Shooter-Redux    文件:GameState.java   
@Override
public void init(GameContainer gc, StateBasedGame game) throws SlickException {
    assets = AssetManager.getManager();

    gc.setMouseCursor(assets.getImage("GZS_Crosshair"), 16, 16);

    Globals.player = new Player();
    entities = new ConcurrentHashMap<String, Entity>();

    reset(gc);
}
项目:trashjam2017    文件:SelectTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) throws SlickException {
    g.resetTransform();

    if (!moveBackDone) {
        g.translate(xp1,yp1);
        g.scale(scale1, scale1);
        g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
        prev.render(container, game, g);
        g.resetTransform();
        g.clearClip();
    }
}
项目:trashjam2017    文件:VerticalSplitTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    offset += delta * 1f;
    if (offset > container.getHeight() / 2) {
        finish = true;
    }
}
项目:BaseClient    文件:RotateTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    ang += delta * 0.5f;
    if (ang > 500) {
        finish = true;
    }
    scale -= delta * 0.001f;
    if (scale < 0) {
        scale = 0;
    }
}
项目:trashjam2017    文件:HorizontalSplitTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    offset += delta * 1f;
    if (offset > container.getWidth() / 2) {
        finish = true;
    }
}
项目:trashjam2017    文件:FadeOutTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) {
    Color old = g.getColor();
    g.setColor(color);
    g.fillRect(0, 0, container.getWidth() * 2, container.getHeight() * 2);
    g.setColor(old);
}
项目:trashjam2017    文件:FadeOutTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta) {
    color.a += delta * (1.0f / fadeTime);
    if (color.a > 1) {
        color.a = 1;
    }
}
项目:trashjam2017    文件:RotateTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    ang += delta * 0.5f;
    if (ang > 500) {
        finish = true;
    }
    scale -= delta * 0.001f;
    if (scale < 0) {
        scale = 0;
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:MenuState.java   
@Override
public void init(GameContainer gc, StateBasedGame game) throws SlickException {
    assets = AssetManager.getManager();

    gameStart = new MenuButton(new Pair<Float>(50.0f, (Globals.HEIGHT - 200.0f)), "Start Game");
    credits = new MenuButton(new Pair<Float>(50.0f, (Globals.HEIGHT - 140.0f)), "Credits");
    exit = new MenuButton(new Pair<Float>(50.0f, (Globals.HEIGHT - 80.0f)), "Exit");
}
项目:BaseClient    文件:FadeInTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta) {
    color.a -= delta * (1.0f / fadeTime);
    if (color.a < 0) {
        color.a = 0;
    }
}
项目:BaseClient    文件:TestState1.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, StateBasedGame game, Graphics g) {
    g.setFont(font);
    g.setColor(Color.white);
    g.drawString("State Based Game Test", 100, 100);
    g.drawString("Numbers 1-3 will switch between states.", 150, 300);
    g.setColor(Color.red);
    g.drawString("This is State 1", 200, 50);
}
项目:trashjam2017    文件:TestState3.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, StateBasedGame game, Graphics g) {
    g.setFont(font);
    g.setColor(Color.blue);
    g.drawString("This is State 3", 200, 50);
    g.setColor(Color.white);

    for (int i=0;i<options.length;i++) {
        g.drawString(options[i], 400 - (font.getWidth(options[i])/2), 200+(i*50));
        if (selected == i) {
            g.drawRect(200,190+(i*50),400,50);
        }
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:GameOverState.java   
@Override
public void init(GameContainer gc, StateBasedGame game) throws SlickException {
    assets = AssetManager.getManager();

    UnicodeFont uni = assets.getFont("manaspc");
    menuButton = new MenuButton(new Pair<Float>((float)((Globals.WIDTH / 2) - (uni.getWidth("Main Menu") / 2)), (Globals.HEIGHT - 200.0f)), "Main Menu");
    exitButton = new MenuButton(new Pair<Float>((float)((Globals.WIDTH / 2) - (uni.getWidth("Give Up") / 2)), (Globals.HEIGHT - 150.0f)), "Give Up");

    time = 0L;
}
项目:trashjam2017    文件:Credits.java   
@Override
public void init(GameContainer gc, StateBasedGame sbg) throws SlickException {
    credits = new Music("res/credits.ogg");
    endTime = 0.0;
    for (CreditLine line : creditLines) {
        if (line.end > endTime)
            endTime = line.end;
    }
}
项目:BaseClient    文件:HorizontalSplitTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    offset += delta * 1f;
    if (offset > container.getWidth() / 2) {
        finish = true;
    }
}
项目:BaseClient    文件:VerticalSplitTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    offset += delta * 1f;
    if (offset > container.getHeight() / 2) {
        finish = true;
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:MenuState.java   
@Override
public void render(GameContainer gc, StateBasedGame game, Graphics g) throws SlickException {
    Image background = assets.getImage("GZS_Background02");

    g.resetTransform();
    g.clear();

    if(background != null) g.drawImage(background, 0.0f, 0.0f, Globals.WIDTH, Globals.HEIGHT, 0.0f, 0.0f, background.getWidth(), background.getHeight());

    gameStart.render(g);
    credits.render(g);
    exit.render(g);
}
项目:HCMIU_PlantsAndZombies    文件:SunUI.java   
public static void update(GameContainer gc, StateBasedGame sbg) throws SlickException {
    //timer.schedule(sunTask, 0, spawnCoolDownInMilisec);
    if (framePassed > spawnCoolDownInFrame)
    {
        framePassed = 0;
        sunManager.add(new SunNatural(sunAni));
    }

    for (int i=0; i<sunManager.size(); i++)
        if (sunManager.get(i).isDone() == false)
            sunManager.get(i).updateSun();
        else {
            sunManager.remove(i--);
        }
}
项目:HCMIU_PlantsAndZombies    文件:PlayUI.java   
/**
 * Draw SunCollected grid
 * @param gc GameContainer
 * @param sbg   StateBasedGame
 * @param g Graphics
 * @throws SlickException
 */
public static void showSunCollectedGrid(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException {
    float posX = 10 * PZGUI.getResolutionRateWidth();
    float posY = 20 * PZGUI.getResolutionRateHeight();
    float W = 200 * PZGUI.getResolutionRateWidth();
    float H = 45  * PZGUI.getResolutionRateHeight();
    g.drawRect(posX, posY, W, H);
}
项目:BaseClient    文件:TestState2.java   
/**
 * @see org.newdawn.slick.state.BasicGameState#render(org.newdawn.slick.GameContainer, org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.Graphics)
 */
public void render(GameContainer container, StateBasedGame game, Graphics g) {
    g.setFont(font);
    g.setColor(Color.green);
    g.drawString("This is State 2", 200, 50);

    g.rotate(400,300,ang);
    g.drawImage(image,400-(image.getWidth()/2),300-(image.getHeight()/2));
}
项目:Progetto-C    文件:SelectTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) throws SlickException {
    g.resetTransform();

    if (!moveBackDone) {
        g.translate(xp1,yp1);
        g.scale(scale1, scale1);
        g.setClip((int) xp1,(int) yp1,(int) (scale1*container.getWidth()),(int) (scale1*container.getHeight()));
        prev.render(container, game, g);
        g.resetTransform();
        g.clearClip();
    }
}
项目:Progetto-C    文件:VerticalSplitTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    offset += delta * 1f;
    if (offset > container.getHeight() / 2) {
        finish = true;
    }
}
项目:BaseClient    文件:CombinedTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta) throws SlickException {
       for (int i=0;i<transitions.size();i++) {
        Transition t = (Transition) transitions.get(i);

        if (!t.isComplete()) {
            t.update(game, container, delta);
        }
       }
}
项目:HCMIU_PlantsAndZombies    文件:SunUI.java   
/**
 * Render SunUI
 * @param gc    GameContainer
 * @param sbg   StateBasedGame
 * @param g Graphics
 * @throws SlickException
 */
public static void render(GameContainer gc, StateBasedGame sbg, Graphics g) throws SlickException{
    framePassed++;
    for (int i=0; i<sunManager.size(); i++)
        if ( !gc.isPaused() ) 
            sunManager.get(i).drawSun();    
        else 
            sunManager.get(i).drawStopedSun();
}
项目:Progetto-C    文件:FadeOutTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta) {
    color.a += delta * (1.0f / fadeTime);
    if (color.a > 1) {
        color.a = 1;
    }
}
项目:Generic-Zombie-Shooter-Redux    文件:GameState.java   
@Override
public void enter(GameContainer gc, StateBasedGame game) throws SlickException {
    if(!gameStarted) {
        gameStarted = true;
    }

    if(Globals.gameOver) {
        reset(gc);
        Globals.gameOver = false;
    }
}
项目:Progetto-C    文件:RotateTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#update(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, int)
 */
public void update(StateBasedGame game, GameContainer container, int delta)
        throws SlickException {
    ang += delta * 0.5f;
    if (ang > 500) {
        finish = true;
    }
    scale -= delta * 0.001f;
    if (scale < 0) {
        scale = 0;
    }
}
项目:Progetto-C    文件:FadeInTransition.java   
/**
 * @see org.newdawn.slick.state.transition.Transition#postRender(org.newdawn.slick.state.StateBasedGame, org.newdawn.slick.GameContainer, org.newdawn.slick.Graphics)
 */
public void postRender(StateBasedGame game, GameContainer container, Graphics g) {
    Color old = g.getColor();
    g.setColor(color);

    g.fillRect(0, 0, container.getWidth()*2, container.getHeight()*2);
    g.setColor(old);
}