You've already forked lazarus-ccr
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2089 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1,7 +1,7 @@
|
|||||||
object formConfig: TformConfig
|
object formConfig: TformConfig
|
||||||
Left = 345
|
Left = 731
|
||||||
Height = 432
|
Height = 432
|
||||||
Top = 296
|
Top = 390
|
||||||
Width = 582
|
Width = 582
|
||||||
Caption = 'TappyTux Loader'
|
Caption = 'TappyTux Loader'
|
||||||
ClientHeight = 432
|
ClientHeight = 432
|
||||||
|
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
tappymodules, gameplayform;
|
tappymodules, gameplayform, tappygamedata;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -77,27 +77,25 @@ end;
|
|||||||
procedure TformConfig.btnLoadClick(Sender: TObject);
|
procedure TformConfig.btnLoadClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
SetCurrentModule(comboGameType.ItemIndex);
|
SetCurrentModule(comboGameType.ItemIndex);
|
||||||
GetCurrentModule().StartNewGame();
|
GetCurrentModule().StartNewGame(comboSound.ItemIndex, comboMusic.ItemIndex, comboLevel.ItemIndex);
|
||||||
|
|
||||||
formTappyTuxGame.Show;
|
formTappyTuxGame.Show;
|
||||||
|
|
||||||
Hide;
|
Hide;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TformConfig.comboSoundChange(Sender: TObject);
|
procedure TformConfig.comboSoundChange(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
{
|
|
||||||
Case comboSound.itemIndex of
|
Case comboSound.itemIndex of
|
||||||
0: begin
|
0: begin
|
||||||
TTappyGameData.SndFX = true;
|
//gameData.SndFX := true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
1: begin
|
1: begin
|
||||||
TTappyGameData.SndFX = false;
|
//gameData.SndFX := false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
end;
|
||||||
end; }
|
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -1,10 +1,10 @@
|
|||||||
object formTappyTuxGame: TformTappyTuxGame
|
object formTappyTuxGame: TformTappyTuxGame
|
||||||
Left = 630
|
Left = 630
|
||||||
Height = 421
|
Height = 425
|
||||||
Top = 249
|
Top = 245
|
||||||
Width = 621
|
Width = 621
|
||||||
Caption = 'Tappy Tux'
|
Caption = 'Tappy Tux'
|
||||||
ClientHeight = 421
|
ClientHeight = 425
|
||||||
ClientWidth = 621
|
ClientWidth = 621
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
LCLVersion = '0.9.31'
|
LCLVersion = '0.9.31'
|
||||||
|
@ -8,7 +8,7 @@ uses
|
|||||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
// TappyTux
|
// TappyTux
|
||||||
tappydrawer, tappymodules;
|
{GameData,} tappydrawer, tappymodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -59,6 +59,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
formTappyTuxGame.Memo1.Lines.Add(Edit1.Text);
|
formTappyTuxGame.Memo1.Lines.Add(Edit1.Text);
|
||||||
formTappyTuxGame.Edit1.Clear;
|
formTappyTuxGame.Edit1.Clear;
|
||||||
|
//TappyTuxGame.ThrowHammer();
|
||||||
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -74,6 +76,10 @@ begin
|
|||||||
vTappyTuxDrawer.SendToBack();
|
vTappyTuxDrawer.SendToBack();
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{procedure TformTappyTuxGame.OnClose;
|
||||||
|
begin
|
||||||
|
formConfig
|
||||||
|
end;}
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -6,6 +6,9 @@ interface
|
|||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils,
|
Classes, SysUtils,
|
||||||
|
// LCL
|
||||||
|
ExtCtrls,
|
||||||
|
// TappyTux
|
||||||
tappymodules;
|
tappymodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
@ -17,12 +20,14 @@ type
|
|||||||
constructor Create; override;
|
constructor Create; override;
|
||||||
procedure TranslateTextsToEnglish; override;
|
procedure TranslateTextsToEnglish; override;
|
||||||
procedure TranslateTextsToPortuguese; override;
|
procedure TranslateTextsToPortuguese; override;
|
||||||
procedure StartNewGame(); override;
|
procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); override;
|
||||||
procedure EndGame(); override;
|
procedure EndGame(); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses tappydrawer {,tappygamedata};
|
||||||
|
|
||||||
{ TTappyWords }
|
{ TTappyWords }
|
||||||
|
|
||||||
constructor TTappyMath.Create;
|
constructor TTappyMath.Create;
|
||||||
@ -40,7 +45,7 @@ begin
|
|||||||
ShortDescription := 'TappyMath - Um jogo para aprender aritmética';
|
ShortDescription := 'TappyMath - Um jogo para aprender aritmética';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyMath.StartNewGame;
|
procedure TTappyMath.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
@ -9,7 +9,7 @@ uses
|
|||||||
// LCL
|
// LCL
|
||||||
ExtCtrls,
|
ExtCtrls,
|
||||||
// TappyTux
|
// TappyTux
|
||||||
tappymodules, tappydrawer;
|
tappymodules, tappygamedata;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
@ -24,12 +24,14 @@ type
|
|||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
procedure TranslateTextsToEnglish; override;
|
procedure TranslateTextsToEnglish; override;
|
||||||
procedure TranslateTextsToPortuguese; override;
|
procedure TranslateTextsToPortuguese; override;
|
||||||
procedure StartNewGame(); override;
|
procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); override;
|
||||||
procedure EndGame(); override;
|
procedure EndGame(); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
uses tappydrawer;
|
||||||
|
|
||||||
{ TTappyWords }
|
{ TTappyWords }
|
||||||
|
|
||||||
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
procedure TTappyWords.HandleOnTimer(Sender: TObject);
|
||||||
@ -48,6 +50,7 @@ begin
|
|||||||
timerWords.Enabled := False;
|
timerWords.Enabled := False;
|
||||||
timerWords.Interval := 1000;
|
timerWords.Interval := 1000;
|
||||||
timerWords.OnTimer := @HandleOnTimer;
|
timerWords.OnTimer := @HandleOnTimer;
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
destructor TTappyWords.Destroy;
|
destructor TTappyWords.Destroy;
|
||||||
@ -67,9 +70,18 @@ begin
|
|||||||
ShortDescription := 'TappyWords - Um jogo para aprender a digitar e ortografia';
|
ShortDescription := 'TappyWords - Um jogo para aprender a digitar e ortografia';
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.StartNewGame;
|
procedure TTappyWords.StartNewGame(SndFX: Integer; Music: Integer; Level: Integer);
|
||||||
begin
|
begin
|
||||||
|
|
||||||
|
//Causam "External: SIGSEGV"
|
||||||
|
gameData.SetSndFX(SndFX);
|
||||||
|
gameData.SetMusic(Music);
|
||||||
|
gameData.SetLevel(Level);
|
||||||
|
|
||||||
timerWords.Enabled := True;
|
timerWords.Enabled := True;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TTappyWords.EndGame;
|
procedure TTappyWords.EndGame;
|
||||||
|
@ -7,7 +7,7 @@ interface
|
|||||||
uses
|
uses
|
||||||
Classes, SysUtils, Controls, Graphics, LCLType, IntfGraphics, fpimage,
|
Classes, SysUtils, Controls, Graphics, LCLType, IntfGraphics, fpimage,
|
||||||
Math,
|
Math,
|
||||||
tappygamedata, tappyconfig, tappymodules;
|
{tappygamedata,} tappyconfig, tappymodules;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -1,19 +1,100 @@
|
|||||||
unit tappygamedata;
|
unit tappygamedata;
|
||||||
|
// Responsável apenas por guardar e alterar dados referentes aos jogos.
|
||||||
|
|
||||||
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
|
interface
|
||||||
|
|
||||||
|
uses
|
||||||
|
Classes, SysUtils;
|
||||||
|
|
||||||
|
type
|
||||||
|
|
||||||
|
{ GameData }
|
||||||
|
|
||||||
|
TTappyGameData = class
|
||||||
|
ModuleName : String;
|
||||||
|
SndFX : Boolean;
|
||||||
|
Music : Boolean;
|
||||||
|
Level : Integer;
|
||||||
|
Lives : Integer;
|
||||||
|
Score : Integer;
|
||||||
|
procedure SetSndFX(var newSndFX: Integer);
|
||||||
|
procedure SetMusic(var newMusic: Integer);
|
||||||
|
procedure SetLevel(var newLevel: Integer);
|
||||||
|
|
||||||
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
gameData: TTappyGameData;
|
||||||
|
|
||||||
|
implementation
|
||||||
|
|
||||||
|
procedure TTappyGameData.SetSndFX(var newSndFX: Integer);
|
||||||
|
begin
|
||||||
|
Case newSndFx of
|
||||||
|
0: gameData.SndFX := true;
|
||||||
|
1: gameData.SndFX := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTappyGameData.SetMusic(var newMusic: Integer);
|
||||||
|
begin
|
||||||
|
Case newMusic of
|
||||||
|
0: gameData.Music := true;
|
||||||
|
1: gameData.Music := false;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TTappyGameData.SetLevel(var newLevel: Integer);
|
||||||
|
begin
|
||||||
|
Level := newLevel + 1;
|
||||||
|
end;
|
||||||
|
|
||||||
|
end.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
{
|
||||||
|
unit tappygamedata;
|
||||||
|
|
||||||
{$mode objfpc}{$H+}
|
{$mode objfpc}{$H+}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, Forms, SysUtils, process;
|
Classes, Forms, SysUtils, process, LCLProc, tappymodules, mod_tappywords,{ util,} tappyconfig;
|
||||||
// SynRegExpr,
|
|
||||||
// LCLProc,
|
|
||||||
// tappywords,
|
|
||||||
// util,
|
|
||||||
// tappyconfig;
|
|
||||||
|
|
||||||
Type
|
Type
|
||||||
TTappyGameData = object
|
{TTappyGameData = class
|
||||||
SndFX : Boolean;
|
SndFX : Boolean;
|
||||||
SndMusic: Boolean;
|
SndMusic: Boolean;
|
||||||
ModuleName : String;
|
ModuleName : String;
|
||||||
@ -28,22 +109,23 @@ Type
|
|||||||
QuestionList :TStringList;
|
QuestionList :TStringList;
|
||||||
BGS : TStringList;
|
BGS : TStringList;
|
||||||
BG : Integer;
|
BG : Integer;
|
||||||
(* Procedure Create;
|
Procedure Create;
|
||||||
Function GetQuestion:String;
|
Function GetQuestion:String;
|
||||||
Function CheckAnswer(Question,Answer:String):Integer;
|
Function CheckAnswer(Question,Answer:String):Integer;
|
||||||
Procedure ScoreUp(ScorInc:Integer);
|
Procedure ScoreUp(ScorInc:Integer);
|
||||||
Procedure LevelUp;
|
Procedure LevelUp;
|
||||||
Procedure LoseLife;
|
Procedure LoseLife;
|
||||||
Function NextSong: String;
|
Function NextSong: String;
|
||||||
Function NextBG:String;*)
|
Function NextBG:String; }
|
||||||
end;
|
end;
|
||||||
|
|
||||||
(* HammerQue = Object
|
HammerQue = Object
|
||||||
Target : Array [1..10] of Integer;
|
Target : Array [1..10] of Integer;
|
||||||
|
Count: Integer; //teste
|
||||||
Function addTarget(newTarget : Integer):Boolean;
|
Function addTarget(newTarget : Integer):Boolean;
|
||||||
Procedure delTarget;
|
Procedure delTarget;
|
||||||
Count : Integer;
|
{Count : Integer;}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
TSong = class(TThread)
|
TSong = class(TThread)
|
||||||
@ -62,17 +144,17 @@ Type
|
|||||||
Constructor Create(isSuspended : boolean);
|
Constructor Create(isSuspended : boolean);
|
||||||
published
|
published
|
||||||
property terminated;
|
property terminated;
|
||||||
end;*)
|
end;
|
||||||
|
|
||||||
var
|
var
|
||||||
gGameData: TTappyGameData;
|
gGameData: TTappyGameData;
|
||||||
//Question : TQuestion;
|
Question : TQuestion;
|
||||||
//Scale : Integer;
|
Scale : Integer;
|
||||||
//TPTDIR: string;
|
TPTDIR: string;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
(*constructor TQuestion.Create(isSuspended : boolean);
|
constructor TQuestion.Create(isSuspended : boolean);
|
||||||
begin
|
begin
|
||||||
S := TSTringlist.Create;
|
S := TSTringlist.Create;
|
||||||
FreeOnTerminate := True;
|
FreeOnTerminate := True;
|
||||||
@ -86,27 +168,27 @@ Var CMD : String;
|
|||||||
Begin
|
Begin
|
||||||
repeat
|
repeat
|
||||||
If (Not Terminated) and
|
If (Not Terminated) and
|
||||||
(ThisGame.QuestionList.Count < 20) and
|
(gGameData{ThisGame}.QuestionList.Count < 20) and
|
||||||
(length(ThisGame.ModuleName) > 0) and
|
(length(gGameData{ThisGame}.ModuleName) > 0) and
|
||||||
(Length(ThisGame.Option) > 0) then
|
(Length(gGameData{ThisGame}.Option) > 0) then
|
||||||
Begin
|
Begin
|
||||||
if pos('tappywords',ThisGame.ModuleName) <> 0 then
|
if pos('tappywords',gGameData{ThisGame}.ModuleName) <> 0 then
|
||||||
Begin
|
Begin
|
||||||
TheWord :=GetQuestion(ThisGame.Level);
|
TheWord :=gGameData.GetQuestion({gGameDataThisGame.Level});
|
||||||
If ThisGame.QuestionList.IndexOf(TheWord) = -1 then
|
If gGameData{ThisGame}.QuestionList.IndexOf(TheWord) = -1 then
|
||||||
ThisGame.QuestionList.Add(TheWord);
|
gGameData{ThisGame}.QuestionList.Add(TheWord);
|
||||||
end else
|
end else
|
||||||
Begin
|
Begin
|
||||||
S.Clear;
|
S.Clear;
|
||||||
Ps := TProcess.create(nil);;
|
Ps := TProcess.create(nil);;
|
||||||
CMD := ThisGame.ModuleName' "'ThisGAme.Option'" 'intToStr(ThisGame.Level)' --getquestion';
|
CMD := gGameData{ThisGame}.ModuleName;//TESTE' "'ThisGAme.Option'" 'intToStr(ThisGame.Level)' --getquestion';
|
||||||
PS.CommandLine := cmd;
|
PS.CommandLine := cmd;
|
||||||
Ps.Options := [poNoConsole,poUsePipes,poWaitOnExit];
|
Ps.Options := [poNoConsole,poUsePipes,poWaitOnExit];
|
||||||
Ps.Execute;
|
Ps.Execute;
|
||||||
S.LoadFromStream(PS.OutPut);
|
S.LoadFromStream(PS.OutPut);
|
||||||
PS.Free;
|
PS.Free;
|
||||||
If ThisGame.QuestionList.IndexOf(S[0]) = -1 then
|
If gGameData{ThisGame}.QuestionList.IndexOf(S[0]) = -1 then
|
||||||
ThisGame.QuestionList.Add(S[0]);
|
gGameData{ThisGame}.QuestionList.Add(S[0]);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
until Terminated;
|
until Terminated;
|
||||||
@ -125,7 +207,7 @@ var
|
|||||||
begin
|
begin
|
||||||
{To prevent ESD clashes - we slow this down on first run}
|
{To prevent ESD clashes - we slow this down on first run}
|
||||||
sleep(5000);
|
sleep(5000);
|
||||||
with ThisGame do
|
with gGameData{ThisGame} do
|
||||||
begin
|
begin
|
||||||
Process := TProcess.create(nil);
|
Process := TProcess.create(nil);
|
||||||
while (NextSong <> 'NONE') and (not Terminated) do
|
while (NextSong <> 'NONE') and (not Terminated) do
|
||||||
@ -156,7 +238,7 @@ begin
|
|||||||
if not(Score > 0) then Score := 0;
|
if not(Score > 0) then Score := 0;
|
||||||
|
|
||||||
Lives := 5;
|
Lives := 5;
|
||||||
SearchFiles(SongList,TPTDirpathdelim'music'pathdelim,'*.ogg','');
|
{TESTE SearchFiles(SongList,TPTDirpathdelim'music'pathdelim,'*.ogg','');
|
||||||
|
|
||||||
If Scale = 640 then
|
If Scale = 640 then
|
||||||
SearchFiles(BGS,TPTDirpathdelim'levels','*.jpg','');
|
SearchFiles(BGS,TPTDirpathdelim'levels','*.jpg','');
|
||||||
@ -165,9 +247,10 @@ begin
|
|||||||
SearchFiles(BGS,TPTDirpathdelim'levels'pathdelim'800'pathdelim,'*.jpg','');
|
SearchFiles(BGS,TPTDirpathdelim'levels'pathdelim'800'pathdelim,'*.jpg','');
|
||||||
|
|
||||||
If scale = 1024 then
|
If scale = 1024 then
|
||||||
SearchFiles(BGS,TPTDirpathdelim'levels'pathdelim'1024'pathdelim,'*.jpg','');
|
SearchFiles(BGS,TPTDirpathdelim'levels'pathdelim'1024'pathdelim,'*.jpg','');}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
Function TTappyGameData.GetQuestion:String;
|
Function TTappyGameData.GetQuestion:String;
|
||||||
Var
|
Var
|
||||||
TheQ:String;
|
TheQ:String;
|
||||||
@ -180,13 +263,12 @@ While QuestionList.Count < 1 do
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Function TTappyGameData.CheckAnswer(Question,Answer:String):Integer;
|
Function TTappyGameData.CheckAnswer(Question,Answer:String):Integer;
|
||||||
Var S: TStringList;
|
Var S: TStringList;
|
||||||
Begin
|
Begin
|
||||||
if (length(Question) <> 0) and (length(Answer) <> 0) then
|
if (length(Question) <> 0) and (length(Answer) <> 0) then
|
||||||
begin
|
begin
|
||||||
If ThisGame.ModuleName <> 'tappywords' then
|
If gGameData{ThisGame}.ModuleName <> 'tappywords' then
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
execute(ModuleName' "'Option'" 'intToStr(Level)' --checkquestion "'Question'" "'answer'"',S);
|
execute(ModuleName' "'Option'" 'intToStr(Level)' --checkquestion "'Question'" "'answer'"',S);
|
||||||
@ -271,6 +353,6 @@ Begin
|
|||||||
Target[X] := Target[X 1];
|
Target[X] := Target[X 1];
|
||||||
Dec(Count);
|
Dec(Count);
|
||||||
|
|
||||||
end;*)
|
end;
|
||||||
|
|
||||||
end.
|
end. }
|
||||||
|
@ -24,7 +24,7 @@ type
|
|||||||
procedure TranslateTextsToEnglish; virtual;
|
procedure TranslateTextsToEnglish; virtual;
|
||||||
procedure TranslateTextsToPortuguese; virtual;
|
procedure TranslateTextsToPortuguese; virtual;
|
||||||
procedure InitModule(); virtual;
|
procedure InitModule(); virtual;
|
||||||
procedure StartNewGame(); virtual; abstract;
|
procedure StartNewGame(SndFX: Integer; Music: Integer; Level: Integer); virtual; abstract;
|
||||||
procedure EndGame(); virtual; abstract;
|
procedure EndGame(); virtual; abstract;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -38,7 +38,7 @@ implementation
|
|||||||
|
|
||||||
var
|
var
|
||||||
gTappyModules: TFPList;
|
gTappyModules: TFPList;
|
||||||
gCurrentTappyModule: Integer = -1;
|
gCurrentTappyModule: Integer = 0; //=-1
|
||||||
|
|
||||||
procedure AddModule(AModule: TTappyModule);
|
procedure AddModule(AModule: TTappyModule);
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user