I am getting this error message:
ain.agc:15: error: Variable "screencenterx" is used without being defined or initialise
d
Here is the code i am using:
constants.agc
+ Code Snippet// screen constants
#constant SCREENWIDTH = 1024
#constant SCREENHEIGHT = 768
#constant SCREENCENTERX = SCREENWIDTH / 2
#constant SCREENCENTERY = SCREENHEIGHT / 2
// drum constants
#constant DRUMSX=SCREENCENTERX
#constant DRUMSY = 100
#constant DRUMRADIUS = 80
#constant DRUMSPACING = DRUMRADIUS * 2
init.agc
+ Code Snippetfunction initSystem()
// show all errors
SetErrorMode(2)
// set window properties
SetWindowTitle( "Drum Machine Hero" )
// set the window size
SetWindowSize( 1024, 768, 0 )
// allow the user to resize the window
SetWindowAllowResize( 1 )
// set display properties
SetVirtualResolution( 1024, 768 ) // doesn't have to match the window
// allow both portrait and landscape on mobile devices
SetOrientationAllowed( 1, 1, 1, 1 )
// 30fps instead of 60 to save battery
SetSyncRate( 30, 0 )
// use the maximum available screen space, no black borders
SetScissor( 0,0,0,0 )
// since version 2.0.22 we can use nicer default fonts
UseNewDefaultFonts( 1 )
endfunction
render.agc
+ Code Snippetfunction drawDrums(x, y, drumsize, color)
DrawEllipse(512, 184, 40, 40, MakeColor(255, 255, 255), MakeColor(0, 0, 0), 1)
DrawEllipse(592, 184, 40, 40, MakeColor(255, 255, 255), MakeColor(0, 0, 0), 1)
endfunction
main.agc
+ Code Snippet// Project: Drum Machine Hero
// Created: 2021-10-10
#include "constants.agc"
#include "init.agc"
#include "render.agc"
initSystem()
do
Print( ScreenFPS() )
drawDrums(DRUMSX, 0, 0, 0)
Sync()
loop
As you can see I am not even using the constants value at all in the function itself.