Added MSVC debugging tool, discovered globals feature
This commit is contained in:
@@ -1,3 +1,6 @@
|
|||||||
|
//A quirk of the setup is that anything defined in the root of `init.toy` becomes a global object
|
||||||
|
//To resolve that, the configuration is inside a block scope
|
||||||
|
{
|
||||||
import engine;
|
import engine;
|
||||||
import input;
|
import input;
|
||||||
|
|
||||||
@@ -29,3 +32,7 @@ initWindow("Airport Game", 1080, 720, false);
|
|||||||
|
|
||||||
//kick off the logic of the scene graph
|
//kick off the logic of the scene graph
|
||||||
loadRootNode("scripts:/scene.toy");
|
loadRootNode("scripts:/scene.toy");
|
||||||
|
}
|
||||||
|
|
||||||
|
//Globals go here
|
||||||
|
|
||||||
|
|||||||
@@ -24,12 +24,15 @@
|
|||||||
#include <SDL_image.h>
|
#include <SDL_image.h>
|
||||||
|
|
||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
|
#include <crtdbg.h>
|
||||||
|
|
||||||
#ifndef BOX_EXPORT
|
#ifndef BOX_EXPORT
|
||||||
#define BOX_API __declspec(dllimport)
|
#define BOX_API __declspec(dllimport)
|
||||||
#else
|
#else
|
||||||
#define BOX_API __declspec(dllexport)
|
#define BOX_API __declspec(dllexport)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//TODO: figure out the sleep issue
|
||||||
#define sleep Sleep
|
#define sleep Sleep
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -70,7 +70,7 @@ void Box_initEngine() {
|
|||||||
const unsigned char* tb = Toy_compileString((const char*)source, &size);
|
const unsigned char* tb = Toy_compileString((const char*)source, &size);
|
||||||
free((void*)source);
|
free((void*)source);
|
||||||
|
|
||||||
//TODO: inner-interpreter
|
//A quirk of the setup is that anything defined in `init.toy` becomes a global object
|
||||||
Toy_runInterpreter(&engine.interpreter, tb, size);
|
Toy_runInterpreter(&engine.interpreter, tb, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -147,7 +147,7 @@ static void execLoadRootNode() {
|
|||||||
Box_callEngineNode(engine.rootNode, &inner, "onLoad", NULL);
|
Box_callEngineNode(engine.rootNode, &inner, "onLoad", NULL);
|
||||||
|
|
||||||
//manual cleanup
|
//manual cleanup
|
||||||
inner.scope = Toy_popScope(inner.scope);
|
Toy_popScope(inner.scope);
|
||||||
Toy_freeLiteralArray(&inner.stack);
|
Toy_freeLiteralArray(&inner.stack);
|
||||||
Toy_freeLiteralArray(&inner.literalCache);
|
Toy_freeLiteralArray(&inner.literalCache);
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,12 @@
|
|||||||
#include "lib_runner.h"
|
#include "lib_runner.h"
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
int main(int argc, char* argv[]) {
|
||||||
|
//debugging tools
|
||||||
|
#ifdef _DEBUG
|
||||||
|
// Memory Leak Detection during Debug Builds (MSVC only)
|
||||||
|
_CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF);
|
||||||
|
#endif//win32 && debug
|
||||||
|
|
||||||
//the drive system uses a LiteralDictionary, which must be initialized with this
|
//the drive system uses a LiteralDictionary, which must be initialized with this
|
||||||
Toy_initDriveDictionary();
|
Toy_initDriveDictionary();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user