As far as I see SDL_WindowEvent is only present in SDL 1.3 but not in SDL 1.2 wich ships with FPC Lazarus.
As far as I see SDL_WindowEvent is only present in SDL 1.3 but not in SDL 1.2 wich ships with FPC Lazarus.
I ran across the same issue recently. You might want to read this C++ tutorial from LazyFoo: http://lazyfoo.net/SDL_tutorials/lesson26/index.php
The interesting part about this is detecting SDL_APPMOUSEMOCUS through event.active.state where event is TSDL_Event in your event loop.
There is a small bug with that though, if your mouse cursor is over the application when the application starts, the event is not recognized, but if you move the mouse away from the window and then back into the window, it works again.
Freeze Development | Elysion Game Framework | Twitter: @Stoney_FD
Check out my new book: Irrlicht 1.7.1 Realtime 3D Engine Beginner's Guide (It's C++ flavored though)
Programmer: A device for converting coffein into software.
@SilverWarior: Thanks for the info, I am not going to use SDL 1.3 at this time so I will think of an other way
@Stoney: Ok, I will take a look at that site...thanks for the info
EDIT: hmm...I think I might have just thought of a way around my issue, but I need to test it first
I am going to test the mouse position each frame and if it is within a small border around the screen, then I will not render the cursor.
If that doesn't work, I will try the SDL_APPMOUSEMOCUS way and see how that goes..
cheers,
Paul
Last edited by paul_nicholls; 01-01-2012 at 02:11 AM. Reason: type
Games:
Seafox
Pages:
Syntax Error Software
itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
Games:
Seafox
Pages:
Syntax Error Software
itch.io page
Online Chess
http://gameknot.com/#paul_nicholls
If you are testing the mouse position every frame you could simply check whether it's position is over your window instead just for smal border.
Another idea: When creating your SDL window do you have an option to set default cursor type for it. In windows each window can have it's default cursor type set. This causes mouse cursor to automaticly change as soon as the mouse cursor moves over that window. If you can then you can just set your SDL window's default curspor type to crNone and then programaticly check what is the current cursor type each frame. So when mouse cursor type is set to crNone you know that the mouse cursor is over your window and you need to render your ingame cursor, if mouse cursor is set to anything else then it probably isn't over your window so no ingame cursor renderning is requred.
Bookmarks