|
Yet again....a problem Displaying 1-5 of 5 total.
1
TCL
|
Ok, i posted a question, but really, it wasn't important in the slightest......
This is, Well 2 me.....
How do i get the mouse to work.....
At all, i tryed bliting images, no success...
I can't into them, thier already there, but no matter what i try....which, is alot considering, how little i can think of....blalbbkabfkd.....your not reading anymore?.....Ok, maybe you are....I need help please....Small, big, don't matter....never mattered to me, it's how you use it......Code i'm talking about......
So the Basic Question....
Show Me how to inrtoduce a mouse image. just that, cause i been told b4 and i've read b4......i still read, but it not working........
Mouse Cursor Image.........Please!
Posted on 2006-06-07 12:48:47 (last edited on 2006-06-07 13:01:54)
|
mcgrue
|
void autoexec()
{
int imMouseCursor = LoadImage( "mouse-cursor.pcx" );
/// this loop runs forever.
while(1)
{
/// draw a black background at the top of the render-loop
/// we do this by drawing a filled rectangle from the topleft corner
/// of the screen to the bottom right.
RectFill(
0,0, //topleft corner
320,240, //bottom-right corner
RGB(0,0,0), //the color to draw (black is 0,0,0)
screen //the image to draw to. In this case, the screen
//('screen' is a system variable)
);
/// TBlit stands for "Transparent Blit"
/// "Blit" means "draw an image onto another image".
TBlit(
mouse.x,mouse.y, /// the coordinates to draw onto the destination
/// image at. In this case, the system variables
/// 'mouse.x' and 'mouse.y'. These always contain
/// integers saying where on the verge-screen the
/// system's mouse is.
imMouseCursor, /// the image reference to draw
screen /// the image reference you're drawing onto.
/// again 'screen' is a special verge-system image.
);
/// now we show it. after this, we go back to the top of the loop and do everything
/// over and over again into infinity... or at least until you close the program.
ShowPage();
}
}
Posted on 2006-06-07 14:26:48
|
mcgrue
|
Aaand here's a zip of the whole thing running:
http://www.verge-rpg.com/files/detail.php?id=678
Posted on 2006-06-07 14:31:23
|
TCL
|
Ok, thats lovely.....now i not sure what happened, because now, my game is functioning normally, except.....what was it, yeah.....my map and characters aren't there...
i want the mouse to be over my map......but i still wanna see the map....please help
Posted on 2006-06-21 13:25:08
|
Gayo
|
Well, yes. That code is just an example -- you can't plug it in directly. The key here is you want to use the same general premise of drawing the cursor overtop the part of the screen where you want it to appear. So just copy that part (not the rectfill, either). Of course, if you just blit it once it'll be destroyed when the screen rerenders, which will be immediately, so the trick is to HookRentrace the function that draws the cursor (and any other UI stuff you might want). Then it'll call that function at the point where the R appears in your map's renderstring.
In summary:
First off, make sure all your maps have an R in the renderstring, and that the R is the top thing rendered. In maped3 you do this by highlighting the "special: retrace" layer and moving it to the bottom using the layer up/down buttons (in maped3, the bottom is the top. This was the crux of a long, tedious argument).
If you don't already have anything HookRetraced, you'll need to HookRetrace some sort of master UI-drawing function. You'd need to do this eventually anyway. I recommend that you have one function that calls all the other draw-over functions situationally (for example, it'd check if menus were open and if so call DrawMenu, etc). Then you put some DrawMouseCursor call in there, and tie it to a DrawMouseCursor function that calls the TBlit from Grue's code. Just the TBlit here -- that Rectfill was a way to clear the screen without calling Render, so you won't need that. Likewise, if you're just letting the game run without any special renderloops of your own, you don't need ShowPage.
Now, sometime when the game first loads, HookRetrace your master draw-over function. If you ever need to turn this off, just call HookRetrace again with an empty string. However, if you have a master draw function handling everything you're probably better off having a draw_mouse_cursor variable and setting that to FALSE, then having the master draw function only draw it when the var is true.
By the way, this sort of thing is better suited to the VERGE Help forums
Posted on 2006-06-22 02:29:27
|
Displaying 1-5 of 5 total.
1
|
|