mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-01-22 09:01:57 -05:00
make the UI actually legible on 3DS
This commit is contained in:
parent
258413124e
commit
7ec019cd45
5 changed files with 26 additions and 11 deletions
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -20,6 +20,9 @@ android/app/.externalNativeBuild/
|
||||||
android/local.properties
|
android/local.properties
|
||||||
*.iml
|
*.iml
|
||||||
|
|
||||||
|
# 3DS build results
|
||||||
|
build-3ds/
|
||||||
|
|
||||||
# Build results
|
# Build results
|
||||||
[Dd]ebug/
|
[Dd]ebug/
|
||||||
[Dd]ebugPublic/
|
[Dd]ebugPublic/
|
||||||
|
|
|
@ -47,8 +47,14 @@ static int flagXOffset, flagYOffset;
|
||||||
|
|
||||||
static void HookEvents(void);
|
static void HookEvents(void);
|
||||||
void LBackend_Init(void) {
|
void LBackend_Init(void) {
|
||||||
xBorder = Display_ScaleX(1); xBorder2 = xBorder * 2; xBorder3 = xBorder * 3; xBorder4 = xBorder * 4;
|
xBorder = Display_ScaleX(1);
|
||||||
yBorder = Display_ScaleY(1); yBorder2 = yBorder * 2; yBorder3 = yBorder * 3; yBorder4 = yBorder * 4;
|
yBorder = Display_ScaleY(1);
|
||||||
|
|
||||||
|
if (xBorder < 1) { xBorder = 1; }
|
||||||
|
if (yBorder < 1) { yBorder = 1; }
|
||||||
|
|
||||||
|
xBorder2 = xBorder * 2; xBorder3 = xBorder * 3; xBorder4 = xBorder * 4;
|
||||||
|
yBorder2 = yBorder * 2; yBorder3 = yBorder * 3; yBorder4 = yBorder * 4;
|
||||||
|
|
||||||
xInputOffset = Display_ScaleX(5);
|
xInputOffset = Display_ScaleX(5);
|
||||||
yInputOffset = Display_ScaleY(2);
|
yInputOffset = Display_ScaleY(2);
|
||||||
|
|
|
@ -19,8 +19,14 @@ static int oneX, twoX, fourX;
|
||||||
static int oneY, twoY, fourY;
|
static int oneY, twoY, fourY;
|
||||||
|
|
||||||
void LWidget_CalcOffsets(void) {
|
void LWidget_CalcOffsets(void) {
|
||||||
oneX = Display_ScaleX(1); twoX = oneX * 2; fourX = oneX * 4;
|
oneX = Display_ScaleX(1);
|
||||||
oneY = Display_ScaleY(1); twoY = oneY * 2; fourY = oneY * 4;
|
oneY = Display_ScaleY(1);
|
||||||
|
|
||||||
|
if (oneX < 1) { oneX = 1; }
|
||||||
|
if (oneY < 1) { oneY = 1; }
|
||||||
|
|
||||||
|
twoX = oneX * 2; fourX = oneX * 4;
|
||||||
|
twoY = oneY * 2; fourY = oneY * 4;
|
||||||
|
|
||||||
flagXOffset = Display_ScaleX(2);
|
flagXOffset = Display_ScaleX(2);
|
||||||
flagYOffset = Display_ScaleY(6);
|
flagYOffset = Display_ScaleY(6);
|
||||||
|
|
|
@ -529,7 +529,7 @@ void Launcher_DrawTitle(struct FontDesc* font, const char* text, struct Context2
|
||||||
int x;
|
int x;
|
||||||
|
|
||||||
/* Skip dragging logo when very small window to save space */
|
/* Skip dragging logo when very small window to save space */
|
||||||
if (WindowInfo.Height < 300) return;
|
if (WindowInfo.Height < 240) return;
|
||||||
|
|
||||||
DrawTextArgs_Make(&args, &title, font, false);
|
DrawTextArgs_Make(&args, &title, font, false);
|
||||||
x = ctx->width / 2 - Drawer2D_TextWidth(&args) / 2;
|
x = ctx->width / 2 - Drawer2D_TextWidth(&args) / 2;
|
||||||
|
|
|
@ -18,9 +18,9 @@ static Result irrst_result;
|
||||||
|
|
||||||
struct _DisplayData DisplayInfo;
|
struct _DisplayData DisplayInfo;
|
||||||
struct _WinData WindowInfo;
|
struct _WinData WindowInfo;
|
||||||
// no DPI scaling on 3DS
|
// Render everything at half size due to the small resolution
|
||||||
int Display_ScaleX(int x) { return x; }
|
int Display_ScaleX(int x) { return x / 2; }
|
||||||
int Display_ScaleY(int y) { return y; }
|
int Display_ScaleY(int y) { return y / 2; }
|
||||||
|
|
||||||
|
|
||||||
// Note from https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/gfx.h
|
// Note from https://github.com/devkitPro/libctru/blob/master/libctru/include/3ds/gfx.h
|
||||||
|
@ -42,8 +42,8 @@ void Window_Init(void) {
|
||||||
DisplayInfo.Width = height; // deliberately swapped
|
DisplayInfo.Width = height; // deliberately swapped
|
||||||
DisplayInfo.Height = width; // deliberately swapped
|
DisplayInfo.Height = width; // deliberately swapped
|
||||||
DisplayInfo.Depth = 4; // 32 bit
|
DisplayInfo.Depth = 4; // 32 bit
|
||||||
DisplayInfo.ScaleX = 1;
|
DisplayInfo.ScaleX = 0.5;
|
||||||
DisplayInfo.ScaleY = 1;
|
DisplayInfo.ScaleY = 0.5;
|
||||||
|
|
||||||
WindowInfo.Width = height; // deliberately swapped
|
WindowInfo.Width = height; // deliberately swapped
|
||||||
WindowInfo.Height = width; // deliberately swapped
|
WindowInfo.Height = width; // deliberately swapped
|
||||||
|
@ -277,4 +277,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
||||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||||
return ERR_NOT_SUPPORTED;
|
return ERR_NOT_SUPPORTED;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue