Autor Beitrag
zero_cool1986
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 14:44 
hi also ich hab ein Problem ich schreibe im onekeydown ereignis der form if key=vk_return then... das funktioniert aber wenn ich schreibe if key=vk_down then... dann gehts nicht außerdem wollt ich wissen was ich schreiben muss wenn ich einen buchstabe als keyereignis nehmen will zB if key= buchstabe a ... oder so danke... :roll:
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Mo 22.08.05 14:50 
such ma bei google nach virtuellen tastencodes... da findest du die codes für so ziemlich alles... ansonsten gibt es noch ne andere möglichkeit die tasten abzufragen je nachdem wofür du es brauchst... denn mit den vk_ befehlen hat man nen kleinen lag wenn man die tatse hält (is bei spielen echt störend)... schreib wozu du es brauchst dann kann ich dir ne andere variante posten falls benötigt... und guck ma in deinen anderen post zu delphi x... aso und delphi x hat auch noch was um tasten abzufangen aber da hab ich keine ahnung von muss jemand anders posten....

edit: www.dsdt.info/grundlagen/codes/vks.php (die tastencodes; funzen aber net alle)
zero_cool1986 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 95

MS DOS ;)
D6
BeitragVerfasst: Mo 22.08.05 14:52 
ja also ich benutz kein delphix der code ist
ausblenden Quelltext
1:
2:
3:
4:
5:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word;
  Shift: TShiftState);
begin
if key=vk_down then begin buttonrunter.click;
end;
Amateur
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 777

(Win98, WinMe) WinXP Prof
D3 Prof, D6 Pers, D2k5 Pers., Turbo C++ Explorer
BeitragVerfasst: Mo 22.08.05 15:00 
theoretisch müsste es mit vk_down funzen ansonsten hier noch ne lösung wie das ganze schneller geht bzw. ohne lag:

es gibt noch eine andere möglichkeit, du deklarierst eine (globale) variable zb:
ausblenden Delphi-Quelltext
1:
Keys: array[0..255] of Boolean;					

und in den Ereignisprozeduren von KeyUp und KeyDown fügst du folgendes ein:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
procedure TForm1.FormKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  Keys[Key]:=True;
end;

procedure TForm1.FormKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
begin
  Keys[Key]:=False;
end;


dann kannst du bequem in deiner Gameloop die Tasten abfragen. zb:

ausblenden Delphi-Quelltext
1:
if Keys[VK_RIGHT] then x := x + 1 * movecount;					


so hab ichs bei meinem letzten game gemacht... aber vk_down und vk_up sollten gehn...
ansonsten weiß ich net was du fürn prob hast...

Moderiert von user profile iconChristian S.: Delphi-Tags hinzugefügt.