Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 35 | chris | 1 | unit app_glscene_helpscreen; |
| 2 | |||
| 3 | interface |
||
| 4 | |||
| 5 | uses OpenGL, GLaux, glExt, sux_constant, sux_object, app_constant, |
||
| 6 | resource_texture, resource_shader; |
||
| 7 | |||
| 8 | type |
||
| 9 | TSettings=record |
||
| 10 | hourglass:SRTexture; |
||
| 11 | mosaic:SRTexture; |
||
| 12 | bomb:SRTexture; |
||
| 13 | crystal:SRTexture; |
||
| 14 | concave:SRTexture; |
||
| 15 | flower:SRTexture; |
||
| 16 | end; |
||
| 17 | SAGLSHelpScreen=class(SUXObject) |
||
| 18 | settings:TSettings; |
||
| 19 | |||
| 20 | procedure renderPlayerControls(const top: SXFloat; const number: SXInt; const up, down: SXStringL); |
||
| 21 | procedure renderHelpScreen; |
||
| 22 | procedure onTimer; |
||
| 23 | |||
| 24 | procedure renderHintScreen; |
||
| 25 | procedure renderPowerup(tex: SRTexture; x: Single; y: Single); |
||
| 26 | |||
| 27 | procedure initialize; |
||
| 28 | constructor Create(parent:TObject); |
||
| 29 | destructor Destroy; override; |
||
| 30 | end; |
||
| 31 | |||
| 32 | implementation |
||
| 33 | |||
| 34 | uses sux_main, gl_main, main; |
||
| 35 | |||
| 36 | |||
| 37 | // --- SAGLSHelpScreen |
||
| 38 | |||
| 39 | |||
| 40 | procedure SAGLSHelpScreen.renderPlayerControls(const top: SXFloat; const number: SXInt; const up, down: SXStringL); |
||
| 41 | begin |
||
| 42 | app.scene.renderOutlineText(140, top, SX_GLFONT_ALIGN_LEFT, 1.5, 'Player ' + sx.convert.intToStr(number) + ':'); |
||
| 43 | app.scene.renderOutlineText(180, top + 30, SX_GLFONT_ALIGN_LEFT, 1.5, 'Up:'); |
||
| 44 | app.scene.renderOutlineText(180, top + 60, SX_GLFONT_ALIGN_LEFT, 1.5, 'Down:'); |
||
| 45 | app.scene.renderOutlineText(480, top + 30, SX_GLFONT_ALIGN_RIGHT, 1.5, up); |
||
| 46 | app.scene.renderOutlineText(480, top + 60, SX_GLFONT_ALIGN_RIGHT, 1.5, down); |
||
| 47 | end; |
||
| 48 | |||
| 49 | |||
| 50 | procedure SAGLSHelpScreen.renderHelpScreen; |
||
| 51 | begin |
||
| 52 | if (app.game.settings.state.state = SX_GAME_STATE_HELPSCREEN) then begin |
||
| 53 | app.scene.renderOutlineText(100, 50, SX_GLFONT_ALIGN_LEFT, 1.5, 'Button Layout:'); |
||
| 54 | renderPlayerControls(100, 1, 'W', 'S'); |
||
| 55 | renderPlayerControls(220, 2, 'Up', 'Down'); |
||
| 56 | |||
| 57 | app.scene.renderOutlineText(140, 370, SX_GLFONT_ALIGN_LEFT, 1.5, 'Accept:'); |
||
| 58 | app.scene.renderOutlineText(480, 370, SX_GLFONT_ALIGN_RIGHT, 1.5, 'Return'); |
||
| 59 | app.scene.renderOutlineText(140, 400, SX_GLFONT_ALIGN_LEFT, 1.5, 'Cancel:'); |
||
| 60 | app.scene.renderOutlineText(480, 400, SX_GLFONT_ALIGN_RIGHT, 1.5, 'Escape'); |
||
| 61 | end else |
||
| 62 | if (app.game.settings.state.state = SX_GAME_STATE_HINTSCREEN) then renderHintScreen; |
||
| 63 | |||
| 64 | end; |
||
| 65 | |||
| 66 | |||
| 67 | procedure SAGLSHelpScreen.renderPowerup(tex: SRTexture; x: Single; y: Single); |
||
| 68 | begin |
||
| 69 | gl.gl2D.renderRectangle(x, y, x + 40, y + 40, tex, SX_GL_BLEND_AVERAGE,sx.convert.ColorRGBOf(1,1,1), 1); |
||
| 70 | end; |
||
| 71 | |||
| 72 | |||
| 73 | procedure SAGLSHelpScreen.renderHintScreen; |
||
| 74 | begin |
||
| 75 | renderPowerup(settings.hourglass, 100, 145); |
||
| 76 | renderPowerup(settings.mosaic, 100, 195); |
||
| 77 | renderPowerup(settings.bomb, 100, 245); |
||
| 78 | renderPowerup(settings.crystal, 100, 295); |
||
| 79 | renderPowerup(settings.concave, 100, 345); |
||
| 80 | renderPowerup(settings.flower, 100, 395); |
||
| 81 | |||
| 82 | app.scene.renderOutlineText(70, 20, SX_GLFONT_ALIGN_LEFT, 1.5, 'Hints for Power-Ups:'); |
||
| 83 | app.scene.renderOutlineText(100, 70, SX_GLFONT_ALIGN_LEFT, 1.5, 'Power-Ups are only active'); |
||
| 84 | app.scene.renderOutlineText(100, 100, SX_GLFONT_ALIGN_LEFT, 1.5, 'for a short time period!'); |
||
| 85 | |||
| 86 | app.scene.renderOutlineText(150, 160, SX_GLFONT_ALIGN_LEFT, 1.5, 'Slow down time'); |
||
| 87 | app.scene.renderOutlineText(150, 210, SX_GLFONT_ALIGN_LEFT, 1.5, 'Activate mosaic mode'); |
||
| 88 | app.scene.renderOutlineText(150, 260, SX_GLFONT_ALIGN_LEFT, 1.5, 'Destroy all crystals'); |
||
| 89 | app.scene.renderOutlineText(150, 310, SX_GLFONT_ALIGN_LEFT, 1.5, 'Grow Crystals from Walls'); |
||
| 90 | app.scene.renderOutlineText(150, 360, SX_GLFONT_ALIGN_LEFT, 1.5, 'Makes the paddles concave'); |
||
| 91 | app.scene.renderOutlineText(150, 410, SX_GLFONT_ALIGN_LEFT, 1.5, 'Flower Power!!!'); |
||
| 92 | |||
| 93 | end; |
||
| 94 | |||
| 95 | |||
| 96 | procedure SAGLSHelpScreen.onTimer; |
||
| 97 | begin |
||
| 98 | renderHelpScreen; |
||
| 99 | end; |
||
| 100 | |||
| 101 | |||
| 102 | |||
| 103 | |||
| 104 | procedure SAGLSHelpScreen.initialize; |
||
| 105 | begin |
||
| 106 | settings.hourglass:=SRTexture.Create('textures\menu\hourglass',self); |
||
| 107 | settings.mosaic:=SRTexture.Create('textures\menu\mosaic',self); |
||
| 108 | settings.bomb:=SRTexture.Create('textures\menu\bomb',self); |
||
| 109 | settings.crystal:=SRTexture.Create('textures\menu\crystal',self); |
||
| 110 | settings.concave:=SRTexture.Create('textures\menu\concave',self); |
||
| 111 | settings.flower:=SRTexture.Create('textures\menu\flower',self); |
||
| 112 | end; |
||
| 113 | |||
| 114 | |||
| 115 | constructor SAGLSHelpScreen.Create(parent:TObject); |
||
| 116 | begin |
||
| 117 | inherited Create(parent,'GL Help Screen'); |
||
| 118 | end; |
||
| 119 | |||
| 120 | |||
| 121 | destructor SAGLSHelpScreen.Destroy; |
||
| 122 | begin |
||
| 123 | settings.hourglass.Free; |
||
| 124 | settings.mosaic.Free; |
||
| 125 | settings.bomb.Free; |
||
| 126 | settings.crystal.Free; |
||
| 127 | settings.concave.Free; |
||
| 128 | settings.flower.Free; |
||
| 129 | |||
| 130 | inherited; |
||
| 131 | end; |
||
| 132 | |||
| 133 | |||
| 134 | end. |