|
Post by Ranger1800 on Jun 12, 2004 11:29:32 GMT -5
I'm currently trying to make an RTS game as we speak and just put in the mouse control, and i ran the program the first time and it worked, and then the second time Basic4gl caught the error, and heres the code i'm using:
dim x#, y#, char$ dim x1#, y1#, x2#, y2# dim lmb_down_once
ResizeText (80, 50) dim x, y, char$
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 wend
while true if not Mouse_Button (Mouse_LButton) then locate x, y: print char$ endif x = Mouse_X () * TextCols () y = Mouse_Y () * TextRows () char$ = CharAt$ (x, y) locate x, y: print "X" wend if lmb_down_once then x2# = x#: y2# = y# glBegin (Gl_Lines) glVertex2f (x2#, y1#) glVertex2f (x2#, y2#) glEnd () glBegin (Gl_Lines) glVertex2f (x2#, y1#) glVertex2f (x2#, y2#) glEnd () glBegin (Gl_Lines) glVertex2f (x2#, y1#) glVertex2f (x2#, 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 ()
|
|
|
Post by NovaGene on Jun 15, 2004 16:38:54 GMT -5
I noticed from the code you have DIMmed char$ twice. DIM once should suffice.
dim x#, y#, char$ dim x, y, char$
Cheers! - Lucas Tan -
|
|
|
Post by Ranger1800 on Jun 15, 2004 21:27:17 GMT -5
Duh, that was stupid on my part lol
|
|