Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 35 | chris | 1 | unit app_glscene_menu; |
| 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 | logo:SRTexture; |
||
| 11 | end; |
||
| 12 | SAGLSMenu=class(SUXObject) |
||
| 13 | settings:TSettings; |
||
| 14 | |||
| 15 | procedure renderLogo; |
||
| 16 | procedure renderOptions; |
||
| 17 | procedure onTimer; |
||
| 18 | |||
| 19 | procedure initialize; |
||
| 20 | constructor Create(parent:TObject); |
||
| 21 | destructor Destroy; override; |
||
| 22 | end; |
||
| 23 | |||
| 24 | implementation |
||
| 25 | |||
| 26 | uses sux_main, gl_main, main; |
||
| 27 | |||
| 28 | |||
| 29 | // --- SAGLSMenu |
||
| 30 | |||
| 31 | |||
| 32 | procedure SAGLSMenu.renderLogo; |
||
| 33 | var density:SXFloat; |
||
| 34 | begin |
||
| 35 | density:=sx.math.random.getRandomFloat(0.7,1); |
||
| 36 | gl.gl2D.renderPatternQuad(settings.logo,SX_GL_BLEND_AVERAGE,sx.convert.ColorRGBOf(1,1,1), |
||
| 37 | density,0,0,1,1,320,240,200); |
||
| 38 | end; |
||
| 39 | |||
| 40 | |||
| 41 | procedure SAGLSMenu.renderOptions; |
||
| 42 | var top:SXFloat; |
||
| 43 | begin |
||
| 44 | top:=320; |
||
| 45 | |||
| 46 | app.scene.renderOutlineText(240,top,SX_GLFONT_ALIGN_LEFT, |
||
| 47 | 1.5,'Start Game'); |
||
| 48 | app.scene.renderOutlineText(240,top+25,SX_GLFONT_ALIGN_LEFT, |
||
| 49 | 1.5,'High Score'); |
||
| 50 | app.scene.renderOutlineText(240,top+50,SX_GLFONT_ALIGN_LEFT, |
||
| 51 | 1.5,'Help!'); |
||
| 52 | if (app.ini.settings.menu.canquit) then |
||
| 53 | begin |
||
| 54 | app.scene.renderOutlineText(240,top+75,SX_GLFONT_ALIGN_LEFT, |
||
| 55 | 1.5,'Quit'); |
||
| 56 | end; |
||
| 57 | app.scene.renderOutlineText(220,top+app.game.settings.menu.selection*25,SX_GLFONT_ALIGN_LEFT, |
||
| 58 | 1.5,'>'); |
||
| 59 | end; |
||
| 60 | |||
| 61 | |||
| 62 | procedure SAGLSMenu.onTimer; |
||
| 63 | begin |
||
| 64 | renderLogo; |
||
| 65 | renderOptions; |
||
| 66 | end; |
||
| 67 | |||
| 68 | |||
| 69 | |||
| 70 | |||
| 71 | procedure SAGLSMenu.initialize; |
||
| 72 | begin |
||
| 73 | settings.logo:=SRTexture.Create('textures\menu\logo',self); |
||
| 74 | end; |
||
| 75 | |||
| 76 | |||
| 77 | constructor SAGLSMenu.Create(parent:TObject); |
||
| 78 | begin |
||
| 79 | inherited Create(parent,'GL Menu'); |
||
| 80 | end; |
||
| 81 | |||
| 82 | |||
| 83 | destructor SAGLSMenu.Destroy; |
||
| 84 | begin |
||
| 85 | settings.logo.Free; |
||
| 86 | |||
| 87 | inherited; |
||
| 88 | end; |
||
| 89 | |||
| 90 | |||
| 91 | end. |