Updated Toy

This commit is contained in:
2023-03-15 06:40:34 +11:00
parent c4bd1f20d2
commit a04c506811
6 changed files with 22 additions and 222 deletions

View File

@@ -14,54 +14,18 @@ int main(int argc, char* argv[]) {
#endif//win32 && debug
//the drive system uses a LiteralDictionary, which must be initialized with this
Toy_initDriveDictionary();
Toy_initDriveSystem();
{
//create a pair of literals, the first for the drive name, the second for the path
Toy_Literal driveLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("scripts"));
Toy_Literal pathLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("assets/scripts"));
Toy_setDrivePath("scripts", "assets/scripts");
Toy_setDrivePath("sprites", "assets/sprites");
Toy_setDrivePath("fonts", "assets/fonts");
//set these within the drive dictionary
Toy_setLiteralDictionary(Toy_getDriveDictionary(), driveLiteral, pathLiteral);
//these literals are no longer needed
Toy_freeLiteral(driveLiteral);
Toy_freeLiteral(pathLiteral);
}
{
//create a pair of literals, the first for the drive name, the second for the path
Toy_Literal driveLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("sprites"));
Toy_Literal pathLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("assets/sprites"));
//set these within the drive dictionary
Toy_setLiteralDictionary(Toy_getDriveDictionary(), driveLiteral, pathLiteral);
//these literals are no longer needed
Toy_freeLiteral(driveLiteral);
Toy_freeLiteral(pathLiteral);
}
{
//create a pair of literals, the first for the drive name, the second for the path
Toy_Literal driveLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("fonts"));
Toy_Literal pathLiteral = TOY_TO_STRING_LITERAL(Toy_createRefString("assets/fonts"));
//set these within the drive dictionary
Toy_setLiteralDictionary(Toy_getDriveDictionary(), driveLiteral, pathLiteral);
//these literals are no longer needed
Toy_freeLiteral(driveLiteral);
Toy_freeLiteral(pathLiteral);
}
//run the rest of your program
Box_initEngine();
Box_execEngine();
Box_freeEngine();
//clean up the drive dictionary when you're done
Toy_freeDriveDictionary();
Toy_freeDriveSystem();
return 0;
}