I was wondering if you can help me figure out why my code is so slow, it runs at about 12 fps, but if I take the matrix out it runs at 49 fps:
sync on
sync rate 50
set display mode 1024,768,32
disable escapekey : `Disable users ability to exit program using the escape key
set window on : ` fixes a display problem with my crappy video card
REM setup a 3d backdrop
backdrop on : `Display a backdrop for 3d, so the ugly blue doesn't come through
color backdrop rgb(0, 0, 0) : `Make the backdrop black
REM Setup a default matrix to work with
Make Matrix 1, 200, 200, 50, 50
REM Include code files
#include "debug.dba"
#include "color.dba"
REM Specific game variables
game_name$ = "Unnamed Game" : `Named of the game/project we are working on
REM Camera Variables and setup default positions for the camera
camX# = 50
camY# = 200
camZ# = 50
position camera camX#, camY#, camZ#
xrotate camera 45
yrotate camera 45
REM Global Variables
toolbar_state = 0 : `toolbar_state 0 shows small toolbar, 1 is large toolbar
REM Window variables
load_object_window = 0 : `If load object window is set to 1, display that window
REM Load images and art assets
load image "images\toolbarhidden.bmp",1
load image "images\toolbar.bmp",2
load image "images\titlebar.bmp",3
load image "images\loadobject.bmp",4
REM Main game loop
do
gosub Toolbar
gosub Titlebar
gosub Windows
gosub MoveCamera
Debug_Tool(game_path$)
sync
loop
REM Show the toolbar, and allow the user to click any part of it to open other windows and work with objects,
REM can be closed to a smaller toolbar
Toolbar:
if toolbar_state = 0 then paste image 1,0,20
if toolbar_state = 1 then paste image 2,0,20
REM if the arrow is clicked on the hidden toolbar show the full toolbar
if mousex() > 0 and mousex() < 50
if mousey() > 20 and mousey() < 70 and mouseclick() = 1
toolbar_state = 1
endif
endif
REM if the X on the full toolbar is clicked, show the small toolbar
if mousex() > 185 and mousex() < 200
if mousey() > 20 and mousey() < 35 and mouseclick() = 1
toolbar_state = 0
endif
endif
REM If the toolbar is expanded and object list is clicked show the object list
if mousex() > 134 and mousex() < 188
if mousey() > 40 and mousey() < 92 and mouseclick() = 1
load_object_window = 1
endif
endif
return
REM Show the titlebar across the top of the screen and allow the user to close/minimize it
Titlebar:
paste image 3,0,0
title$ = "Game Editor -- " + game_name$
text 5,0,title$
REM if user clicks the line in the upper right minimize the window
if mousex() > 992 and mousex() < 1004
if mousey() > 6 and mousey() < 20 and mouseclick() = 1
minimize window
endif
endif
REM if user clicks the X in the upper right, close the program
if mousex() > 1006 and mousex() < 1020
if mousey() > 6 and mousey() < 20 and mouseclick() = 1
end
endif
endif
return
REM Show the LoadObject Window, so we can load custom objects into the editor
LoadObject:
REM Load image dead center in the screen
paste image 4,(screen width() / 2) - 250,(screen height() / 2) - 250
return
REM Show any windows if they are activated
Windows:
if load_object_window = 1 then gosub LoadObject
return
Movecamera:
if keystate(184) = 1 and mouseclick() = 1
position camera camX#, camY#, camZ#
endif
return
Any assistance is greatly appreciated!