Aktuelle Zeit: Sa Mai 18, 2013 6:37 pm


Neues Thema erstellenAntwort erstellen Seite 1 von 1   [ 8 Beiträge ]
Autor Nachricht
BeitragVerfasst: Mo Mai 22, 2006 11:48 pm 
Mostly Harmless
Mostly Harmless
Benutzeravatar

Registriert: Mo Mai 22, 2006 9:06 pm
Beiträge: 11
i have a similar like that

Procedure TForm_3D.OmegaTimerTimer(Sender: TObject);
Begin
OmegaInput.Update;
...
...
if oisButton5 in OmegaInput.Keyboard.States then // G Key
Begin
App_Opciones.f_DestinoShow:= not App_Opciones.f_DestinoShow;
end;
...
...
end;

This causes to active and deactive the option very, very fast, i have the problem with all the shortcuts i created, do you understand the problem, the sprites seems flickering

¿Some clue how you avoid this effect ?

PD. Sorry my poor english :cry:


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 23, 2006 7:40 am 
Site Admin
Site Admin
Benutzeravatar

Registriert: Di Mai 04, 2004 9:48 am
Beiträge: 4065
Wohnort: Drolshagen (Germany/NRW)
Are they alway flickering or just when Oisbutton5 is pressed?

Instead of the States try Statesclicked....

States returns true always when the button is still pressed, StatesClicked only for one time until it is up again.

Firle

_________________
You know you've spent too much time on the computer when you spill milk and the first thing you think is, 'edit, undo.'


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 23, 2006 9:03 pm 
Mostly Harmless
Mostly Harmless
Benutzeravatar

Registriert: Mo Mai 22, 2006 9:06 pm
Beiträge: 11
Great!!!

The use of StatesClicked in Shortcuts and mouse selections has solved the flickering

Many Thx

_________________
-=Sargora=-


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Di Mai 23, 2006 9:07 pm 
Mostly Harmless
Mostly Harmless
Benutzeravatar

Registriert: Mo Mai 22, 2006 9:06 pm
Beiträge: 11
But i have another one similar

....
....
if oisButton7 in OmegaInput.Keyboard.States then //DIK_UP;
Begin
If Ventana_Y>1 Then Dec(Ventana_Y);
end;

if oisButton8 in OmegaInput.Keyboard.States then //DIK_DOWN;
Begin
If (Ventana_Y + AltoVentana)<Mundo.Alto Then INC(Ventana_Y);
end;

if oisButton9 in OmegaInput.Keyboard.States then //DIK_LEFT;
Begin
If Ventana_X>1 Then Dec(Ventana_X);
end;

if oisButton10 in OmegaInput.Keyboard.States then //DIK_RIGHT;
Begin
If (Ventana_X + Anchoventana)<Mundo.Ancho Then INC(Ventana_X);
end;
....
....

This code control the scroll of the 'windowed' tiles, but it runs very very fast...

Some advice to control the 'speed' of the scrool with keys?
I suppose that if i implement scroll with mouse i will have the same problem but cant be solved with the use of StatesClicked insted of States.

_________________
-=Sargora=-


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Mi Mai 24, 2006 7:39 am 
Site Admin
Site Admin
Benutzeravatar

Registriert: Di Mai 04, 2004 9:48 am
Beiträge: 4065
Wohnort: Drolshagen (Germany/NRW)
Hello,

a solution might be only ask that every 8th frame?

in timer.timer event:

ntimer:=ntimer+1;

and then like this:

if oisButton7 in OmegaInput.Keyboard.States then //DIK_UP;
Begin
if ntimer mod 8=0 then If Ventana_Y>1 Then Dec(Ventana_Y);
end;

Please try out.

Firle

_________________
You know you've spent too much time on the computer when you spill milk and the first thing you think is, 'edit, undo.'


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Fr Mai 26, 2006 11:43 am 
Deadly
Deadly
Benutzeravatar

Registriert: Di Jan 11, 2005 8:48 pm
Beiträge: 127
You should synchronize it with the Framerate, so it will run with exactly the same speed on every computer. This should normally done with all movements...
For this you need the time in seconds since the last Frame (TiElap) in Seconds and extra Single/Float-Koordinates (fVentana_XY) for your Object if Ventana_XY are not already form Type Single. You can controll the Speed of the Object with fUnitsPerSecond.

Code:
if oisButton7 in OmegaInput.Keyboard.States then //DIK_UP
begin
    if fVentana_Y > 1.0 then begin
        fVentana_Y := fVentana_Y - (TiElap * fUnitsPerSecond);
        Ventana_Y := round(fVentana_Y);  // only if Omega can't deal with floats
    end;
end;



For the timer:

Code:
uses MMSystem;  // <-- i'm not sure if you need this

var
 {Timer}
    TiAvai: Boolean;
    TiFreq, TiLast, TiCur: Int64;
    TiScal, TiElap: Double;

{High Performance Counter - Initialisation, only once}
  TiAvai := false;
  if not QueryPerformanceFrequency( TiFreq ) then begin
    TiLast := timeGetTime;
    TiScal := 0.001;
  end
  else begin
    TiAvai := true;
    TiScal := 1 / TiFreq;
    QueryPerformanceCounter( TiLast );
  end;       

{High Performance Counter - Update every Frame}
  if TiAvai then
    QueryPerformanceCounter( TiCur )
  else
    TiCur := TimeGetTime;
  TiElap := (TiCur-TiLast) * TiScal;
  TiLast := TiCur;

  // block frames slower than 5 fps to avoid some problems
  if (TiElap > 0.2) then TiElap := 0.2;


Sorry for bad english, maybe.... :roll:

Coolcat

_________________
Member of DelphiDev.de - Team


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 27, 2006 1:19 pm 
Mostly Harmless
Mostly Harmless
Benutzeravatar

Registriert: Mo Mai 22, 2006 9:06 pm
Beiträge: 11
Firlefranz

Works ok and i can vary the speed with the ' mod 8' as 'mod speedscroll'

Many thanks

_________________
-=Sargora=-


Nach oben
 Profil  
 
 Betreff des Beitrags:
BeitragVerfasst: Sa Mai 27, 2006 1:21 pm 
Mostly Harmless
Mostly Harmless
Benutzeravatar

Registriert: Mo Mai 22, 2006 9:06 pm
Beiträge: 11
Coolcat

im going to check your soluction to control the speed in various computers, thx for the code!!!

_________________
-=Sargora=-


Nach oben
 Profil  
 
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Neues Thema erstellenAntwort erstellen Seite 1 von 1   [ 8 Beiträge ]


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 0 Gäste


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
cron


Powered by phpBB® Forum Software © phpBB Group
twilightBB Style by Daniel St. Jules of Gamexe.net

Deutsche Übersetzung durch phpBB.de