Autor Beitrag
DK99
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Win Vista (64 Bit) + W7 Up
(Delphi 7,) Java 6 (Eclipse+ BlueJ), OpenGL2.0
BeitragVerfasst: Mo 24.11.08 17:57 
Hey
Ich bastel grad an nem 3D Projekt unter OpenGL und möchte mich da mitholfe der Maus bewegen können.
Dafür muss ich bei jedem OnIdle Aufruf testen ob die Maus bewegt wurde, einen Wert erhöhen und anschließend die Mausposition wieder auf ihren Ausgangspunkt setzten.
D.h. also dass die Maus immer in der Mitte meines Fensters sein soll.
Würde mich freuen wenn ihr mir da helfen könntet :)
LG

_________________
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of
the week debugging Monday's code."-- Dan Salomon
GericasS
ontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic starofftopic star
Beiträge: 540

Windows Vista Home Premium
D2010, VisualStudio2008
BeitragVerfasst: Mo 24.11.08 18:06 
Die Mausposition kannst du doch über OnMouseMove durch den x und y Wert erfahren :)

_________________
Alexander N.
Neue Bewaffnung Amilo xi2428 T9300
DK99 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Win Vista (64 Bit) + W7 Up
(Delphi 7,) Java 6 (Eclipse+ BlueJ), OpenGL2.0
BeitragVerfasst: Mo 24.11.08 18:46 
Kann man da die Mausposition denn auch verändern ?
Das geht doch nicht oder?

Und irgentwie lief das mit dem OnMouseMove auch noch nicht bei mir.
Muss ich dass dann noch in der OnIdle Prozedur aufrufen oder ruft OnMouseMove sich selber auf?

_________________
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of
the week debugging Monday's code."-- Dan Salomon
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 24.11.08 18:51 
OnMouseMove ist ein Ereignis, zum Beispiel des Formulars, das aufgerufen wird, wenn es eintritt, die Maus also bewegt wurde. Ob das auch mit OpenGL so funktioniert weiß ich nicht, aber ich gehe einfach mal davon aus, dass user profile iconGericasS weiß, dass das geht.

Um die Mausposition zu setzen / herauszufinden kannst du GetCursorPos und SetCursorPos verwenden:
www.delphipraxis.net/post169143.html
Ich vermute das geht auch mit OpenGL.
bummi
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 1248
Erhaltene Danke: 187

XP - Server 2008R2
D2 - Delphi XE
BeitragVerfasst: Mo 24.11.08 18:55 
Screenweit:

x:=mouse.CursorPos.X;
....
SetCursorPos(x,y);

was geht nicht bei OnMouseMove
DK99 Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 46

Win Vista (64 Bit) + W7 Up
(Delphi 7,) Java 6 (Eclipse+ BlueJ), OpenGL2.0
BeitragVerfasst: Mo 24.11.08 20:42 
Ahh das mit dem Set und get cursorpos klappt :)
dankeschön.
Wobei die Maus bei starken Bewegungen trotz zurücksetzen noch wackelt...(wahrscheinlich weil OnIdle zu selten aufgerufen wird)
Gibt es da irgentwas, wodurch man wirklich gar keine Mausbewegung mehr sehen kann?

_________________
"Sometimes it pays to stay in bed on Monday, rather than spending the rest of
the week debugging Monday's code."-- Dan Salomon
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 24.11.08 21:42 
Benutze doch einen Cursor innerhalb deines Programms, den man praktisch nicht sieht. Für mich hört sich das so an als wäre das für dich das sinnvollste.
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Mo 24.11.08 22:39 
Wähle als Cursor crNone und blende mit OpenGL ein Zielkreuz oder etwas ähnliches ein (falls das überhaupt erwünscht ist). So machen das die meisten Spiele.
Bergmann89
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 1742
Erhaltene Danke: 72

Win7 x64, Ubuntu 11.10
Delphi 7 Personal, Lazarus/FPC 2.2.4, C, C++, C# (Visual Studio 2010), PHP, Java (Netbeans, Eclipse)
BeitragVerfasst: Di 25.11.08 00:46 
HI,

gar keine Mausbewegung zu sehen wird schwer, es sei denn du schaltest sie auf deiner Form aus, wie Yogu schon gesagt hat.
Und das OnMouseMove-Ereigniss müsste auf deiner Form trotz OpenGL funzen?! Aber es ist sowieso besser bei OpenGL alles über das OnIdle-Ereigniss zu steuern, find ich.

MfG Bergmann.

_________________
Ich weiß nicht viel, lern aber dafür umso schneller^^
Yogu
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2598
Erhaltene Danke: 156

Ubuntu 13.04, Win 7
C# (VS 2013)
BeitragVerfasst: Di 25.11.08 10:24 
Wenn du versuchst, in OnMouseMove die Mausposition zu ändern (SetCursorPos, wird eine Exception ausgelöst. Das ist also nicht die richtige Lösung.