Furmiga
01-04-2004, 05:45 PM
Hi guys im new here and im new on Delphi Gamming dev. Im using UnDelphix to make a test and im getting some weird things: here ya go
My pc : ath 1.7 , GF4 64 8x , 512 DDR
Plataform : Win XP pro / Delphi 7
procedure TForm1.telaInitializeSurface(Sender: TObject);
begin
tela.Surface.Canvas.Font.Color := clWhite;
tela.Surface.Canvas.Font.Name := 'Zurich XCn BT';
tela.Surface.Canvas.Font.Size := 12;
end;
procedure TForm1.login;
var
borda : TRect;
begin
borda.Top := 200;
borda.Bottom := 280;
borda.Left := 250;
borda.Right:= 450;
tela.Surface.FillRectAlpha(borda,clRed,50);
tela.Surface.Canvas.Brush.Style := bsClear;
tela.Surface.Canvas.Textout( borda.Top + 60, borda.Left - 45,'Login');
tela.Surface.Canvas.Textout( borda.Top + 60, borda.Left - 25,'Pass');
if showfps then
tela.Surface.Canvas.Textout( 0, 0,'FPS: '+inttoSTR(timer1.FrameRate));
tela.Surface.Canvas.Brush.Color := clWhite;
tela.Surface.Canvas.FrameRect(borda);
tela.Surface.Canvas.Release;
end;
procedure TForm1.seila;
var
i : integer;
mp : TPoint;
begin
i := tela.Display.Width-10-imagens.Items[fps].PatternWidth;
GetCursorPos(mp);
if pointinrect(mp,bounds(i,10,imagens.Items[fps].Patt ernWidth,imagens.Items[fps].PatternHeight)) then
begin
imagens.Items[fps].Draw(tela.surface,i,10,1);
if mouseB then
begin
mouseB := false;
if showfps then
showfps := false
else
showfps := true;
exit;
end;
end
else
imagens.Items[fps].Draw(tela.surface,i,10,0);
end;
procedure TForm1.timer1Timer(Sender: TObject; LagCount: Integer);
begin
tela.Surface.Fill(0);
imagens.Items[LoginScreen].Draw(tela.surface,0,0,0 );
if situacao = 'login' then
login;
seila;
tela.Flip;
end;
when i run the test all fine with 60 fps ( monitor )
The problem is when i use the FillRectAlpha it drops to 51 fps on my pc and 30 on my Bro's ( and he got a better one lol ).
I was thinking in create some windows ( using alpha ) but with if i use like 4 times the FillRectAlpha my FPS drops to 14 lol
btw im calling situacao := 'login' on create.
Please take a look on my code and tell me what im doing wrong or if there is another way to make those windows.
ty in advance
My pc : ath 1.7 , GF4 64 8x , 512 DDR
Plataform : Win XP pro / Delphi 7
procedure TForm1.telaInitializeSurface(Sender: TObject);
begin
tela.Surface.Canvas.Font.Color := clWhite;
tela.Surface.Canvas.Font.Name := 'Zurich XCn BT';
tela.Surface.Canvas.Font.Size := 12;
end;
procedure TForm1.login;
var
borda : TRect;
begin
borda.Top := 200;
borda.Bottom := 280;
borda.Left := 250;
borda.Right:= 450;
tela.Surface.FillRectAlpha(borda,clRed,50);
tela.Surface.Canvas.Brush.Style := bsClear;
tela.Surface.Canvas.Textout( borda.Top + 60, borda.Left - 45,'Login');
tela.Surface.Canvas.Textout( borda.Top + 60, borda.Left - 25,'Pass');
if showfps then
tela.Surface.Canvas.Textout( 0, 0,'FPS: '+inttoSTR(timer1.FrameRate));
tela.Surface.Canvas.Brush.Color := clWhite;
tela.Surface.Canvas.FrameRect(borda);
tela.Surface.Canvas.Release;
end;
procedure TForm1.seila;
var
i : integer;
mp : TPoint;
begin
i := tela.Display.Width-10-imagens.Items[fps].PatternWidth;
GetCursorPos(mp);
if pointinrect(mp,bounds(i,10,imagens.Items[fps].Patt ernWidth,imagens.Items[fps].PatternHeight)) then
begin
imagens.Items[fps].Draw(tela.surface,i,10,1);
if mouseB then
begin
mouseB := false;
if showfps then
showfps := false
else
showfps := true;
exit;
end;
end
else
imagens.Items[fps].Draw(tela.surface,i,10,0);
end;
procedure TForm1.timer1Timer(Sender: TObject; LagCount: Integer);
begin
tela.Surface.Fill(0);
imagens.Items[LoginScreen].Draw(tela.surface,0,0,0 );
if situacao = 'login' then
login;
seila;
tela.Flip;
end;
when i run the test all fine with 60 fps ( monitor )
The problem is when i use the FillRectAlpha it drops to 51 fps on my pc and 30 on my Bro's ( and he got a better one lol ).
I was thinking in create some windows ( using alpha ) but with if i use like 4 times the FillRectAlpha my FPS drops to 14 lol
btw im calling situacao := 'login' on create.
Please take a look on my code and tell me what im doing wrong or if there is another way to make those windows.
ty in advance