Let's get this rendering on PSP and Dolphin.
This commit is contained in:
@@ -4,56 +4,56 @@ module('scene')
|
||||
module('locale')
|
||||
|
||||
-- Default Input bindings.
|
||||
-- if PLATFORM == "psp" then
|
||||
-- inputBind("up", INPUT_ACTION_UP)
|
||||
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||
-- inputBind("circle", INPUT_ACTION_CANCEL)
|
||||
-- inputBind("cross", INPUT_ACTION_ACCEPT)
|
||||
-- inputBind("select", INPUT_ACTION_RAGEQUIT)
|
||||
-- inputBind("lstick_up", INPUT_ACTION_UP)
|
||||
-- inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||
-- inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||
-- inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||
if PLATFORM == "psp" then
|
||||
inputBind("up", INPUT_ACTION_UP)
|
||||
inputBind("down", INPUT_ACTION_DOWN)
|
||||
inputBind("left", INPUT_ACTION_LEFT)
|
||||
inputBind("right", INPUT_ACTION_RIGHT)
|
||||
inputBind("circle", INPUT_ACTION_CANCEL)
|
||||
inputBind("cross", INPUT_ACTION_ACCEPT)
|
||||
inputBind("select", INPUT_ACTION_RAGEQUIT)
|
||||
inputBind("lstick_up", INPUT_ACTION_UP)
|
||||
inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||
inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||
inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||
|
||||
-- elseif DOLPHIN then
|
||||
-- inputBind("up", INPUT_ACTION_UP)
|
||||
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||
-- inputBind("b", INPUT_ACTION_CANCEL)
|
||||
-- inputBind("a", INPUT_ACTION_ACCEPT)
|
||||
-- inputBind("z", INPUT_ACTION_RAGEQUIT)
|
||||
-- inputBind("lstick_up", INPUT_ACTION_UP)
|
||||
-- inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||
-- inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||
-- inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||
elseif DOLPHIN then
|
||||
inputBind("up", INPUT_ACTION_UP)
|
||||
inputBind("down", INPUT_ACTION_DOWN)
|
||||
inputBind("left", INPUT_ACTION_LEFT)
|
||||
inputBind("right", INPUT_ACTION_RIGHT)
|
||||
inputBind("b", INPUT_ACTION_CANCEL)
|
||||
inputBind("a", INPUT_ACTION_ACCEPT)
|
||||
inputBind("z", INPUT_ACTION_RAGEQUIT)
|
||||
inputBind("lstick_up", INPUT_ACTION_UP)
|
||||
inputBind("lstick_down", INPUT_ACTION_DOWN)
|
||||
inputBind("lstick_left", INPUT_ACTION_LEFT)
|
||||
inputBind("lstick_right", INPUT_ACTION_RIGHT)
|
||||
|
||||
-- else
|
||||
-- if INPUT_KEYBOARD then
|
||||
-- inputBind("w", INPUT_ACTION_UP)
|
||||
-- inputBind("s", INPUT_ACTION_DOWN)
|
||||
-- inputBind("a", INPUT_ACTION_LEFT)
|
||||
-- inputBind("d", INPUT_ACTION_RIGHT)
|
||||
else
|
||||
if INPUT_KEYBOARD then
|
||||
inputBind("w", INPUT_ACTION_UP)
|
||||
inputBind("s", INPUT_ACTION_DOWN)
|
||||
inputBind("a", INPUT_ACTION_LEFT)
|
||||
inputBind("d", INPUT_ACTION_RIGHT)
|
||||
|
||||
-- inputBind("left", INPUT_ACTION_LEFT)
|
||||
-- inputBind("right", INPUT_ACTION_RIGHT)
|
||||
-- inputBind("up", INPUT_ACTION_UP)
|
||||
-- inputBind("down", INPUT_ACTION_DOWN)
|
||||
inputBind("left", INPUT_ACTION_LEFT)
|
||||
inputBind("right", INPUT_ACTION_RIGHT)
|
||||
inputBind("up", INPUT_ACTION_UP)
|
||||
inputBind("down", INPUT_ACTION_DOWN)
|
||||
|
||||
-- inputBind("enter", INPUT_ACTION_ACCEPT)
|
||||
-- inputBind("e", INPUT_ACTION_ACCEPT)
|
||||
inputBind("enter", INPUT_ACTION_ACCEPT)
|
||||
inputBind("e", INPUT_ACTION_ACCEPT)
|
||||
|
||||
-- inputBind("q", INPUT_ACTION_CANCEL)
|
||||
inputBind("q", INPUT_ACTION_CANCEL)
|
||||
|
||||
-- inputBind("escape", INPUT_ACTION_RAGEQUIT)
|
||||
-- end
|
||||
inputBind("escape", INPUT_ACTION_RAGEQUIT)
|
||||
end
|
||||
|
||||
-- if INPUT_POINTER then
|
||||
-- inputBind("mouse_x", INPUT_ACTION_POINTERX)
|
||||
-- inputBind("mouse_y", INPUT_ACTION_POINTERY)
|
||||
-- end
|
||||
-- end
|
||||
if INPUT_POINTER then
|
||||
inputBind("mouse_x", INPUT_ACTION_POINTERX)
|
||||
inputBind("mouse_y", INPUT_ACTION_POINTERY)
|
||||
end
|
||||
end
|
||||
|
||||
-- sceneSet('scene/minesweeper.lua')
|
||||
sceneSet('scene/minesweeper.lua')
|
||||
@@ -183,24 +183,30 @@ function sceneRender()
|
||||
camera.bottom = screenGetHeight()
|
||||
camera.right = screenGetWidth()
|
||||
|
||||
-- Update mouse position
|
||||
if INPUT_POINTER then
|
||||
mouseX = inputGetValue(INPUT_ACTION_POINTERX) * screenGetWidth()
|
||||
mouseY = inputGetValue(INPUT_ACTION_POINTERY) * screenGetHeight()
|
||||
|
||||
-- Draw cursor
|
||||
spriteBatchPush(
|
||||
nil,
|
||||
mouseX - 2, mouseY - 2,
|
||||
mouseX + 2, mouseY + 2,
|
||||
colorRed(),
|
||||
0, 0,
|
||||
1, 1
|
||||
0, 0, 32, 32,
|
||||
colorBlue()
|
||||
)
|
||||
end
|
||||
|
||||
-- Update mouse position
|
||||
-- if INPUT_POINTER then
|
||||
-- mouseX = inputGetValue(INPUT_ACTION_POINTERX) * screenGetWidth()
|
||||
-- mouseY = inputGetValue(INPUT_ACTION_POINTERY) * screenGetHeight()
|
||||
|
||||
-- -- Draw cursor
|
||||
-- spriteBatchPush(
|
||||
-- nil,
|
||||
-- mouseX - 2, mouseY - 2,
|
||||
-- mouseX + 2, mouseY + 2,
|
||||
-- colorRed(),
|
||||
-- 0, 0,
|
||||
-- 1, 1
|
||||
-- )
|
||||
-- end
|
||||
|
||||
|
||||
textDraw(10, 10, "Hello World")
|
||||
-- textDraw(10, 10, "Hello World")
|
||||
|
||||
-- centerX = math.floor(screenGetWidth() / 2)
|
||||
-- centerY = math.floor(screenGetHeight() / 2)
|
||||
|
||||
@@ -17,9 +17,9 @@ errorret_t screenInit() {
|
||||
|
||||
SCREEN.background = COLOR_CORNFLOWER_BLUE;
|
||||
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
SCREEN.mode = SCREEN_MODE_FIXED_VIEWPORT_HEIGHT;
|
||||
SCREEN.fixedHeight.height = DISPLAY_SCREEN_HEIGHT_DEFAULT;
|
||||
SCREEN.fixedHeight.height = DUSK_DISPLAY_SCREEN_HEIGHT;
|
||||
|
||||
cameraInitOrthographic(&SCREEN.framebufferCamera);
|
||||
SCREEN.framebufferCamera.viewType = CAMERA_VIEW_TYPE_2D;
|
||||
@@ -27,14 +27,14 @@ errorret_t screenInit() {
|
||||
SCREEN.framebufferCamera._2d.position[1] = 0;
|
||||
SCREEN.framebufferCamera._2d.zoom = 1.0f;
|
||||
|
||||
errorChain(quadBuffer(
|
||||
quadBuffer(
|
||||
SCREEN.frameBufferMeshVertices,
|
||||
0.0f, 0.0f,
|
||||
1.0f, 1.0f,
|
||||
COLOR_WHITE,
|
||||
0.0f, 0.0f,
|
||||
1.0f, 1.0f
|
||||
));
|
||||
);
|
||||
errorChain(meshInit(
|
||||
&SCREEN.frameBufferMesh,
|
||||
QUAD_PRIMITIVE_TYPE,
|
||||
@@ -57,7 +57,7 @@ void screenBind() {
|
||||
SCREEN.height = frameBufferGetHeight(FRAMEBUFFER_BOUND);
|
||||
|
||||
// No needd for a framebuffer.
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
if(SCREEN.framebufferReady) {
|
||||
frameBufferDispose(&SCREEN.framebuffer);
|
||||
SCREEN.framebufferReady = false;
|
||||
@@ -66,7 +66,7 @@ void screenBind() {
|
||||
break;
|
||||
}
|
||||
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
case SCREEN_MODE_FIXED_SIZE: {
|
||||
SCREEN.width = SCREEN.fixedSize.width;
|
||||
SCREEN.height = SCREEN.fixedSize.height;
|
||||
@@ -270,7 +270,7 @@ void screenUnbind() {
|
||||
case SCREEN_MODE_BACKBUFFER:
|
||||
break;
|
||||
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
case SCREEN_MODE_ASPECT_RATIO:
|
||||
case SCREEN_MODE_FIXED_HEIGHT:
|
||||
case SCREEN_MODE_FIXED_SIZE:
|
||||
@@ -293,7 +293,7 @@ void screenRender() {
|
||||
return;
|
||||
}
|
||||
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
if(SCREEN.mode == SCREEN_MODE_FIXED_VIEWPORT_HEIGHT) {
|
||||
glViewport(0, 0, SCREEN.width, SCREEN.height);
|
||||
return;
|
||||
@@ -369,7 +369,7 @@ void screenRender() {
|
||||
}
|
||||
|
||||
void screenDispose() {
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
if(SCREEN.framebufferReady) {
|
||||
frameBufferDispose(&SCREEN.framebuffer);
|
||||
SCREEN.framebufferReady = false;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
#include "display/mesh/quad.h"
|
||||
#include "display/color.h"
|
||||
|
||||
#if DUSK_DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
#ifndef DUSK_DISPLAY_SCREEN_HEIGHT
|
||||
#error "DUSK_DISPLAY_SCREEN_HEIGHT must be defined"
|
||||
#endif
|
||||
@@ -47,7 +47,7 @@ typedef struct {
|
||||
float_t aspect;
|
||||
color_t background;
|
||||
|
||||
#if DISPLAY_SIZE_DYNAMIC == 1
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
framebuffer_t framebuffer;
|
||||
bool_t framebufferReady;
|
||||
camera_t framebufferCamera;
|
||||
|
||||
@@ -14,7 +14,7 @@ typedef struct {
|
||||
float_t lastValue;
|
||||
float_t currentValue;
|
||||
|
||||
#if TIME_FIXED == 0
|
||||
#ifdef DUSK_TIME_DYNAMIC
|
||||
float_t lastDynamicValue;
|
||||
float_t currentDynamicValue;
|
||||
#endif
|
||||
|
||||
@@ -168,7 +168,7 @@ errorret_t mapPositionSet(const chunkpos_t newPos) {
|
||||
}
|
||||
|
||||
void mapUpdate() {
|
||||
#if TIME_FIXED == 0
|
||||
#ifdef DUSK_TIME_DYNAMIC
|
||||
if(!TIME.dynamicUpdate) return;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ errorret_t sceneInit(void) {
|
||||
}
|
||||
|
||||
errorret_t sceneUpdate(void) {
|
||||
#if TIME_FIXED == 0
|
||||
#ifdef DUSK_TIME_DYNAMIC
|
||||
if(!TIME.dynamicUpdate) {
|
||||
errorOk();
|
||||
}
|
||||
|
||||
@@ -18,25 +18,18 @@ void moduleInput(scriptcontext_t *context) {
|
||||
|
||||
// Input values.
|
||||
scriptContextExec(context,
|
||||
#if INPUT_KEYBOARD == 1
|
||||
""
|
||||
#ifdef DUSK_INPUT_KEYBOARD
|
||||
"INPUT_KEYBOARD = true\n"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
#if INPUT_GAMEPAD == 1
|
||||
#ifdef DUSK_INPUT_GAMEPAD
|
||||
"INPUT_GAMEPAD = true\n"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
#if INPUT_POINTER == 1
|
||||
#ifdef DUSK_INPUT_POINTER
|
||||
"INPUT_POINTER = true\n"
|
||||
#else
|
||||
""
|
||||
#endif
|
||||
#if INPUT_SDL2 == 1
|
||||
"INPUT_SDL2 = true\n"
|
||||
#else
|
||||
""
|
||||
#ifdef DUSK_INPUT_TOUCH
|
||||
"INPUT_TOUCH = true\n"
|
||||
#endif
|
||||
);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ typedef framebuffergl_t framebufferplatform_t;
|
||||
#define frameBufferPlatformBind frameBufferGLBind
|
||||
#define frameBufferPlatformClear frameBufferGLClear
|
||||
|
||||
#if DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||
#define frameBufferPlatformInit frameBufferGLInit
|
||||
#define frameBufferPlatformDispose frameBufferGLDispose
|
||||
#endif
|
||||
Reference in New Issue
Block a user