Autor Beitrag
DarkHunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: So 08.08.04 13:23 
Hallo
ich brauche für ein Spiel eine function/procedure mit der ich die position des mauszeigers abfragen kann und die x und y koordinaten in 2 variablen abspeichern kann.
heinze
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 112

XP
D4 Prof
BeitragVerfasst: So 08.08.04 13:32 
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: So 08.08.04 13:36 
das hilft mir nicht alzu viel weiter......
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 08.08.04 13:54 
Sollte es aber, denn entweder hast du deine Frage falsch gestellt, oder du hast den Link nicht besucht :wink:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
function GetCursorX:integer;
var P:TPoint;
begin
 GetCursorPos(P);
 Result:=P.X;
end;

function GetCursorY:integer;
var P:TPoint;
begin
 GetCursorPos(P);
 Result:=P.Y;
end;

// Nicht getestet

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
heinze
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 112

XP
D4 Prof
BeitragVerfasst: So 08.08.04 15:38 
?
Sorry aber was ist daran unverständlich bzw was brauchst du genau? :?:
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: So 08.08.04 16:45 
also
ich brauche eine funktion mit der ich die mauszeiger position in einer variable abspeichern kann.
ich habe mich zu anfang etwas unklar ausgedrückt sorry.

ich hab selbst was gefunden:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
.....
type
  TForm1 = class(TForm)
.....
  Procedure wherecursor;
.....
var
  Form1: TForm1;
  curposx, curpoxy: Integer;
.....
procedure TForm1.wherecursor;
begin
curposx := mouse.CursorPos.X;
curposy := mouse.CursorPos.Y;
end;
....


"...." sind teile die für das hier nciht relevant sind...
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 08.08.04 16:48 
Das ist genau das selbe, wie die obrige Variante, oder :?:

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.
DarkHunter Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 477

Win XP
D3 Prof, D2005 PE
BeitragVerfasst: So 08.08.04 17:44 
maxk hat folgendes geschrieben:
Das ist genau das selbe, wie die obrige Variante, oder :?:


jein.... wenn ich das richtig aus den link gelesen habe ist das ein delphi 3 variante

das von mir ist aus delphi 6

nur tritt bei meiner ein problem auf:
es kommt der fehler
Undefinierter Bezeichner : Curposx;
maxk
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1696
Erhaltene Danke: 1

Win XP, Debian Lenny
Delphi 6 Personal
BeitragVerfasst: So 08.08.04 17:59 
Deine Implementierung ruft letztendlich auch die oben genannte API Funktion auf (nur eben zweimal). Der von dir oben gepostete Code ist aber richtig. Wenn du also den Fehler bekommst, dass eine Variable nicht vorhanden ist, dann hast du sie wohl oben vergessen.

_________________
Ein Computer wird das tun, was Du programmierst - nicht das, was Du willst.