Autor Beitrag
Fluffy19
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mo 09.02.09 19:43 
Hallo zusammen,

Ich soll für Informatik eine Hausaufgabe machen:

Ein springender Ball, wie bei Brick von einem beweglichen object reflektiert wird.
Soweit so gut, die Reflexion an den Wänden habe ich hinbekommen, nun möchte ich, dass das Object zum "auffangen"
an die Bewwegung der Maus gekoppelt wird.
Da habe ich nun ein Problem...

Wie ist der Mauszeiger deffieniert bzw. : bei anderen sachen gibt es ja left und top werte..., beim Mauszeiger auch?

Wie könnte ich das am besten lösen?

Moderiert von user profile iconNarses: Bild als Anhang hochgeladen
Moderiert von user profile iconNarses: Topic aus Sonstiges (Delphi) verschoben am Mo 09.02.2009 um 18:47
Einloggen, um Attachments anzusehen!
ImbaPanda
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98

Windows XP/Vista
Delphi 7 Professional/ Rad Studio 2009
BeitragVerfasst: Mo 09.02.09 19:51 
Die Position des Mauszeigers lässt sich mittels
ausblenden Delphi-Quelltext
1:
2:
3:
Mouse.CursorPos.X
bzw.
Mouse.CursorPos.Y

bestimmen.

Bzgl. des "Auffangens", wie realisierst du den Ball? Bei einer Komponenten ließe sich das ganze über das OnMouseDown-Ereignis des Objekts lösen.
Fluffy19 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mo 09.02.09 19:57 
muss ich da noch etwas einbinden ö.ä?

bekomme da nämlich undeffinierter bezeicher mouse
ImbaPanda
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 98

Windows XP/Vista
Delphi 7 Professional/ Rad Studio 2009
BeitragVerfasst: Mo 09.02.09 20:12 
Nein, benötigst du nicht.
Mouse.CursorPos.X liefert dir einfach den x-Wert der aktuellen Mausposition als Integer.
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 09.02.09 20:18 
Das ist in der Unit Controls definiert, die ist aber normalerweise sowieso eingebunden, es sei denn es handelt sich um eine extra Unit.
Fluffy19 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mo 09.02.09 21:17 
kann es sein, dass das erst ab <Delphi 3 geht?

Hab selber Delphi 7, aber für die schule brauchen wir Delphi 3
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19315
Erhaltene Danke: 1747

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mo 09.02.09 21:28 
Delphi 3... Naja, dann bleibt dir nur der Weg über GetMousePos, das ist eine API Funktion und immer da:
msdn.microsoft.com/e...ibrary/ms648390.aspx
www.delphi-fundgrube.de/faq12.htm
Fluffy19 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 19



BeitragVerfasst: Mo 09.02.09 21:35 
danke, das funktioniert.