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