PDA

View Full Version : Hide Windows Cursor



cairnswm
21-10-2007, 09:43 AM
How can you hide the windows cursor on the screen? I use an image as the cursor and want to ensure that the windows cursor doesn't flikker all the time.

Traveler
21-10-2007, 09:53 AM
Do you mean the mouse or the little bar inside edit fields?

For the mouse you can use ShowCursor(false), but I'm guessing you already knew that.

cairnswm
21-10-2007, 10:07 AM
Cant find ShowCursor :(

Did find Input.Mouse.Hide; but this hides for all Windows windows not just the Phoenix Game Window.

JernejL
21-10-2007, 12:27 PM
use a custom blank cursor.

cairnswm
21-10-2007, 01:11 PM
use a custom blank cursor.

How do you set a custom blank cursor in glfw or phoenix?

Traveler
21-10-2007, 11:08 PM
Cant find ShowCursor :(

Add 'windows' to the uses section and it'll work.

But now that the mouse subject has come up, I also noticed that in fullscreen it is possible to move the mouse beyond the window borders. :scratch:
ie, if you move your cursus too far and you dont notice it, it may become lost.
Also, in fullscreen mode it appears that the default windows cursor is not active. You can activate it using the ShowCursor function but that will leave a stationary cursor in the center of the screen.

I wonder if its possible to turn the normal windows cursor on :)

cairnswm
22-10-2007, 04:34 AM
[quote="cairnswm"]Cant find ShowCursor :(

Add 'windows' to the uses section and it'll work.
[quote]

Thanks

Feels wrong though.... Dont think I should need then Windows unit for a Phoenix game.

czar
22-10-2007, 07:08 AM
OnSHow
screen.cursor := crnone;

OnClose
screen.cursor := crdefault;

cairnswm
22-10-2007, 08:44 AM
OnSHow
screen.cursor := crnone;

OnClose
screen.cursor := crdefault;

Sorry, this is for Phoenix 2D game Engine not for normal forms. I should have made that clearer instead of presuming the fact that its in the Phoenix forum would indicate it.

Sorry

WILL
22-10-2007, 09:25 AM
I can help but read this a scratch my head. Phoenix 2D uses SDL for rendering, right?

Are you now seeing inside of the sdl.pas unit?

SDL_ShowCursor(False);

will hide the cursor. Of course it might help if you had sdl in your uses clause. ;)

cairnswm
22-10-2007, 10:18 AM
I can help but read this a scratch my head. Phoenix 2D uses SDL for rendering, right?


No, OpenGL for Rendering and GLFW for window handling.

czar
22-10-2007, 06:32 PM
I have never used phoenix, I thought phoenix works under delphi and windows, so no reason to assume screen.cursor wouldn't work. That is teh system I use for my directx projects.

WILL
23-10-2007, 05:27 AM
Ok, I see. :) Well it wouldn't be using SDL for rendering anyways as the SDL/OpenGL combination would still have GL as the renderer, but SDL for windows management.

Am I not mistaken in thinking that at some point Phoenix did use SDL for windows management? I could have sworn... :scratch:

Andreaz
25-10-2007, 07:22 PM
Sorry for not answering this earlier, been at a buissnes trip for a week, you can hide the cursor with:



uses glfw;

glfwDisable( GLFW_MOUSE_CURSOR );

cairnswm
26-10-2007, 05:26 AM
Hi Andreaz

That turns off the cursor for all windows, not just the Phoneix window. If in windowed mode I go outsie of the window border I expect to see the windows cursor. Is there a way to just turn ff the curson for the phoneix window and not all windows.

Cheers

Andreaz
26-10-2007, 05:50 AM
GLFW sadly doesnt support that out of the box,

https://sourceforge.net/forum/message.php?msg_id=4287659

thats one of the drawbacks with platform independent librarys they only implement stuff that works on all platforms...

You have to do what TScreen does basically:



procedure TScreen.SetCursor(Value: TCursor);
var
P: TPoint;
Handle: HWND;
Code: Longint;
begin
if Value <> Cursor then
begin
FCursor &#58;= Value;
if Value = crDefault then
begin
&#123; Reset the cursor to the default by sending a WM_SETCURSOR to the
window under the cursor &#125;
GetCursorPos&#40;P&#41;;
Handle &#58;= WindowFromPoint&#40;P&#41;;
if &#40;Handle <> 0&#41; and
&#40;GetWindowThreadProcessId&#40;Handle, nil&#41; = GetCurrentThreadId&#41; then
begin
Code &#58;= SendMessage&#40;Handle, WM_NCHITTEST, 0, LongInt&#40;PointToSmallPoint&#40;P&#41;&#41;&#41;;
SendMessage&#40;Handle, WM_SETCURSOR, Handle, MakeLong&#40;Code, WM_MOUSEMOVE&#41;&#41;;
Exit;
end;
end;
Windows.SetCursor&#40;Cursors&#91;Value&#93;&#41;;
end;
Inc&#40;FCursorCount&#41;;
end;