|
Post by Ranger1800 on Jun 12, 2004 0:42:09 GMT -5
Hi, i'm currently in the process of making an RTS, and i need an idea of how i would make it so that when the players left click and hold the mouse it would draw a box, and how i would go about hiding or deleting the box after the mouse button is released. And i plan having this as a 2d game, cuz according to SuperMonkey mouse input would'nt be a problem for a 2d RTS.
|
|
|
Post by NovaGene on Jun 12, 2004 8:52:36 GMT -5
Try this:- dim x#, y#, char$ dim x1#,y1#,x2#,y2# dim lmb_down_once lmb_down_once=false while true glClear (GL_DEPTH_BUFFER_BIT or GL_COLOR_BUFFER_BIT) glLoadIdentity () gltranslatef (-5,5,-10) glpointsize(5) glpushmatrix() glbegin(GL_POINTS) glcolor3f(1,1,1): glvertex2f(x#,y#) glend() glpopmatrix() if not Mouse_Button (MOUSE_LBUTTON) then lmb_down_once=true x1#=x#: y1#=y# endif if lmb_down_once then x2#=x#: y2#=y# glbegin(GL_LINES) glvertex2f(x1#,y1#) glvertex2f(x2#,y1#) glend() glbegin(GL_LINES) glvertex2f(x2#,y1#) glvertex2f(x2#,y2#) glend() glbegin(GL_LINES) glvertex2f(x2#,y2#) glvertex2f(x1#,y2#) glend() glbegin(GL_LINES) glvertex2f(x1#,y1#) glvertex2f(x1#,y2#) glend() endif x# = Mouse_X () * (WindowWidth() /80.0) y# = -Mouse_Y () * (WindowHeight() /60.0) swapbuffers() wend This is the best I can get to make the cursor close to the mouse pointer. Maybe someone can lend a hand to improve on this... Try adjusting the z-value of "gltranslatef (-5,5,-10)" and the 80.0 & 60.0 ratios of:- x# = Mouse_X () * (WindowWidth() /80.0) y# = -Mouse_Y () * (WindowHeight() /60.0) Hope this helps! - Lucas Tan -
|
|
|
Post by Ranger1800 on Jun 12, 2004 10:56:10 GMT -5
Thanks alot man i'm sure it will, but i have one little problem with custom pointers i know how to load the custom pointers in, but when i do that and i run the program all i get is a blank white box what gives?
- Branden
|
|
|
Post by Ranger1800 on Jun 12, 2004 11:15:09 GMT -5
Wheres the Mouse pointer, i'm not seeing it
|
|
|
Post by NovaGene on Jun 13, 2004 8:52:43 GMT -5
|
|
|
Post by Tom Mulgrew on Jun 13, 2004 20:11:00 GMT -5
Traditionally fullscreen OpenGL applications draw their own cursor, because they can't rely on the operating system being able to draw a cursor in full screen hardware accellerated mode. (Consider the 3dfx Voodoo cards for example.)
So the cursor is simply hidden in fullscreen mode for consistency.
|
|
|
Post by Ranger1800 on Jun 13, 2004 20:48:09 GMT -5
So i just need to swirch out of full-screnn mode? But the thing is it was working the first time i ran the program, but after that it didn't work again what gives?
|
|