private void drawTitleImage(Painter p, Color4f color) { TextureQuad titleScreen = TexturesLoader.getQuad(GameRessources.PATH_TITLE_SCREEN); double scale = this.theTextPainter.getRealScale() * 1d / 3d; double width = theWindow.getWidthOnGLOrtho(titleScreen.getWidth()) * scale; double height = theWindow.getHeightOnGLOrtho(titleScreen.getHeight()) * scale; final double hOffset = 0.2 * scale; p.setColor(color); p.setTexture(titleScreen); GLUtil.drawQuad2D(-width / 2, height / 2 + hOffset, width / 2, -height / 2 + hOffset, p); }
@Override protected void drawComponentAppearing(Painter painter) { switch (appearSelector) { case FIRST_APPEARING: TextureQuad tex1 = TexturesLoader.getQuad( String.format(GameRessources.SPEC_PATH_TERRAIN, 1) + GameRessources.TEX_SOL); float colorUnit = (float) ((double) getAppearCount() / timeToAppear() * 0.5); Color4f color = new Color4f(colorUnit, colorUnit, colorUnit); Color4f buttonColor = new Color4f(colorUnit * 2, colorUnit * 2, colorUnit * 2); painter.setColor(color); tex1.fillScreen2D(0.5, 0.5, true, painter); drawTitleImage(painter, buttonColor); newPart.setColor(buttonColor); loadPart.setColor(buttonColor); break; default: super.drawComponentAppearing(painter); } }
static { // ---- MAPPING decorTextureSetMap.put(DecorType.MONTS, decorMONTSTextureSet); decorTextureSetMap.put(DecorType.GROTTE, decorGROTTETextureSet); decorTextureSetMap.put(DecorType.ENFERS, decorENFERSTextureSet); levelTextureSetMap.put(1, level1TextureSet); levelTextureSetMap.put(2, level2TextureSet); decorModelSetMap.put(DecorType.MONTS, decorMONTSModelSet); decorModelSetMap.put(DecorType.GROTTE, decorGROTTEModelSet); decorModelSetMap.put(DecorType.ENFERS, decorENFERSModelSet); levelModelSetMap.put(1, level1ModelSet); levelModelSetMap.put(2, level2ModelSet); int width, height; // Textures des décors. width = 8; height = 8; for (DecorType type : DecorType.values()) { String terrainPath = Util.formatDecimal(SPEC_PATH_TERRAIN, type.getIndex() + 1); gameTextureSet.createImage(terrainPath); String pathsMurs[] = new String[WallTile.NB_IMAGE]; for (int j = 0; j < pathsMurs.length; j++) { pathsMurs[j] = terrainPath + Util.formatDecimal(SPEC_TEX_MUR, j); } gameTextureSet.addTextureModel( terrainPath + TEX_SOL, new TextureQuad(1, 1, width, height, 0)); gameTextureSet.addTextureModel( terrainPath + TEX_INACCESSIBLE, new TextureQuad(4, 1, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.HAUT], new TextureQuad(1, 0, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.DROITE], new TextureQuad(2, 1, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.GAUCHE], new TextureQuad(0, 1, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.BAS], new TextureQuad(1, 2, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.COIN_GAUCHE_HAUT], new TextureQuad(0, 0, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.COIN_DROIT_HAUT], new TextureQuad(2, 0, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.COIN_DROIT_BAS], new TextureQuad(2, 2, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.COIN_GAUCHE_BAS], new TextureQuad(0, 2, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.ANGLE_GAUCHE_HAUT], new TextureQuad(3, 0, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.ANGLE_DROIT_HAUT], new TextureQuad(5, 0, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.ANGLE_DROIT_BAS], new TextureQuad(5, 2, width, height, 0)); gameTextureSet.addTextureModel( pathsMurs[WallTile.ANGLE_GAUCHE_BAS], new TextureQuad(3, 2, width, height, 0)); } // Texture des différents composants du jeu. gameTextureSet.createImage(PATH_COMPOSANTS); width = 2048; height = 2048; gameTextureSet.addTextureModel( ID_AIMANT, new TextureQuad(0, 1664, 128, 1856, width, height, 0)); gameTextureSet.addTextureModel( ID_EXIT0, new TextureQuad(256, 1408, 512, 1664, width, height, 0)); gameTextureSet.addTextureModel(ID_GENERATOR, new TextureQuad(0, 0, 512, 512, width, height, 0)); gameTextureSet.addTextureModel( ID_LAMP_IN, new TextureQuad(256, 1024, 512, 1408, width, height, 0)); gameTextureSet.addTextureModel( ID_LAMP_OUT, new TextureQuad(0, 1024, 256, 1408, width, height, 0)); gameTextureSet.addTextureModel( ID_LAMP_PERTURBATRICE_OFF, new TextureQuad(768, 1408, 1024, 1664, width, height, 0)); gameTextureSet.addTextureModel( ID_LAMP_PERTURBATRICE_ON, new TextureQuad(512, 1408, 768, 1664, width, height, 0)); gameTextureSet.addTextureModel( ID_LASERS, new TextureQuad(1280, 1408, 1792, 1664, width, height, 0)); gameTextureSet.addTextureModel( ID_MINI_ELECTROCRYSTAL, new TextureQuad(0, 1984, 64, 2048, width, height, 0)); gameTextureSet.addTextureModel( ID_MAGNETIC_FIELD_INDICATOR, new TextureQuad(2016, 2016, 2048, 2048, width, height, 0)); gameTextureSet.addTextureModel( ID_PERTURBATEUR, new TextureQuad(0, 1856, 128, 1984, width, height, 0)); gameTextureSet.addTextureModel( ID_PORTAL, new TextureQuad(0, 1408, 256, 1664, width, height, 0)); gameTextureSet.addTextureModel( ID_WAVE_GENERATOR_EAST, new TextureQuad(768, 256, 1024, 512, width, height, 0)); gameTextureSet.addTextureModel( ID_WAVE_GENERATOR_NORD, new TextureQuad(512, 0, 768, 256, width, height, 0)); gameTextureSet.addTextureModel( ID_WAVE_GENERATOR_SOUTH, new TextureQuad(768, 0, 1024, 256, width, height, 0)); gameTextureSet.addTextureModel( ID_WAVE_GENERATOR_WEST, new TextureQuad(512, 256, 768, 512, width, height, 0)); gameTextureSet.addTextureModel( ID_WAVES, new TextureQuad(1024, 1408, 1280, 1664, width, height, 0)); gameTextureSet.createImage(PATH_MAP); width = 512; height = 512; gameTextureSet.addTextureModel( ID_MAP_CRYSTAL, new TextureQuad(320, 0, 352, 32, width, height, 0)); gameTextureSet.addTextureModel( ID_MAP_BACKGROUND, new TextureQuad(0, 0, 256, 256, width, height, 0)); gameTextureSet.addTextureModel( ID_MAP_GENERATOR, new TextureQuad(0, 256, 160, 416, width, height, 0)); gameTextureSet.addTextureModel(ID_MAP_LAMP, new TextureQuad(288, 0, 320, 32, width, height, 0)); gameTextureSet.addTextureModel( ID_MAP_LAMP_RANDOM, new TextureQuad(352, 0, 384, 32, width, height, 0)); gameTextureSet.addTextureModel( ID_MAP_PLAYER, new TextureQuad(256, 0, 288, 32, width, height, 0)); gameTextureSet.createImage(PATH_PLAYER); width = 512; height = 512; gameTextureSet.addTextureModel( ID_PLAYER_STANDING, TexturesLoader.createAnimatedTexture( SPRITE_WIDTH, SPRITE_HEIGHT, NB_FRAMES, 0, width, height)); gameTextureSet.createImage(PATH_ANIM000_DANGEROUS_CRYSTAL); gameTextureSet.addTextureModel( PATH_ANIM000_DANGEROUS_CRYSTAL, TexturesLoader.createAnimatedTexture(128, 192, 12, 0, 1536, 192)); gameTextureSet.createImage(PATH_ANIM003_PERMANENT_MODE_LAMP); gameTextureSet.addTextureModel( PATH_ANIM003_PERMANENT_MODE_LAMP, TexturesLoader.createAnimatedTexture(256, 256, 4, 0, 1024, 256).withFPS(12)); // Gui in game gameTextureSet.createImage(PATH_DIALOG_BACKGROUND); width = 256; height = 256; gameTextureSet.addTextureModel( TEX_DIALOG_BACKGROUND_LEFT, new TextureQuad(0, 0, 32, height, width, height, 0)); gameTextureSet.addTextureModel( TEX_DIALOG_BACKGROUND_CENTER, new TextureQuad(32, 0, width - 32, height, width, height, 0)); gameTextureSet.addTextureModel( TEX_DIALOG_BACKGROUND_RIGHT, new TextureQuad(width - 32, 0, width, height, width, height, 0)); gameTextureSet.createImage(PATH_DIRECTIONS_CIRCLE); width = 128; height = 128; gameTextureSet.addTextureModel( PATH_DIRECTIONS_CIRCLE, new TextureQuad(0, 0, width, height, width, height, 0)); gameTextureSet.createImage(PATH_DIRECTION_ARROW); width = 64; height = 64; gameTextureSet.addTextureModel( PATH_DIRECTION_ARROW, new TextureQuad(0, 0, width, height, width, height, 0)); // Textures de l'interface graphique guiTextureSet.createImage(PATH_BONUS_LEVEL_BUTTONS); width = 512; height = 512; guiTextureSet.addTextureModel( TEX_BONUS_BUTTON_0_ENFERS, new TextureQuad(0, 0, 256, 256, width, height, 0)); guiTextureSet.createImage(PATH_GUI); width = 1024; height = 1024; guiTextureSet.addTextureModel(ID_BUTTON, new TextureQuad(0, 0, 255, 63, width, height, 0)); guiTextureSet.addTextureModel( ID_BUTTON_OVER, new TextureQuad(0, 64, 255, 127, width, height, 0)); guiTextureSet.addTextureModel( ID_BUTTON_PRESSED, new TextureQuad(0, 128, 255, 191, width, height, 0)); guiTextureSet.addTextureModel( ID_TEXTFIELD1, new TextureQuad(0, 192, 255, 255, width, height, 0)); guiTextureSet.createImage(PATH_TERRAIN_GUI); guiTextureSet.addTextureModel(ID_BACKGROUND, gameTextureSet.findTextureModel(ID_BACKGROUND)); guiTextureSet.createImage(PATH_TITLE_SCREEN); width = 896; height = 640; guiTextureSet.addTextureModel( PATH_TITLE_SCREEN, new TextureQuad(0, 0, width, height, width, height, 0)); // Textures du menu "Jeu libre" for (DecorType decor : DecorType.values()) { String terrainPath = Util.formatDecimal(GameRessources.SPEC_PATH_TERRAIN, decor.getIndex() + 1); freeGameTextureSet.createImage(terrainPath); String id = terrainPath + GameRessources.TEX_INACCESSIBLE; freeGameTextureSet.addTextureModel(id, gameTextureSet.findTextureModel(id)); } // Textures du décor MONTS // pour l'instant rien de plus. // Textures du décor GROTTE decorGROTTETextureSet.createImage(PATH_MAP); width = 512; height = 512; decorGROTTETextureSet.addTextureModel( TEX_MAP_ROCK, new TextureQuad(384, 0, 416, 32, width, height, 0)); // Textures du niveau 1 level1TextureSet.addImage(gameTextureSet.getImage(GameRessources.PATH_COMPOSANTS)); level1TextureSet.createImage(PATH_LVL1_TEXTURES); width = 2048; height = 2048; level1TextureSet.addTextureModel(TEX_ARBRE, new TextureQuad(0, 0, 512, 512, width, height, 0)); level1TextureSet.addTextureModel( TEX_ENTREE_GROTTE, new TextureQuad(768, 1408, 1536, 1664, width, height, 0)); level1TextureSet.addTextureModel( TEX_HERBE, new TextureQuad(0, 1984, 64, 2048, width, height, 0)); level1TextureSet.addTextureModel( TEX_SOL_VEGETAL0, new TextureQuad(0, 1408, 256, 1664, width, height, 0)); level1TextureSet.addTextureModel( TEX_SOL_VEGETAL1, new TextureQuad(256, 1408, 512, 1664, width, height, 0)); level1TextureSet.addTextureModel( TEX_SOL_VEGETAL2, new TextureQuad(512, 1408, 768, 1664, width, height, 0)); // Textures du niveau 2 level2TextureSet.createImage(PATH_ANIM001_PLASMATIC_WALL); level2TextureSet.addTextureModel( PATH_ANIM001_PLASMATIC_WALL, TexturesLoader.createAnimatedTexture(256, 192, 24, 0, 6144, 192).withFPS(12)); level2TextureSet.createImage(PATH_ANIM002_OPENING_PORTAL); level2TextureSet.addTextureModel( PATH_ANIM002_OPENING_PORTAL, TexturesLoader.createAnimatedTexture(256, 256, 12, 0, 3072, 256).withFPS(24)); level2TextureSet.createImage(PATH_ANIM004_TRAP_OFF); width = 768; height = 256; level2TextureSet.addTextureModel( PATH_ANIM004_TRAP_OFF, TexturesLoader.createAnimatedTexture(256, 256, 2, 0, width, height).withFPS(4)); level2TextureSet.addTextureModel( TEX_TRAP_OFF_IMAGE, new TextureQuad(0, 0, 256, 256, width, height, 0)); level2TextureSet.addTextureModel( TEX_TRAP_ACTIVE, new TextureQuad(512, 0, 768, 256, width, height, 0)); level2TextureSet.createImage(PATH_LVL2_TEXTURES); width = 1024; height = 1024; level2TextureSet.addTextureModel( TEX_PENTAGRAM, new TextureQuad(0, 0, 512, 512, width, height, 0)); level2TextureSet.addTextureModel( TEX_PLASMATIC_WALL, new TextureQuad(0, 640, 256, 832, width, height, 0)); level2TextureSet.addTextureModel( TEX_PORTAL_OFF, new TextureQuad(768, 0, 1024, 256, width, height, 0)); level2TextureSet.addTextureModel( TEX_PORTAL_ON, new TextureQuad(512, 0, 768, 256, width, height, 0)); level2TextureSet.createImage(PATH_CREATURE); width = 678; height = 240; level2TextureSet.addTextureModel( PATH_CREATURE, new TextureQuad(0, 0, 678, 240, width, height, 0)); // Modèles de tous les décors for (DecorType type : DecorType.values()) { int index = type.getIndex() + 1; getModelSetByLandscape(type).add(Util.formatDecimal(SPEC_PATH_MODEL_MUR_DROIT, index)); getModelSetByLandscape(type).add(Util.formatDecimal(SPEC_PATH_MODEL_MUR_COIN, index)); getModelSetByLandscape(type).add(Util.formatDecimal(SPEC_PATH_MODEL_MUR_ANGLE, index)); } // Modèles du décor grotte decorGROTTEModelSet.add(PATH_MODEL_LVL2_ROCKS); // Modèles du niveau 2 level2ModelSet.add(PATH_MODEL_LVL2_CONTROLPANE); // Sons du jeu tmSoundSet.addSound(SOUND_GUI_BUTTONS); tmSoundSet.addSound(SOUND_STEPS); }