Maybe using LSet() and RSet May be useful.
LoadResource("Puntero.png")
LoadResource("Inciar.png")
LoadResource("Opciones.png")
LoadResource("Salir.png")
LoadResource("Nave.b3d")
Function LoadResource%(Path$)
Local Resource%
Debug("Loading "+Path+"...")
Local Message$=Path+" [Loaded "
If (Len(Path)>4)
Select (Lower(Right(Path,3)))
Case "b3d":
Resource = LoadMesh(Path$)
Default:
;Image
Resource = LoadImage(Path$)
End Select
EndIf
If ( Resource )
Message=Message+" OK!]"
Else
Message=Message+" Failed!]"
End If
Debug(Message)
Return Resource
End Function
Const DEBUG_TRIGGER$="+dev"
Const DEBUG_FILE$="Debuglog.txt"
Global DEBUG_PATH$
Global DEBUG_STREAM%
Global DEBUG_ON
Function InitialiseDebug()
DEBUG_ON=(Instr(Lower(CommandLine()),DEBUG_TRIGGER$)<>False)
DEBUG_PATH=CurrentDir()+DEBUG_FILE
DeleteFile DEBUG_PATH
End Function
Function Debug(Message$,Critical=False)
If (Not(DEBUG_ON))
Return
End If
If (Not(DEBUG_STREAM))
If (FileType(DEBUG_PATH)=1)
DEBUG_STREAM=OpenFile(DEBUG_PATH)
Else
DEBUG_STREAM=WriteFile(DEBUG_PATH)
End If
If (Not (DEBUG_STREAM))
DEBUG_ON=False
Return
End If
SeekFile DEBUG_STREAM,(FileSize(DEBUG_PATH))
End If
DebugLog Message
Local FormatMessage$=LSet(CurrentTime(),9)+"| "+LSet(CurrentDate(),12)+"| "+Message
WriteLine DEBUG_STREAM,FormatMessage
If (Critical)
RuntimeError Message
End If
End Function
|