Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

AppGameKit Classic Chat / RTS controlls

Author
Message
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th Jan 2013 17:03
Hi guys, I have started to work on a 3D RTS using AGK. But there are two things im missing as far as controlls go, both regarding camera controll.

The first thing is the scroll wheel. Most RTS games use it for zooming up and down, and thats what i want to. But I can't find a command that "reads the scrollwheel". Is there such a command?

The other thing im trying to do is lock the mouse to the game. I want the camera to rotate when the mouse is on the left or right of the screen (which I have working). But the problem is that im using 2 screens and if I move the mouse off the main screen, the game dosn't recognise the mouse as being at the edge of the screen. So I tried doing this
Quote: "if (agk::GetRawMouseX() > 99){
agk::SetRawMousePosition(99, agk::GetRawMouseY());
}"


This does work, but if I move the mouse to quickly, so that it gets outside the screen the app looses focus and stops rotating because the mouse is less that 99. Is there a way to lock the mouse to the screen when the mouse is outside the screen but the app is still active. (No other window is selected)

Im using Tier 2 1085 beta.
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 26th Jan 2013 20:28
I don't think there is a way to read the mouse wheel in agk as yet. I am unsure what your second problem is exactly. Do you mean if you mouse moves outside the actual window or a window within your screen?
I started an rts style game in DB and to get the screen to scroll I used a zone at the edge of the screen rather than checking if the mouse was off screen. If your mouse was between say 40 pixels from the left,right, top or bottom edge it would scroll along. Perhaps you would be better off doing it that way.

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th Jan 2013 20:52
Quote: "I don't think there is a way to read the mouse wheel in agk as yet"

That's pretty anoying, hopefully it will be added. Perhaps I can use someting else than AppGameKit for that since im using T2.

As for my other problem. Right now, I check if the mouse is in the outer 3 procent of the screen, if it is, I turn the camera. But the problem is that when I move the mouse outside the AppGameKit window (to the second screen since im using fullscreen) agk stops updating the GetRawMouseX. So if I have the pointer inside the screen, and move it out of it within a frame, the pointer acording to AppGameKit, is still where it was last.
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 26th Jan 2013 22:18
Quote: "As for my other problem. Right now, I check if the mouse is in the outer 3 procent of the screen, if it is, I turn the camera. But the problem is that when I move the mouse outside the AppGameKit window (to the second screen since im using fullscreen) agk stops updating the GetRawMouseX. So if I have the pointer inside the screen, and move it out of it within a frame, the pointer acording to AppGameKit, is still where it was last"

What? Perhaps a screen shot would help. Without seeing your interface it is hard to see what could be causing the issue

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th Jan 2013 22:31
Sadly, I don't think a screenshot would help explain this problem. So i'll try again

Basicaly I think the problem is that AppGameKit stops updating the pointer position when it is outside the AppGameKit window. When it is moved out of the window, AppGameKit will think the pointer is still in the position that it was in the last frame. So if the pointer is at 90, 90, and I move it out of the window within a frame. Now AppGameKit will notice that the pointer is not in the frame and keep it at 90, 90.

What I want to do is to tell AppGameKit that if the pointer gets moved outside the screen, it should move it to the edge of the screen again.
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 26th Jan 2013 22:42
As there is no way to detect the mouse when off screen you will have to have a border as I suggested.

if getmousex()>79 and getmousex<99
setmouseposition(99,getmousey()
endif

Of course this will lock your mouse at 99 as soon as it gets within the border, but should help the edge problem I think, as it checks the actual edge of the screen rather than outside of it.

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th Jan 2013 22:46
That could work as a solution... Or I will just ignore it and let the users with more than one screen use Q and E to look around like Total war
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 27th Jan 2013 00:13
Oh you mean you are moving into a second screen as in dual monitor? I don't think many users will encounter that problem, lol. I would have thought if you moved the mouse off screen the last thing you would want it to do is lock it in rotate mode, better to stop input altogether.

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 27th Jan 2013 10:20 Edited at: 27th Jan 2013 10:20
Well, most of my friends use 2 screens . What I want to do is to lock the mouse to the main screen but im guessing that's not possible
Ancient Lady
Valued Member
21
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 27th Jan 2013 17:25
Locking a mouse to one app in Windows is not a good idea. And I suspect Microsoft would bounce any program submitted that does that.

If something is working in full screen and there aren't multiple monitors, than you have no problem.

Your issue only occurs in multi-monitor situations (all four of my computers are dual-monitor).

And, personally, I would be very annoyed if I was unable to move between apps because one had full control over the mouse.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 27th Jan 2013 18:04
I agree that that is anoying, but in most RTS games, you controll the camera by moving the mouse to the edge of the screen, which breaks when you can move off the screen. The totalwar seires has the same issue and it's realy anoying. Also, all games where the mosue controlls the camera lock the mouse to some part of the screen
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 27th Jan 2013 19:18
If you used an edge strip - as suggested - most intelligent players with dual monitors would bring the mouse back that point if they had gone off to check the email or answer a Skype call.

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 27th Jan 2013 19:56
That is one solution, but the thing is that when I play RTS games, im used to just draging the mouse all the way to the edge of the screen, but if I do that when using 2 monitors, the mouse goes outside the screen.
JimHawkins
15
Years of Service
User Offline
Joined: 26th Jul 2009
Location: Hull - UK
Posted: 27th Jan 2013 23:43
Usually the arrow keys will rotate the camera. So what's the problem? If it's that big an issue, shut down, unplug the monitor, and restart.

If you are actually getting X/Y points when the pointer is off the screen, I'd simply scroll that way at a sensible constant rate until either the program lost focus(in which case you probably wouldn't get the X/Y change anyway) or you reached got dizzy!

-- Jim DO IT FASTER, EASIER AND BETTER WITH AppGameKit FOR PASCAL
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 28th Jan 2013 08:09
Well, its not a big problem, but it is anoying, especially if the app was run in windowded mode. An the program keeps running even when the mouse is outside the screen
baxslash
Valued Member
Bronze Codemaster
18
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 28th Jan 2013 09:26
Another possible solution might be to only scroll the screen when the right mouse button is pressed? A cursor could be displayed where the right mouse button was first pressed with an arrow pointing in the current direction (where the mouse is currently). That way it will be intuitive to release the mouse button to perform another action on either the same screen or a different one. Mouse scrolling is something I miss a lot from DBPro. I find it usefull in editors and Windows based games alike. There is a freeze on new commands in AppGameKit at the moment though so don't hold your breath until v109 at least


this.mess = abs(sin(times#))
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 28th Jan 2013 17:32
Quote: "Well, its not a big problem, but it is anoying, especially if the app was run in windowded mode. An the program keeps running even when the mouse is outside the screen"


Well I would have thought that a good thing lol. If the program ended when you moved the mouse off screen, that really would be annoying!
Even commercial games do not do this. If you move your mouse off to another screen the game will quite often lock into a move mode and scroll about. Even when task swapping for us with only one screen connected, it can happen. There is many a time playing Empire Earth or more recently game of dwarves when I task swap out for something, come back and find the game has scrolled to some random corner. Unfortunately the loss of focus on the app, will always have drawbacks. I don't see much way round it.
I actually used to have 2 monitors connected, but have since put the second back in the cupboard, as it caused me more problems than it was really worth.

The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 28th Jan 2013 18:04
Quote: "I actually used to have 2 monitors connected, but have since put the second back in the cupboard, as it caused me more problems than it was really worth."


How can you live without the extra space

I havn't realy though of it that way though. But what I realy want is the mouse to get locked to the screen while the window is active, then when the user alttabs and another window gets active, the game should stop listening to the mouse.
DVader
21
Years of Service
User Offline
Joined: 28th Jan 2004
Location:
Posted: 29th Jan 2013 17:46
Well, I have a 30" Dell Screen anyway, which cost me a small fortune 7 or 8 years back, so screen estate is ok anyway.
There is a command to check focus, however, it will not check if your mouse is off screen just if you have clicked off screen and thus change windows focus.

Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 26th Feb 2013 09:10
What's the command to check window focus?
I've looked all over is it not in tier 1?

I'd love to be able to pause my game when it loses focus rather than accidentally clicking a window that lays over it (it's a small windowed game).

And is there actually a SetMousePosition() command I can't find that either.

Probably both in t2...

Thanks!

Ancient Lady
Valued Member
21
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 18:11
As far as I know, there are no commands for checking for window focus. And there is no SetMousePosition command.

In Tier 2, you might be able to use some commands native to the Mac or Windows (the only environments where you might have other windows overlapping your app) to do what you want. But they are not part of the AppGameKit command set.

In iOS and Android, your app automatically pauses when sent to the background (with an exception of music sometimes on Android). But it is up to you to use the GetResumed() command at the top of your main loop to see if you have returned from being sent to the background. If it returns 1, then you need to do whatever is necessary to recover your state or pause your app.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
The Zoq2
15
Years of Service
User Offline
Joined: 4th Nov 2009
Location: Linköping, Sweden
Posted: 26th Feb 2013 22:33
You can position the pointer by using SetPointerPosition I think
Ancient Lady
Valued Member
21
Years of Service
User Offline
Joined: 17th Mar 2004
Location: Anchorage, Alaska, USA
Posted: 26th Feb 2013 22:57
Quote: "You can position the pointer by using SetPointerPosition I think "

There is no such AppGameKit command that I can find in v1076 or v1088.

Cheers,
Ancient Lady
AGK Community Tester and AppGameKit Master
Digital Awakening
AGK Developer
22
Years of Service
User Offline
Joined: 27th Aug 2002
Location: Sweden
Posted: 26th Feb 2013 22:59
1076 T1 has no command to set the position of the mouse pointer as far I can tell. I have tried both commands mentioned here.

If there is a feature that some want and some don't want, you should make a setting for it so that the user can choose.


Demo 3 is out now!
Naphier
14
Years of Service
User Offline
Joined: 2nd Oct 2010
Location: St Petersburg, Florida
Posted: 27th Feb 2013 07:37
I'll toss in a feature request for this if there isn't already something. In DBPro we could do similar and I'd like to ditch DBPro for windows development.

Login to post a reply

Server time is: 2025-05-22 00:51:38
Your offset time is: 2025-05-22 00:51:38