X-Git-Url: https://troll.desast.re/troll.git/blobdiff_plain/20c63dac92d830a4c61f6d17ecfb8e7e0d04e58d..798b92dbe890d45ae15aa896f78a6f60dd84b89e:/src/main/java/com/codingame/game/View.java?ds=inline diff --git a/src/main/java/com/codingame/game/View.java b/src/main/java/com/codingame/game/View.java index 34894ac..38dcac1 100644 --- a/src/main/java/com/codingame/game/View.java +++ b/src/main/java/com/codingame/game/View.java @@ -2,11 +2,44 @@ package com.codingame.game; import java.util.Random; +import com.codingame.gameengine.module.entities.GraphicEntityModule; import com.codingame.gameengine.module.entities.Sprite; import com.codingame.gameengine.module.entities.Text; +import com.google.inject.Inject; class View { + @Inject private GraphicEntityModule graphicEntityModule; + Random random = new Random(); Sprite troll; Text trollPositionGauge; + + void init() { + drawBackground(); + drawTroll(); + } + + private void drawBackground() { + graphicEntityModule.createSprite() + .setImage("background.png") + .setAnchor(0); + } + + private void drawTroll() { + troll = graphicEntityModule.createSprite() + .setImage("troll.png") + .setAnchorX(0.5) + .setAnchorY(1) + .setX(1920/2) + .setY(880) + .setZIndex(2); + trollPositionGauge = graphicEntityModule.createText() + .setZIndex(2) + .setAnchor(0.5) + .setFontSize(40) + .setX(1980/2) + .setY(980) + .setFillColor(0xffffff); + } + }