Oberon Community Platform Forum
October 23, 2019, 03:27:38 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News:
 
   Home   Help Search Login Register  
Pages: [1] 2
  Print  
Author Topic: A2 Cursor  (Read 16697 times)
soren renner
Global Moderator
Full Member
*****
Posts: 216



« on: October 23, 2010, 03:18:27 PM »

How do I set the cursor position? Something in WMWindowManager.Mod? I have in mind a graphics window that "captures" the cursor and only relinquishes it grudgingly.
Logged
staubesv
Administrator
Sr. Member
*****
Posts: 387



« Reply #1 on: October 25, 2010, 10:02:11 AM »

There's no way to directly set the cursor position. Are you really sure that you want an application that kind-of takes over the cursor? I'm not so sure whether users will appreciate a window that doesn't give up the cursor when the user wants to use another window...

If you want to experiment:
- WindowManager.WindowManager has a field pointerOwner to track which window is currently the owner of the pointer. This field is mainly modified in WindowManager.PointerEvent
- It is possible to install a message preview handler that will see any key/pointer/... messages of the window manager (see HotKeys.InstallHandler, HotKeys.Handle, for example). Using that handler, your window doesn't need to be the pointer owner, but be warned: If this handler crashes, the A2 windowing system stops working...
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #2 on: October 25, 2010, 03:55:36 PM »

Are you really sure that you want an application that kind-of takes over the cursor?

Yes. This is commonly done in game graphics. Minecraft does this, for example. It allows mouselook with movement on the WASD keys. Of course there must be a keyboard escape from the windows grasp of the cursor, and it is necessary that the handler not crash! I will look at HotKeys and see if I can figure out what you are suggesting.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #3 on: October 25, 2010, 09:37:43 PM »

I remembered:
I positioned the cursor when develop TouchScreen driver. In your case the option with the driver - real immoral, but it really is the easiest way.  Cheesy

Change the cursor position is simple. But the driver remembers the position and all cursor movement will lose effect.

Can try:
Code:
MODULE TestMouse;
IMPORT Inputs, WMMessages, KernelLog;

PROCEDURE Test*;
VAR
 m: Inputs.AbsMouseMsg;

BEGIN
m.x:=0; m.y:=0; m.keys:={};
Inputs.mouse.Handle( m );
END Test;

END TestMouse.Test~

I am often mistaken lately, but here everything is really like and situation.

And generally speaking: positioning the cursor - a bad style, do not iterate over it from bad designers.
« Last Edit: October 25, 2010, 09:39:20 PM by BohdanT » Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #4 on: October 25, 2010, 10:04:10 PM »

I agree that it is terrible style FOR A PROGRAM THAT IS INTENDED TO RUN ON THE A2 DESKTOP. For a program that will eventually run as an installer that looks like the Minecraft installer on top of Windows or Linux, it is no worse than lots of things on those systems.
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #5 on: October 25, 2010, 10:05:58 PM »

Also I have just looked at HotKeys for the first time and wow.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #6 on: October 25, 2010, 10:14:17 PM »

Can try:
Code:
...
Forgot to say: Press Ctrl+Enter on "TestMouse.Test~" -  to see the effect!

Quote
...like the Minecraft installer...
I do not know Minecraft, but frankly - I do not like when the program is positioning or restricts the movement of the mouse.
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #7 on: October 25, 2010, 10:18:38 PM »

The module works! ++thx!

http://minecraft.net/play.jsp   

I want to try this movement control style. I am sensitive to your qualms but I must go forward.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #8 on: October 25, 2010, 10:29:31 PM »

Aaaa ....
I understand what you want.

It's super easy

Do you want the controls are a mouse or keyboard, the same cursor!
This is not so!

1. You do not need to control the cursor in A2 DESKTOP!
2. You need to make an "internal cursor"
3. You only need to do two handlers: PointerMove and KeyEvent
4. You need to make two variables to store the coordinates and the procedure for drawing the "game cursor.

« Last Edit: October 25, 2010, 10:32:21 PM by BohdanT » Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #9 on: October 25, 2010, 10:35:36 PM »

That is true! Thank you!
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #10 on: October 25, 2010, 10:49:38 PM »

I do not want to say, but I think - HandleMouse in Win32.Display.Mod not entirely correct.

Try Native....
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #11 on: October 25, 2010, 11:09:53 PM »

Oh, I do use Native. And I NEVER use Windows. The only way that I run WinAos is with wine on Linux.
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #12 on: October 26, 2010, 03:57:21 PM »

No, it is not quite true after all, because the windowing system stops giving mouse events to the window if it determines that the mouse is not over the window.
Logged
BohdanT
Sr. Member
****
Posts: 271


Life is difficult, but fortunately is short!


WWW
« Reply #13 on: October 26, 2010, 06:15:19 PM »

You want to have your program respond to the cursor, even if it is outside the window?
Logged
soren renner
Global Moderator
Full Member
*****
Posts: 216



« Reply #14 on: October 26, 2010, 11:10:22 PM »

Well, to replicate the Minecraft cursor, yes, one would have to "capture" the pointer from the WM.
Logged
Pages: [1] 2
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.21 | SMF © 2015, Simple Machines Valid XHTML 1.0! Valid CSS!