Emu vs Real!
This commit is contained in:
@@ -38,4 +38,4 @@ else
|
||||
end
|
||||
|
||||
localeSet(DUSK_LOCALE_EN_US)
|
||||
-- sceneSet('scene/initial.dsf')
|
||||
sceneSet('scene/initial.dsf')
|
||||
@@ -8,37 +8,53 @@ module('time')
|
||||
module('map')
|
||||
module('glm')
|
||||
|
||||
screenSetBackground(colorBlack())
|
||||
mapLoad('map/testmap/testmap.dmf')
|
||||
camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC)
|
||||
screenSetBackground(colorLime())
|
||||
mapCamera = cameraCreate()
|
||||
|
||||
text = "Hello World"
|
||||
|
||||
text = "Hello, Dusk!"
|
||||
function sceneDispose()
|
||||
end
|
||||
|
||||
function sceneUpdate()
|
||||
end
|
||||
|
||||
function sceneRender()
|
||||
-- Map Test
|
||||
mapCamera.position = vec3(4, 4, 4)
|
||||
cameraPushMatrix(mapCamera)
|
||||
mapCamera.position = vec3(300, 300, 300)
|
||||
mapRender()
|
||||
spriteBatchPush(nil, -1, -1, 1, 1, colorBlue())
|
||||
spriteBatchFlush()
|
||||
cameraPopMatrix()
|
||||
end
|
||||
|
||||
-- UI Test
|
||||
cameraPushMatrix(camera)
|
||||
camera.bottom = screenGetHeight()
|
||||
camera.right = screenGetWidth()
|
||||
|
||||
width, height = textMeasure(text)
|
||||
x = (screenGetWidth() - width)
|
||||
x = math.sin(TIME.time * 2) * (x / 2) + (x / 2)
|
||||
y = (screenGetHeight() - height) / 2
|
||||
y = math.cos(TIME.time * 3) * (y) + (y)
|
||||
textDraw(x, y, text, colorMagenta())
|
||||
-- screenSetBackground(colorBlack())
|
||||
-- mapLoad('map/testmap/testmap.dmf')
|
||||
-- camera = cameraCreate(CAMERA_PROJECTION_TYPE_ORTHOGRAPHIC)
|
||||
-- mapCamera = cameraCreate()
|
||||
|
||||
cameraPopMatrix()
|
||||
end
|
||||
-- text = "Hello World"
|
||||
|
||||
-- function sceneDispose()
|
||||
-- end
|
||||
|
||||
-- function sceneUpdate()
|
||||
-- end
|
||||
|
||||
-- function sceneRender()
|
||||
-- -- Map Test
|
||||
-- mapCamera.position = vec3(300, 300, 300)
|
||||
-- cameraPushMatrix(mapCamera)
|
||||
-- mapRender()
|
||||
-- cameraPopMatrix()
|
||||
|
||||
-- -- UI Test
|
||||
-- cameraPushMatrix(camera)
|
||||
-- camera.bottom = screenGetHeight()
|
||||
-- camera.right = screenGetWidth()
|
||||
|
||||
-- width, height = textMeasure(text)
|
||||
-- x = (screenGetWidth() - width)
|
||||
-- x = math.sin(TIME.time * 2) * (x / 2) + (x / 2)
|
||||
-- y = (screenGetHeight() - height) / 2
|
||||
-- y = math.cos(TIME.time * 3) * (y) + (y)
|
||||
-- textDraw(x, y, text, colorMagenta())
|
||||
|
||||
-- cameraPopMatrix()
|
||||
-- end
|
||||
@@ -45,42 +45,42 @@ errorret_t engineInit(const int32_t argc, const char_t **argv) {
|
||||
errorChain(scriptContextInit(&ctx));
|
||||
// errorChain(scriptContextExecFile(&ctx, "init.dsf"));
|
||||
|
||||
errorChain(scriptContextExec(&ctx,
|
||||
"printf('Lua still working')"
|
||||
// "module('platform')\n"
|
||||
// "module('input')\n"
|
||||
// "module('scene')\n"
|
||||
// "module('locale')\n"
|
||||
// "if PLATFORM == \"psp\" then\n"
|
||||
// " inputBind(\"up\", INPUT_ACTION_UP)\n"
|
||||
// " inputBind(\"down\", INPUT_ACTION_DOWN)\n"
|
||||
// " inputBind(\"left\", INPUT_ACTION_LEFT)\n"
|
||||
// " inputBind(\"right\", INPUT_ACTION_RIGHT)\n"
|
||||
// " inputBind(\"circle\", INPUT_ACTION_CANCEL)\n"
|
||||
// " inputBind(\"cross\", INPUT_ACTION_ACCEPT)\n"
|
||||
// " inputBind(\"select\", INPUT_ACTION_RAGEQUIT)\n"
|
||||
// " inputBind(\"lstick_up\", INPUT_ACTION_UP)\n"
|
||||
// " inputBind(\"lstick_down\", INPUT_ACTION_DOWN)\n"
|
||||
// " inputBind(\"lstick_left\", INPUT_ACTION_LEFT)\n"
|
||||
// " inputBind(\"lstick_right\", INPUT_ACTION_RIGHT)\n"
|
||||
// "else\n"
|
||||
// " if INPUT_KEYBOARD then\n"
|
||||
// " inputBind(\"w\", INPUT_ACTION_UP)\n"
|
||||
// " inputBind(\"s\", INPUT_ACTION_DOWN)\n"
|
||||
// " inputBind(\"a\", INPUT_ACTION_LEFT)\n"
|
||||
// " inputBind(\"d\", INPUT_ACTION_RIGHT)\n"
|
||||
// " inputBind(\"left\", INPUT_ACTION_LEFT)\n"
|
||||
// " inputBind(\"right\", INPUT_ACTION_RIGHT)\n"
|
||||
// " inputBind(\"up\", INPUT_ACTION_UP)\n"
|
||||
// " inputBind(\"down\", INPUT_ACTION_DOWN)\n"
|
||||
// " inputBind(\"enter\", INPUT_ACTION_ACCEPT)\n"
|
||||
// " inputBind(\"e\", INPUT_ACTION_ACCEPT)\n"
|
||||
// " inputBind(\"q\", INPUT_ACTION_CANCEL)\n"
|
||||
// " inputBind(\"escape\", INPUT_ACTION_RAGEQUIT)\n"
|
||||
// " end \n"
|
||||
// "end\n"
|
||||
errorChain(scriptContextExec(&ctx,
|
||||
"module('platform')\n"
|
||||
"module('input')\n"
|
||||
"module('scene')\n"
|
||||
"module('locale')\n"
|
||||
"if PLATFORM == \"psp\" then\n"
|
||||
" inputBind(\"up\", INPUT_ACTION_UP)\n"
|
||||
" inputBind(\"down\", INPUT_ACTION_DOWN)\n"
|
||||
" inputBind(\"left\", INPUT_ACTION_LEFT)\n"
|
||||
" inputBind(\"right\", INPUT_ACTION_RIGHT)\n"
|
||||
" inputBind(\"circle\", INPUT_ACTION_CANCEL)\n"
|
||||
" inputBind(\"cross\", INPUT_ACTION_ACCEPT)\n"
|
||||
" inputBind(\"select\", INPUT_ACTION_RAGEQUIT)\n"
|
||||
" inputBind(\"lstick_up\", INPUT_ACTION_UP)\n"
|
||||
" inputBind(\"lstick_down\", INPUT_ACTION_DOWN)\n"
|
||||
" inputBind(\"lstick_left\", INPUT_ACTION_LEFT)\n"
|
||||
" inputBind(\"lstick_right\", INPUT_ACTION_RIGHT)\n"
|
||||
"else\n"
|
||||
" if INPUT_KEYBOARD then\n"
|
||||
" inputBind(\"w\", INPUT_ACTION_UP)\n"
|
||||
" inputBind(\"s\", INPUT_ACTION_DOWN)\n"
|
||||
" inputBind(\"a\", INPUT_ACTION_LEFT)\n"
|
||||
" inputBind(\"d\", INPUT_ACTION_RIGHT)\n"
|
||||
" inputBind(\"left\", INPUT_ACTION_LEFT)\n"
|
||||
" inputBind(\"right\", INPUT_ACTION_RIGHT)\n"
|
||||
" inputBind(\"up\", INPUT_ACTION_UP)\n"
|
||||
" inputBind(\"down\", INPUT_ACTION_DOWN)\n"
|
||||
" inputBind(\"enter\", INPUT_ACTION_ACCEPT)\n"
|
||||
" inputBind(\"e\", INPUT_ACTION_ACCEPT)\n"
|
||||
" inputBind(\"q\", INPUT_ACTION_CANCEL)\n"
|
||||
" inputBind(\"escape\", INPUT_ACTION_RAGEQUIT)\n"
|
||||
" end \n"
|
||||
"end\n"
|
||||
// "localeSet(DUSK_LOCALE_EN_US)\n"
|
||||
// "print('Good here')"
|
||||
"sceneSet('scene/initial.dsf')\n"
|
||||
|
||||
));
|
||||
|
||||
scriptContextDispose(&ctx);
|
||||
|
||||
@@ -75,7 +75,31 @@ errorret_t sceneSet(const char_t *script) {
|
||||
|
||||
// Create a new script context.
|
||||
errorChain(scriptContextInit(&SCENE.scriptContext));
|
||||
errorChain(scriptContextExecFile(&SCENE.scriptContext, script));
|
||||
// errorChain(scriptContextExecFile(&SCENE.scriptContext, script));
|
||||
errorChain(scriptContextExec(&SCENE.scriptContext,
|
||||
"module('spritebatch')\n"
|
||||
"module('camera')\n"
|
||||
"module('color')\n"
|
||||
"module('text')\n"
|
||||
"module('screen')\n"
|
||||
"module('time')\n"
|
||||
"module('map')\n"
|
||||
"module('glm')\n"
|
||||
"screenSetBackground(colorLime())\n"
|
||||
"mapCamera = cameraCreate()\n"
|
||||
"text = 'Hello World'\n"
|
||||
"function sceneDispose()\n"
|
||||
"end\n"
|
||||
"function sceneUpdate()\n"
|
||||
"end\n"
|
||||
"function sceneRender()\n"
|
||||
" mapCamera.position = vec3(4, 4, 4)\n"
|
||||
" cameraPushMatrix(mapCamera)\n"
|
||||
" spriteBatchPush(nil, -1, -1, 1, 1, colorBlue())\n"
|
||||
" spriteBatchFlush()\n"
|
||||
" cameraPopMatrix()\n"
|
||||
"end\n"
|
||||
));
|
||||
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ errorret_t scriptContextExec(scriptcontext_t *context, const char_t *script) {
|
||||
if(luaL_dostring(context->luaState, script) != LUA_OK) {
|
||||
const char_t *strErr = lua_tostring(context->luaState, -1);
|
||||
lua_pop(context->luaState, 1);
|
||||
errorThrow("Failed to execute Lua: ", strErr);
|
||||
errorThrow("Failed to execute Lua: %s", strErr);
|
||||
}
|
||||
|
||||
errorOk();
|
||||
|
||||
Reference in New Issue
Block a user