Autor Beitrag
Ironwulf
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: Mi 16.11.05 17:35 
Hallo :wink2:

kann mir jemand sagen wie ich es schaffe das man im DXInput die tasten erst zur Luafzeit definieren kann?
also als bespiel
Button1:= a
oder so
Da_Knuddelbaer
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 485



BeitragVerfasst: So 20.11.05 11:29 
Hi!

Ja, kann ich dir sagen... und es ist eine echte Flickelei, total nervig.

DXInput hat seine eigenen Tastencodes für die ganzen speziellen Tasten. So ist zum Beispiel das - auf dem Numpad nicht mehr die Zahl 109, sondern die 34. Oder das + auf Numpad ist nicht mehr dir 107, sondern die 33. Am besten lässt du dir da alles mal in einer Datei ausgeben.

Hier mal ein Beispielcode. SetKey wird beim Belegen der Tasten aufgerufen, und zwar jedes Mal mit Key als die Taste, die gedrückt wurde. Wenn du eine einfachere Lösung hast, dann gib sie mir bitte :)

ausblenden volle Höhe Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
procedure TForm1.SetKey(index: Byte; Key: Char);
Begin
  Key:=UpCase(Key);
  If (Ord(Key)>47) and
     (Ord(Key)<58) Then
  Case Ord(key) of
    48: Key := Chr(96); { Num 0 }
    49: Key := Chr(97);
    50: Key := Chr(98);
    51: Key := Chr(99);
    52: Key := Chr(100);
    53: Key := Chr(101);
    54: Key := Chr(102);
    55: Key := Chr(103);
    56: Key := Chr(104);
    57: Key := Chr(105); { Num 9 }
  end;
  If Ord(Key)=33 Then Key:=Chr(081); { Bild Down }
  If Ord(Key)=34 Then Key:=Chr(073); { Bild Up }
  If Ord(Key)=107 Then Key:=Chr(33); { Num + }
  If Ord(Key)=109 Then Key:=Chr(34); { Num - }
  If Ord(Key)=106 Then Key:=Chr(35); { Num * }
  If Ord(Key)=111 Then Key:=Chr(36); { Num / }
  If Ord(Key)=110 Then Key:=Chr(083); { Num irgendwas (habs vergessen) }

  { Spieler }
  Case index of
    1: Form1.DXInput.Keyboard.KeyAssigns[isUp,0]:=Ord(Key);
    2: Form1.DXInput.Keyboard.KeyAssigns[isDown,0]:=Ord(Key);
    3: Form1.DXInput.Keyboard.KeyAssigns[isLeft,0]:=Ord(Key);
    4: Form1.DXInput.Keyboard.KeyAssigns[isRight,0]:=Ord(Key);
  end;
end;


Zur Syntax:

Form1.DXInput.Keyboard.KeyAssigns[isUp,0]:=Ord(Key);

Hier wird bei KeyAssigns zuerst angegeben, welchen Button du belegen willst. Die 0 dahinter sagt, dass du die erste Belegung dafür ändern willst. Du kannst nämlich pro DXInput und pro AktionsButton (wie isup) bis zu 3 Tasten zuweisen.

Greetz,
Knuddelbaer
Ironwulf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 20.11.05 14:58 
OMG :)
danke für die antwort ich werds die nächste tage mal probieren
Ironwulf Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 733
Erhaltene Danke: 2



BeitragVerfasst: So 27.11.05 18:45 
Jop danke funktioniert :beer: