I am getting the following error when i try to compile my code:
Here is the code I am using:[17:29:56] [COMPILER] Line 39: Module not found: stars_currency.
main.sb
Code: Select all
; include all the required modules
XIncludeFile "input.sb"
XIncludeFile "currency.sb"
XIncludeFile "app.sb"
; module use declaration
UseModule Input
UseModule Currency
UseModule App
; initalize the input environment
Input::init()
App::createWindow()
Global stars_currency = Currency::create("Stars", 50, 50)
Code: Select all
DeclareModule App
; procedures
Declare createWindow()
Declare eventHandler()
Declare update()
Declare render()
EndDeclareModule
Module App
; window handle
Global windowHandle
; procedure to create the window
Procedure createWindow()
; examine the desktop for it's width and height
ExamineDesktops()
; open a window with it's width and height half of the desktop width and height
windowHandle = OpenWindow(#PB_Any, 0, 0, DesktopWidth(0) / 2, DesktopHeight(0) / 2, "Idle Game")
EndProcedure
Procedure eventHandler()
Select Event()
EndSelect
; update the game states
update()
; render the game states
render()
EndProcedure
Procedure update()
; poll for input
Input::poll()
; if the mouse button has been pressed
If Input::hasClicked()
stars_currency::increment()
EndIf
EndProcedure
Procedure render()
EndProcedure
EndModule
; bind the event queue to it's handler
BindEvent(0, eventHandler)
Code: Select all
DeclareModule Currency
; procedures
Declare create(name.s, x.c, y.c)
Declare increment()
EndDeclareModule
Module Currency
; canvas to draw on
Global gadget
Global name.s = ""
Global value.l = 0
; create the currency
Procedure create(name.s, x.c, y.c)
gadget = TextGadget(#PB_Any, x, y, 100, 100, "" + name + ": " + value)
ProcedureReturn gadget
EndProcedure
Procedure increment()
value = value + 1
Debug "Value: " + value
EndProcedure
EndModule
Code: Select all
DeclareModule Input
; procedures
Declare init()
Declare poll()
Declare hasClicked()
EndDeclareModule
Module Input
; initalized?
Global.b initalized = 0
; has the user interacted
Global.b input = 0
; create the currency
Procedure init()
InitMouse()
EndProcedure
Procedure poll()
; scan the mouse
ExamineMouse()
If MouseButton(#PB_MouseButton_Left)
input = 1
Else
input = 0
EndIf
EndProcedure
Procedure hasClicked()
ProcedureReturn input
EndProcedure
EndModule
Sincerely,
Cyber Spider