Add scene scaling
This commit is contained in:
Binary file not shown.
Binary file not shown.
@@ -31,6 +31,14 @@
|
|||||||
10,
|
10,
|
||||||
0
|
0
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"file": "house_5_2.dmf",
|
||||||
|
"pos": [
|
||||||
|
13,
|
||||||
|
6,
|
||||||
|
0
|
||||||
|
]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"tiles": [
|
"tiles": [
|
||||||
@@ -907,33 +915,6 @@
|
|||||||
"type": 1,
|
"type": 1,
|
||||||
"tile": 0
|
"tile": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
13,
|
|
||||||
6,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
14,
|
|
||||||
6,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
15,
|
|
||||||
6,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"pos": [
|
"pos": [
|
||||||
0,
|
0,
|
||||||
@@ -1051,33 +1032,6 @@
|
|||||||
"type": 1,
|
"type": 1,
|
||||||
"tile": 0
|
"tile": 0
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
13,
|
|
||||||
7,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
14,
|
|
||||||
7,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"pos": [
|
|
||||||
15,
|
|
||||||
7,
|
|
||||||
0
|
|
||||||
],
|
|
||||||
"type": 1,
|
|
||||||
"tile": 0
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"pos": [
|
"pos": [
|
||||||
0,
|
0,
|
||||||
|
|||||||
@@ -33,6 +33,10 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef DUSK_DISPLAY_SCALE
|
||||||
|
#define DUSK_DISPLAY_SCALE 1
|
||||||
|
#endif
|
||||||
|
|
||||||
// Main Display Struct, platform-speicifc
|
// Main Display Struct, platform-speicifc
|
||||||
typedef displayplatform_t display_t;
|
typedef displayplatform_t display_t;
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ const screencropaspectinfo_t SCREEN_CROP_ASPECTS[SCREEN_CROP_ASPECT_COUNT] = {
|
|||||||
errorret_t screenInit() {
|
errorret_t screenInit() {
|
||||||
memoryZero(&SCREEN, sizeof(screen_t));
|
memoryZero(&SCREEN, sizeof(screen_t));
|
||||||
|
|
||||||
|
SCREEN.scale = DUSK_DISPLAY_SCALE;
|
||||||
SCREEN.background = COLOR_CORNFLOWER_BLUE;
|
SCREEN.background = COLOR_CORNFLOWER_BLUE;
|
||||||
|
|
||||||
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
#ifdef DUSK_DISPLAY_SIZE_DYNAMIC
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#include "dusk.h"
|
#include "dusk.h"
|
||||||
|
#include "display/display.h"
|
||||||
#include "display/framebuffer/framebuffer.h"
|
#include "display/framebuffer/framebuffer.h"
|
||||||
#include "display/mesh/quad.h"
|
#include "display/mesh/quad.h"
|
||||||
#include "display/color.h"
|
#include "display/color.h"
|
||||||
@@ -58,6 +59,7 @@ typedef enum {
|
|||||||
// } screenscalemode_t;
|
// } screenscalemode_t;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
int32_t scale;
|
||||||
screenmode_t mode;
|
screenmode_t mode;
|
||||||
// screenscalemode_t scaleMode;
|
// screenscalemode_t scaleMode;
|
||||||
|
|
||||||
|
|||||||
@@ -85,7 +85,7 @@ errorret_t sceneOverworldRender(scenedata_t *sceneData) {
|
|||||||
|
|
||||||
// Camera Eye
|
// Camera Eye
|
||||||
float_t pixelsPerUnit = TILE_SIZE_PIXELS;
|
float_t pixelsPerUnit = TILE_SIZE_PIXELS;
|
||||||
float_t worldH = (float_t)SCREEN.height / pixelsPerUnit;
|
float_t worldH = (float_t)(SCREEN.height / SCREEN.scale) / pixelsPerUnit;
|
||||||
float_t z = (worldH * 0.5f) / tanf(fov * 0.5f);
|
float_t z = (worldH * 0.5f) / tanf(fov * 0.5f);
|
||||||
vec3 worldPosVec;
|
vec3 worldPosVec;
|
||||||
rpgCameraGetPosition(worldPosVec);
|
rpgCameraGetPosition(worldPosVec);
|
||||||
|
|||||||
@@ -73,8 +73,8 @@ errorret_t sceneRender(void) {
|
|||||||
errorChain(shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_MODEL, ident));
|
errorChain(shaderSetMatrix(&SHADER_UNLIT, SHADER_UNLIT_MODEL, ident));
|
||||||
|
|
||||||
glm_ortho(
|
glm_ortho(
|
||||||
0.0f, SCREEN.width,
|
0.0f, (float_t)(SCREEN.width / SCREEN.scale),
|
||||||
SCREEN.height, 0.0f,
|
(float_t)(SCREEN.height / SCREEN.scale), 0.0f,
|
||||||
0.1f, 100.0f,
|
0.1f, 100.0f,
|
||||||
proj
|
proj
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define DUSK_DISPLAY_SCALE 2
|
||||||
#include "displaydolphin.h"
|
#include "displaydolphin.h"
|
||||||
|
|
||||||
#define displayPlatformInit displayInitDolphin
|
#define displayPlatformInit displayInitDolphin
|
||||||
|
|||||||
@@ -6,6 +6,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define DUSK_DISPLAY_SCALE 2
|
||||||
#include "display/displaysdl2.h"
|
#include "display/displaysdl2.h"
|
||||||
|
|
||||||
typedef displaysdl2_t displayplatform_t;
|
typedef displaysdl2_t displayplatform_t;
|
||||||
|
|||||||
Reference in New Issue
Block a user