Can we please have error checking? You should be able to check the return code on commands like LoadSprite for example to gracefully handle if they fail rather than having your program die unexpectedly.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
FUNCTION FractionOnly : Number
Return (Number - INTEGER(Number))
FOR Z=0 TO (ModelSizeZ-2)
ZTexValue1=1/(128/(Z+1)) // Set the first Z offset into the texture image
ZTexValue2=1/(128/(Z+2)) // Set the second Z offset into the texture image
X_OBJNEWGROUP
FOR X=0 TO (MapSizeX-2) STEP 2
XTexValue1=1/(128/(X+1)) // Set the first X offset into the texture image
XTexValue2=1/(128/(X+2)) // Set the second X offset into the texture image
X_OBJADDVERTEX X, HeightsArray[X][Z+1], Z+1, 0,0, RGB(255,255,255) // Create quad. Bottom left corner
X_OBJADDVERTEX X, HeightsArray[X][Z], Z, 0,1, RGB(255,255,255) // Top left corner
X_OBJADDVERTEX X+1, HeightsArray[X+1][Z+1], Z+1, 1,0, RGB(255,255,255) // Bottom right corner
X_OBJADDVERTEX X+1, HeightsArray[X+1][Z], Z, 1,1, RGB(255,255,255) // Top right Corner
ENDIF
NEXT
NEXT
SHOWSCREEN
MOUSEWAIT
camera_roll(cam1,2)
// --------------------------------- //
// Project: 6DOFCam_lib
// Start: Thursday, November 19, 2009
// IDE Version: 7.177
//
main()
TYPE Tquaternion
w#
x#
y#
z#
ENDTYPE
TYPE Tcamera
//position
x#
y#
z#
//look vector
lx#
ly#
lz#
//up vector
ux#
uy#
uz#
//right vector
rx#
ry#
rz#
FOV#
aspect#
nearClip#
farClip#
ENDTYPE
FUNCTION quaternion_normalize AS Tquaternion: tmpQ AS Tquaternion
LOCAL mag# = SQR(tmpQ.w*tmpQ.w+tmpQ.x*tmpQ.x+tmpQ.y*tmpQ.y+tmpQ.z*tmpQ.z)
LOCAL q AS Tquaternion
q.w = tmpQ.w / mag
q.x = tmpQ.x / mag
q.y = tmpQ.y / mag
q.z = tmpQ.z / mag
RETURN q
ENDFUNCTION
FUNCTION quaternion_conj AS Tquaternion: tmpQ AS Tquaternion
LOCAL q AS Tquaternion
q.w = -tmpQ.w
q.x = -tmpQ.x
q.y = -tmpQ.y
q.z = -tmpQ.z
RETURN q
ENDFUNCTION
FUNCTION quaternion_mult AS Tquaternion: lhs AS Tquaternion, rhs AS Tquaternion
LOCAL q AS Tquaternion
q.w = lhs.w * rhs.w - lhs.x * rhs.x - lhs.y * rhs.y - lhs.z * rhs.z
q.x = lhs.w * rhs.x + lhs.x * rhs.w + lhs.y * rhs.z - lhs.z * rhs.y
q.y = lhs.w * rhs.y - lhs.x * rhs.z + lhs.y * rhs.w + lhs.z * rhs.x
q.z = lhs.w * rhs.z + lhs.x * rhs.y - lhs.y * rhs.x + lhs.z * rhs.w
RETURN q
ENDFUNCTION
FUNCTION camera_advance: cam AS Tcamera, d#
LOCAL xt#, yt#, zt#
xt = (cam.lx - cam.x) * d
yt = (cam.ly - cam.y) * d
zt = (cam.lz - cam.z) * d
cam.x = cam.x + xt
cam.y = cam.y + yt
cam.z = cam.z + zt
cam.ux =cam.ux + xt
cam.uy =cam.uy + yt
cam.uz =cam.uz + zt
cam.rx =cam.rx + xt
cam.ry =cam.ry + yt
cam.rz =cam.rz + zt
cam.lx =cam.lx + xt
cam.ly =cam.ly + yt
cam.lz =cam.lz + zt
ENDFUNCTION
FUNCTION camera_strafe: cam AS Tcamera, d#
LOCAL xt#, yt#, zt#
xt = (cam.rx - cam.x) * d
yt = (cam.ry - cam.y) * d
zt = (cam.rz - cam.z) * d
cam.x = cam.x + xt
cam.y = cam.y + yt
cam.z = cam.z + zt
cam.ux = cam.ux + xt
cam.uy = cam.uy + yt
cam.uz = cam.uz + zt
cam.rx = cam.rx + xt
cam.ry = cam.ry + yt
cam.rz = cam.rz + zt
cam.lx = cam.lx + xt
cam.ly = cam.ly + yt
cam.lz = cam.lz + zt
ENDFUNCTION
FUNCTION camera_rise: cam AS Tcamera, d#
LOCAL xt#, yt#, zt#
xt = (cam.ux - cam.x) * d
yt = (cam.uy - cam.y) * d
zt = (cam.uz - cam.z) * d
cam.x = cam.x + xt
cam.y = cam.y + yt
cam.z = cam.z + zt
cam.ux = cam.ux + xt
cam.uy = cam.uy + yt
cam.uz = cam.uz + zt
cam.rx = cam.rx + xt
cam.ry = cam.ry + yt
cam.rz = cam.rz + zt
cam.lx = cam.lx + xt
cam.ly = cam.ly + yt
cam.lz = cam.lz + zt
ENDFUNCTION
FUNCTION camera_roll: cam AS Tcamera, a#
LOCAL qUp AS Tquaternion
qUp.w = 0
qUp.x = cam.ux - cam.x
qUp.y = cam.uy - cam.y
qUp.z = cam.uz - cam.z
LOCAL qRight AS Tquaternion
qRight.w = 0
qRight.x = cam.rx - cam.x
qRight.y = cam.ry - cam.y
qRight.z = cam.rz - cam.z
LOCAL qRot AS Tquaternion
qRot.w = COS(a * rad/2)
qRot.x = (cam.lx - cam.x) * SIN(a * rad/2)
qRot.y = (cam.ly - cam.y) * SIN(a * rad/2)
qRot.z = (cam.lz - cam.z) * SIN(a * rad/2)
LOCAL W AS Tquaternion,W1 AS Tquaternion,W2 AS Tquaternion
W1 = quaternion_mult(qRot,qUp)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.ux = W.x + cam.x
cam.uy = W.y + cam.y
cam.uz = W.z + cam.z
// W = quaternion_mult(quaternion_mult(qRot,qRight), quaternion_conj(qRot)) <<< This does not work?!?!
W1 = quaternion_mult(qRot,qRight)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.rx = W.x + cam.x
cam.ry = W.y + cam.y
cam.rz = W.z + cam.z
ENDFUNCTION
FUNCTION camera_pitch: cam AS Tcamera, a#
LOCAL qUp AS Tquaternion
qUp.w = 0
qUp.x = cam.ux - cam.x
qUp.y = cam.uy - cam.y
qUp.z = cam.uz - cam.z
LOCAL qLook AS Tquaternion
qLook.w = 0
qLook.x = cam.lx - cam.x
qLook.y = cam.ly - cam.y
qLook.z = cam.lz - cam.z
LOCAL qRot AS Tquaternion
qRot.w = COS(a * rad/2)
qRot.x = (cam.rx - cam.x) * SIN(a * rad/2)
qRot.y = (cam.ry - cam.y) * SIN(a * rad/2)
qRot.z = (cam.rz - cam.z) * SIN(a * rad/2)
LOCAL W AS Tquaternion,W1 AS Tquaternion,W2 AS Tquaternion
W1 = quaternion_mult(qRot,qUp)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.ux = W.x + cam.x
cam.uy = W.y + cam.y
cam.uz = W.z + cam.z
W1 = quaternion_mult(qRot,qLook)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.lx = W.x + cam.x
cam.ly = W.y + cam.y
cam.lz = W.z + cam.z
ENDFUNCTION
FUNCTION camera_yaw: cam AS Tcamera, a#
LOCAL qRight AS Tquaternion
qRight.w = 0
qRight.x = cam.rx - cam.x
qRight.y = cam.ry - cam.y
qRight.z = cam.rz - cam.z
LOCAL qLook AS Tquaternion
qLook.w = 0
qLook.x = cam.lx - cam.x
qLook.y = cam.ly - cam.y
qLook.z = cam.lz - cam.z
LOCAL qRot AS Tquaternion
qRot.w = COS(a * rad/2)
qRot.x = (cam.ux - cam.x) * SIN(a * rad/2)
qRot.y = (cam.uy - cam.y) * SIN(a * rad/2)
qRot.z = (cam.uz - cam.z) * SIN(a * rad/2)
LOCAL W AS Tquaternion,W1 AS Tquaternion,W2 AS Tquaternion
W1 = quaternion_mult(qRot,qRight)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.rx = W.x + cam.x
cam.ry = W.y + cam.y
cam.rz = W.z + cam.z
W1 = quaternion_mult(qRot,qLook)
W2 = quaternion_conj(qRot)
W = quaternion_mult(W2,W1)
W = quaternion_normalize(W)
cam.lx = W.x + cam.x
cam.ly = W.y + cam.y
cam.lz = W.z + cam.z
ENDFUNCTION
FUNCTION X_6DOFCAMERA: cam AS Tcamera
X_MAKE3D cam.nearClip, cam.farClip, cam.FOV
X_CAMERAUP cam.x - cam.ux, cam.y - cam.uy, cam.z - cam.uz
DEBUG cam.x+","+cam.ux+","+cam.y+","+cam.uy+","+cam.z+","+cam.uz+"\n"
X_CAMERA cam.x, cam.y, cam.z, cam.lx, cam.ly, cam.lz
ENDFUNCTION
FUNCTION main:
// --------------------------------- //
// Project: 6DOFCam_test
// Start: Thursday, November 19, 2009
// IDE Version: 7.177
LOCAL cam1 AS Tcamera
LOCAL speed# = .01
LOCAL xv#, yv#, zv#, p#=0, r#=0, y#=0
LOCAL mx%, my%, mw%, mba%, mbb%
CONSTANT rad = 3.1415926535/180
cam1.x# = 0
cam1.y = 0
cam1.z = 0
cam1.lx = 0
cam1.ly = 0
cam1.lz = -1
cam1.ux# = 0
cam1.uy# = 1
cam1.uz# = 0
cam1.rx = 1
cam1.ry = 0
cam1.rz = 0
cam1.FOV = 45
cam1.aspect = 1024/768
cam1.nearClip = .01
cam1.farClip = 5000
WHILE TRUE
MOUSESTATE mx, my, mba, mbb
mx = MOUSEAXIS(0)/10
my = -MOUSEAXIS(1)/10
X_6DOFCAMERA(cam1)
//Linear Velocity Dampening (SPACE)
IF KEY(57)
xv = xv * .95
yv = yv * .95
zv = zv * .95
ENDIF
//Angular Velocity Dampening (CTRL)
IF KEY(29)
r = r * .95
p = p * .95
y = y * .95
ENDIF
//Accelerate Forward (W)
IF KEY(17)
xv = xv + (cam1.lx - cam1.x) * speed
yv = yv + (cam1.ly - cam1.y) * speed
zv = zv + (cam1.lz - cam1.z) * speed
ENDIF
//Accelerate Backward (S)
IF KEY(31)
xv = xv - (cam1.lx - cam1.x) * speed
yv = yv - (cam1.ly - cam1.y) * speed
zv = zv - (cam1.lz - cam1.z) * speed
ENDIF
//Accelerate Left (A)
IF KEY(30)
xv = xv + (cam1.rx - cam1.x) * speed
yv = yv + (cam1.ry - cam1.y) * speed
zv = zv + (cam1.rz - cam1.z) * speed
ENDIF
//Accelerate Right (D)
IF KEY(32)
xv = xv - (cam1.rx - cam1.x) * speed
yv = yv - (cam1.ry - cam1.y) * speed
zv = zv - (cam1.rz - cam1.z) * speed
ENDIF
//Accelerate Down (F)
IF KEY(33)
xv = xv + (cam1.ux - cam1.x) * speed
yv = yv + (cam1.uy - cam1.y) * speed
zv = zv + (cam1.uz - cam1.z) * speed
ENDIF
//Accelerate Up (R)
IF KEY(19)
xv = xv - (cam1.ux - cam1.x) * speed
yv = yv - (cam1.uy - cam1.y) * speed
zv = zv - (cam1.uz - cam1.z) * speed
ENDIF
// change IF the left mouse button is pressed
IF mba = 1
//Pitch mouse up AND
p = p + my
//Yaw
y = y + mx
ELSEIF mbb = 1
//Roll with right mouse button
r = r + mx
ENDIF
cam1.x = cam1.x + xv
cam1.y = cam1.y + yv
cam1.z = cam1.z + zv
cam1.lx = cam1.lx + xv
cam1.ly = cam1.ly + yv
cam1.lz = cam1.lz + zv
cam1.rx = cam1.rx + xv
cam1.ry = cam1.ry + yv
cam1.rz = cam1.rz + zv
cam1.ux = cam1.ux + xv
cam1.uy = cam1.uy + yv
cam1.uz = cam1.uz + zv
debug_view(0,0,0,100,RGB(255,255,0),RGB(255,0,255),RGB(0,255,255))
camera_roll(cam1,r)
camera_pitch(cam1,p)
camera_yaw(cam1,y)
X_MAKE2D
PRINT "Cam Pitch = "+p,10,10
PRINT "Cam Yaw = "+y,10,20
PRINT "Cam Roll = "+r,10,30
SETPIXEL mx,my,RGB(255,255,255)
SHOWSCREEN
MOUSEWAIT
camera_roll(cam1,0.1)
WEND
ENDFUNCTION
FUNCTION debug_view: x, y, z, crad, rgb1, rgb2, rgb3
LOCAL rad, x1, y1, j, x2, y2
y1=SIN(0)*crad
x1=COS(0)*crad
FOR j=4 TO 360 STEP 4
y2=SIN(j)*crad
x2=COS(j)*crad
X_LINE x+x1,y+y1,z , x+x2,y+y2,z,0.1,rgb1
X_LINE x+x1,y+0,y1+z, x+x2,y+0,y2+z,1,rgb2
X_LINE x+0,y+x1,y1+z, x+0,y+x2,y2+z,1,rgb3
x1=x2
y1=y2
NEXT
X_DOT x,y,z,10,rgb1
X_DRAWAXES x+crad,y,z
X_DRAWAXES x-crad,y,z
X_DRAWAXES x,y+crad,z
X_DRAWAXES x,y-crad,z
X_DRAWAXES x,y,crad+z
X_DRAWAXES x,y,-crad+z
X_PRINT "RIGHT X+",x+crad,y,z,0
X_PRINT "LEFT X-",x-crad,y,z,0
X_PRINT "UP Y+",x,y+crad,z,0
X_PRINT "DOWN Y-",x,y-crad,z,0
X_PRINT "OUT Z+",x,y,crad+z,0
X_PRINT "IN Z-",x,y,-crad+z,0
X_SETTEXTURE -1, -1
ENDFUNCTION
LOCAL x,y,z, x2,y2,z2
X_SCREEN2WORLD MouseX, MouseY, 0, x, y, z
X_SCREEN2WORLD MouseX, MouseY, -1, x2,y2,z2
// DEBUG M_Hill+","+x+","+y+","+z+","+x2+","+y2+","+z2
// END
IF X_COLLISIONRAY(M_Hill, 0, x, y, z, x2-x, y2-y, z2-z)<>0
MouseCollisionFace=X_GETCOLLISIONFACE() // div by 3 for x_getcollisionface bug, then divide by 2 to get the right triangle
X_GETFACE M_Hill, 0, MouseCollisionFace, Face[]
DEBUG "Collision = "+MouseCollisionFace+",X="+Face[0][0]+",Y="+Face[0][1]+",Z="+Face[0][2]+",nx="+Face[0][6]+",ny="+Face[0][7]+",nz="+Face[0][8]+"\n"
ELSE
MouseCollisionFace=-1
ENDIF
Injection started
7,-6.900289536,1.999999642,3.900290012,-6.900289536,1.999999642,3.900290012
LOCAL world[]
DIM world[15][10]
// Dummy Data
FOR x=0 TO 14
FOR y=0 TO 9
world[x][y]=RND(15)/10
NEXT
NEXT
// Create World Object
X_OBJSTART 0
X_AUTONORMALS 2
FOR x=0 TO 14
FOR y=0 TO 9
MakeTile(world[], x,y, -15/2, -10/2)
NEXT
NEXT
X_OBJEND
LOCAL a=0
WHILE a=0
// some dummy texture:
DRAWRECT 0,0,128,128, RGB(0,0,255)
DRAWRECT 4,4,124,124, RGB(255,255,255)
DRAWRECT 5,62,123,66, RGB(0,255,0)
DRAWRECT 62,5,66,123, RGB(0,255,0)
DRAWRECT 62,62,66,66, RGB(255,0,0)
PRINT "GLBasic", 8,8
GRABSPRITE 0, 0,0,128,128
SHOWSCREEN
IF KEY(28)=1 THEN a=1
WEND
BLACKSCREEN
WHILE TRUE
X_MAKE3D 1,100, 45
X_CAMERA 1,6,10, 0,0,0
X_SETTEXTURE 0,-1
X_ROTATION GETTIMERALL()/100, 0,1,0
X_DRAWOBJ 0,0
SHOWSCREEN
WEND
FUNCTION MakeTile: heights[], x,y, offsetx, offsety
// Triangle Strip is:
// 0--2--4-.
// | /| /| .
// |/ |/ |/
// 1--3--5-.
// We need:
// 0-1-2
// |\|/|
// 3-4-5
// |/|\|
// 6-7-8
LOCAL pts[]
LOCAL i, px, py, mx, my
DIM pts[9][3] // 9 points[x,y,z]
pts[0][0]=-1; pts[0][1]=-1
pts[1][0]=.0; pts[1][1]=-1
pts[2][0]= 1; pts[2][1]=-1
pts[3][0]=-1; pts[3][1]=.0
pts[4][0]=.0; pts[4][1]=.0
pts[5][0]= 1; pts[5][1]=.0
pts[6][0]=-1; pts[6][1]= 1
pts[7][0]=.0; pts[7][1]= 1
pts[8][0]= 1; pts[8][1]= 1
// now calculate Z for each point
mx = BOUNDS(heights[], 0)-1
my = BOUNDS(heights[], 1)-1
FOR i=0 TO 8
// Get neighbour point
// but stop at array border
px = MIN(mx, MAX(0, x+pts[i][0]))
py = MIN(my, MAX(0, y+pts[i][1]))
pts[i][2] = ( heights[px][py]+ _
heights[ x][ y]+ _
heights[px][ y]+ _
heights[ x][py])/4
NEXT
// Next a function to create 2 triangles:
INC x, offsetx
INC y, offsety
AddQuad(pts[], x,y,1,0,4,3)
AddQuad(pts[], x,y,1,4,2,5)
AddQuad(pts[], x,y,3,6,4,7)
AddQuad(pts[], x,y,5,4,8,7)
ENDFUNCTION
FUNCTION AddQuad: pts[], x,y,a,b,c,d
// here we build a triangle stipped quad
// for the points a,b,c,d
// we divide coordinates by 2, so we get a
// rectangle of size 1x1 (-0.5 -> 0.5)
// for the texture we divide by 2 and add 0.5
// (0.0 -> 1.0)
// last: we swap y and z, since y is vertical in GLBasic
LOCAL cl
cl =RGB(255,255,255)
X_OBJADDVERTEX x+pts[a][0]/2,pts[a][2],y+pts[a][1]/2, pts[a][0]/2+.5, pts[a][1]/2+.5,cl
X_OBJADDVERTEX x+pts[b][0]/2,pts[b][2],y+pts[b][1]/2, pts[b][0]/2+.5, pts[b][1]/2+.5,cl
X_OBJADDVERTEX x+pts[c][0]/2,pts[c][2],y+pts[c][1]/2, pts[c][0]/2+.5, pts[c][1]/2+.5,cl
X_OBJADDVERTEX x+pts[d][0]/2,pts[d][2],y+pts[d][1]/2, pts[d][0]/2+.5, pts[d][1]/2+.5,cl
X_OBJNEWGROUP
ENDFUNCTION
// some dummy texture:
DRAWRECT 0,0,128,128, RGB(0,0,255)
DRAWRECT 4,4,124,124, RGB(255,255,255)
DRAWRECT 5,62,123,66, RGB(0,255,0)
DRAWRECT 62,5,66,123, RGB(0,255,0)
DRAWRECT 62,62,66,66, RGB(255,0,0)
PRINT "GLBasic", 8,8
DRAWRECT 0,0,128,128, RGB(0,100,0)
DRAWRECT 4,4,124,124, RGB(0,200,0)
GLOBAL mx,my,mb1,mb2
WHILE TRUE
MOUSESTATE mx,my,mb1,mb2
PRINT mx,0,0
PRINT my,50,0
DRAWRECT mx,my,2,2,RGB(255,255,255)
SHOWSCREEN
WEND
LOCAL ScreenImage
ScreenImage=GENSPRITE()
LOCAL X
X=10
CREATESCREEN 1, ScreenImage, X, 30 // First pass, we create our sprite to do collision checks against as a single pixel
USESCREEN 1
DRAWRECT 0, 0, X, 30, RGB (255,255,0)
USESCREEN -1
CLEARSCREEN RGB(255,0,0)
LOCAL Loop
LOCAL Done = 0
WHILE Done = 0
FOR Loop = 1 TO 100
DRAWSPRITE ScreenImage,Loop,Loop
NEXT
IF KEY(1) THEN Done = 1
SHOWSCREEN
WEND
END
LOCAL TempChar$, StringToTrim$
LOCAL CharLoop, FirstNonSpace, LastNonSpace, StringLength
StringToTrim$=" This is my test string "
LastNonSpace=0
FirstNonSpace=-1
StringLength=LEN(StringToTrim$)
FOR CharLoop = 0 TO StringLength
TempChar$ = MID$(StringToTrim$,CharLoop,1)
IF ASC(TempChar$) = 0 // End of string character read
BREAK
ENDIF
IF TempChar$ <> " " // Current character is a non-space
IF FirstNonSpace = -1 // we only want to set this once
FirstNonSpace = CharLoop // when we read the first non " " character
ENDIF
LastNonSpace=CharLoop // Constantly update the last non " " character when a non " " is read
ENDIF
NEXT
StringToTrim$ = MID$(StringToTrim$,FirstNonSpace,LastNonSpace+1-FirstNonSpace)
FUNCTION Challenge2:
DDgui_pushdialog(100,100,300,400) // create main window
DDgui_set("", "TEXT", "Challenge 2 - Do I hear a bang?") // set window title
DDgui_widget("dtext1", "xxxxxxxxxxxxxx xxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx.", 300,0)
DDgui_widget("dtext2", "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYYYYYYYYYYYYYYYYYYY YYYYYYYYYY YYYYYYYYYYYYY.", 300,0)
DDgui_widget("dtext3", "\n\nZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZZ ZZZZZZZZZZZZZZZZZZZZZZZZZZ.", 300,0)
DDgui_widget("dtext4", "\nAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA.\n", 300,0)
DDgui_spacer(0,100)
DDgui_text("answer1","Answer 1")
DDgui_widget("dtext5", "and", 0,0)
DDgui_text("answer2","Answer 2")
// THE SPACER WIDGET ENDS UP HERE RATHER THAN BEFORE THE TWO BUTTONS
DDgui_widget("dtext6", "Your answer is currently : Incorrect", 0,0)
DDgui_spacer(0,40)
DDgui_button("id_button1", "Check Answer", 0,0)
DDgui_spacer(40,0)
DDgui_button("id_button2", "Main Menu", 0,0)
WHILE TRUE
DDgui_show(FALSE);
SHOWSCREEN
// check for user interaction
WEND