![]() |
|
Virtual Screen Problems |
Andy S.
Member #2,997
December 2002
![]() |
I have a game that uses virtual screen stuff. Everything works fine with the virtual screen, drawing, blitting, but the mouse can NOT go on it! Any and all help is apperciated. Below is my code.
there is a begin sub, but it has no virtual screen use in it, therefore, no problems. ------------------------------------------------------ |
Ultio
Member #1,336
April 2001
|
So, are you saying that you don't want the mouse to go into the area of the virtual screen? I can't really tell what you're asking. I took a quick look at your code. If I'm reading your problem correctly, you don't want the mouse to scroll off the visible bounds of the screen. Well, it's quite simple. You already know the coordinates of the mouse, and the size of your (visible) screen. Just store the width and height of the screen and check if the mouse coordinates go over. If it does, just reset the values to those stored width and height of your screen. IE: If the mouse scrolls right and goes out of bounds of the screen, just do a test, like so: Did that make sense? I hope this answers the question you were asking. --- |
Andy S.
Member #2,997
December 2002
![]() |
nono, the oppisite. I want it to go on the virtual screen and it wont! ------------------------------------------------------ |
Ultio
Member #1,336
April 2001
|
Aha. Then, I have no idea how to help you. Have you tried tracking the coordinates to the screen? Does it just stop at the edge? Hm. What do you need it to go into the virtual zone for, anyways? I mean, you can't see it... :/ --- |
Andy S.
Member #2,997
December 2002
![]() |
you can see it. I have scroll screen so that you can see the virtual screen. And yes, it stoppes at the edge. I dont understand what the rest of your message says, Sorry. ------------------------------------------------------ |
Ultio
Member #1,336
April 2001
|
Hm. So, it scrolls the screen into the virtual zone, and then the mouse stops at the non-virtual bounds? --- |
Andy S.
Member #2,997
December 2002
![]() |
yes ------------------------------------------------------ |
Ultio
Member #1,336
April 2001
|
I found it. It's in the docs. void set_mouse_range(int x1, int y1, int x2, int y2); Sets the area of the screen within which the mouse can move. Pass the top left corner and the bottom right corner (inclusive). If you dont call this function the range defaults to (0, 0, SCREEN_W-1, SCREEN_H-1). Hope that does the trick --- |
Andy S.
Member #2,997
December 2002
![]() |
EXCELLENT! THANK YOU THANK YOU THANK YOU! But now, on to the next problem! When the screen has scrolled right, it can not scroll down. And when it has scrolled down, it can scroll right, but when it does, the viewable screen will go back to the origional screen. Does that make sense? If you wait about 2 mins after posting this I should be able to upload a newer example here. Thanks In Advance! ------------------------------------------------------ |
Ultio
Member #1,336
April 2001
|
You should be doing it like this: --- |
Synapse Jumps
Member #3,073
December 2002
|
I too am having a problem that relates to this. I have a game much like Will, here. But, I clip the rest of the area that isn't visable. Here's my code for scrolling, but when you scoll right some of the visable area get's cut off. Also, when it does scroll, it looks TOO fluid, does that make sense??? When you scroll the only thing that looks like it's moving is the mouse. Here is my code:
P.S. How do you make it into a box like Will's? Edit: [url http://www.allegro.cc/mockup.html] |
|