Subversion Repositories AndroidProjects

Rev

Blame | Last modification | View Log | RSS feed

unit app_glscene_helpscreen;

interface

uses OpenGL, GLaux, glExt, sux_constant, sux_object, app_constant,
     resource_texture, resource_shader;

type
  TSettings=record
    hourglass:SRTexture;
    mosaic:SRTexture;
    bomb:SRTexture;
    crystal:SRTexture;
    concave:SRTexture;
    flower:SRTexture;
  end;
  SAGLSHelpScreen=class(SUXObject)
    settings:TSettings;

    procedure renderPlayerControls(const top: SXFloat; const number: SXInt; const up, down: SXStringL);
    procedure renderHelpScreen;
    procedure onTimer;

    procedure renderHintScreen;
    procedure renderPowerup(tex: SRTexture; x: Single; y: Single);

    procedure initialize;
    constructor Create(parent:TObject);
    destructor Destroy; override;
  end;

implementation

uses sux_main, gl_main, main;


// --- SAGLSHelpScreen


procedure SAGLSHelpScreen.renderPlayerControls(const top: SXFloat; const number: SXInt; const up, down: SXStringL);
begin
  app.scene.renderOutlineText(140, top, SX_GLFONT_ALIGN_LEFT, 1.5, 'Player ' + sx.convert.intToStr(number) +  ':');
  app.scene.renderOutlineText(180, top + 30, SX_GLFONT_ALIGN_LEFT, 1.5, 'Up:');
  app.scene.renderOutlineText(180, top + 60, SX_GLFONT_ALIGN_LEFT, 1.5, 'Down:');
  app.scene.renderOutlineText(480, top + 30, SX_GLFONT_ALIGN_RIGHT, 1.5, up);
  app.scene.renderOutlineText(480, top + 60, SX_GLFONT_ALIGN_RIGHT, 1.5, down);
end;


procedure SAGLSHelpScreen.renderHelpScreen;
begin
  if (app.game.settings.state.state = SX_GAME_STATE_HELPSCREEN) then begin
    app.scene.renderOutlineText(100, 50, SX_GLFONT_ALIGN_LEFT, 1.5, 'Button Layout:');
    renderPlayerControls(100, 1, 'W', 'S');
    renderPlayerControls(220, 2, 'Up', 'Down');

    app.scene.renderOutlineText(140, 370, SX_GLFONT_ALIGN_LEFT, 1.5, 'Accept:');
    app.scene.renderOutlineText(480, 370, SX_GLFONT_ALIGN_RIGHT, 1.5, 'Return');
    app.scene.renderOutlineText(140, 400, SX_GLFONT_ALIGN_LEFT, 1.5, 'Cancel:');
    app.scene.renderOutlineText(480, 400, SX_GLFONT_ALIGN_RIGHT, 1.5, 'Escape');
  end else
  if (app.game.settings.state.state = SX_GAME_STATE_HINTSCREEN) then renderHintScreen;

end;


procedure SAGLSHelpScreen.renderPowerup(tex: SRTexture; x: Single; y: Single);
begin
  gl.gl2D.renderRectangle(x, y, x + 40, y + 40, tex, SX_GL_BLEND_AVERAGE,sx.convert.ColorRGBOf(1,1,1), 1);
end;


procedure SAGLSHelpScreen.renderHintScreen;
begin
  renderPowerup(settings.hourglass, 100, 145);
  renderPowerup(settings.mosaic, 100, 195);
  renderPowerup(settings.bomb, 100, 245);
  renderPowerup(settings.crystal, 100, 295);
  renderPowerup(settings.concave, 100, 345);
  renderPowerup(settings.flower, 100, 395);

  app.scene.renderOutlineText(70, 20, SX_GLFONT_ALIGN_LEFT, 1.5, 'Hints for Power-Ups:');
  app.scene.renderOutlineText(100, 70, SX_GLFONT_ALIGN_LEFT, 1.5, 'Power-Ups are only active');
  app.scene.renderOutlineText(100, 100, SX_GLFONT_ALIGN_LEFT, 1.5, 'for a short time period!');

  app.scene.renderOutlineText(150, 160, SX_GLFONT_ALIGN_LEFT, 1.5, 'Slow down time');
  app.scene.renderOutlineText(150, 210, SX_GLFONT_ALIGN_LEFT, 1.5, 'Activate mosaic mode');
  app.scene.renderOutlineText(150, 260, SX_GLFONT_ALIGN_LEFT, 1.5, 'Destroy all crystals');
  app.scene.renderOutlineText(150, 310, SX_GLFONT_ALIGN_LEFT, 1.5, 'Grow Crystals from Walls');
  app.scene.renderOutlineText(150, 360, SX_GLFONT_ALIGN_LEFT, 1.5, 'Makes the paddles concave');
  app.scene.renderOutlineText(150, 410, SX_GLFONT_ALIGN_LEFT, 1.5, 'Flower Power!!!');

end;


procedure SAGLSHelpScreen.onTimer;
begin
  renderHelpScreen;
end;




procedure SAGLSHelpScreen.initialize;
begin
  settings.hourglass:=SRTexture.Create('textures\menu\hourglass',self);
  settings.mosaic:=SRTexture.Create('textures\menu\mosaic',self);
  settings.bomb:=SRTexture.Create('textures\menu\bomb',self);
  settings.crystal:=SRTexture.Create('textures\menu\crystal',self);
  settings.concave:=SRTexture.Create('textures\menu\concave',self);
  settings.flower:=SRTexture.Create('textures\menu\flower',self);
end;


constructor SAGLSHelpScreen.Create(parent:TObject);
begin
  inherited Create(parent,'GL Help Screen');
end;


destructor SAGLSHelpScreen.Destroy;
begin
  settings.hourglass.Free;
  settings.mosaic.Free;
  settings.bomb.Free;
  settings.crystal.Free;
  settings.concave.Free;
  settings.flower.Free;

  inherited;
end;


end.