Hi,
I am trying to create a box in the center of the screen which will represent a street. I am using this code to do so:
function CreateForeground()
// draw the street
DrawBox(GetDeviceWidth() / 4, 0, GetDeviceWidth() / 2, GetDeviceHeight(), MakeColor(0,0,0), MakeColor(0,0,0), MakeColor(0,0,0), MakeColor(0,0,0), 1)
endfunction
However when i try to runit all i get is the background color which may mean i am not drawing the box correctly. Here is the full source code:
// Project: EndlessRacer
// Created: 2016-05-28
// set window properties
SetWindowTitle( "EndlessRacer" )
SetWindowSize( 1024, 768, 0 )
// set display properties
SetVirtualResolution( 1024, 768 )
SetOrientationAllowed( 1, 1, 1, 1 )
// set up the types
Type _Player
id as Integer
x as Integer
Endtype
// setup globals
Global gameMode
Global Score
CreateBackground()
CreateForeground()
/*
CreateLogo()
LoadPlayerImage()
LoadEnemyImage()
LoadFonts()
CreateTextLines()
LoadSounds()
LoadAndStartMusic()
CreateLevel()
CreatePlayer()
CreateEnemy()
CreateOverlays()
ActivateMenu()
SetObjectOrder()
*/
do
Print( ScreenFPS() )
Sync()
loop
/******************************************************************************/
function CreateBackground()
// set the background color to green
SetClearColor(0,92,9)
endfunction
function CreateForeground()
// draw the street
DrawBox(GetDeviceWidth() / 4, 0, GetDeviceWidth() / 2, GetDeviceHeight(), MakeColor(0,0,0), MakeColor(0,0,0), MakeColor(0,0,0), MakeColor(0,0,0), 1)
endfunction
Any assistance in this matter would be greatly appreciated.
Sincerely,
Developer