mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-15 02:25:32 -04:00
Merge pull request #1134 from camthehaxman/3ds
make the UI actually legible on 3DS
This commit is contained in:
commit
cdbe0d77f1
3
.gitignore
vendored
3
.gitignore
vendored
@ -20,6 +20,9 @@ android/app/.externalNativeBuild/
|
||||
android/local.properties
|
||||
*.iml
|
||||
|
||||
# 3DS build results
|
||||
build-3ds/
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
|
@ -47,8 +47,14 @@ static int flagXOffset, flagYOffset;
|
||||
|
||||
static void HookEvents(void);
|
||||
void LBackend_Init(void) {
|
||||
xBorder = Display_ScaleX(1); xBorder2 = xBorder * 2; xBorder3 = xBorder * 3; xBorder4 = xBorder * 4;
|
||||
yBorder = Display_ScaleY(1); yBorder2 = yBorder * 2; yBorder3 = yBorder * 3; yBorder4 = yBorder * 4;
|
||||
xBorder = Display_ScaleX(1);
|
||||
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);
|
||||
yInputOffset = Display_ScaleY(2);
|
||||
|
@ -19,8 +19,14 @@ static int oneX, twoX, fourX;
|
||||
static int oneY, twoY, fourY;
|
||||
|
||||
void LWidget_CalcOffsets(void) {
|
||||
oneX = Display_ScaleX(1); twoX = oneX * 2; fourX = oneX * 4;
|
||||
oneY = Display_ScaleY(1); twoY = oneY * 2; fourY = oneY * 4;
|
||||
oneX = Display_ScaleX(1);
|
||||
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);
|
||||
flagYOffset = Display_ScaleY(6);
|
||||
|
@ -529,7 +529,7 @@ void Launcher_DrawTitle(struct FontDesc* font, const char* text, struct Context2
|
||||
int x;
|
||||
|
||||
/* 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);
|
||||
x = ctx->width / 2 - Drawer2D_TextWidth(&args) / 2;
|
||||
|
@ -18,9 +18,9 @@ static Result irrst_result;
|
||||
|
||||
struct _DisplayData DisplayInfo;
|
||||
struct _WinData WindowInfo;
|
||||
// no DPI scaling on 3DS
|
||||
int Display_ScaleX(int x) { return x; }
|
||||
int Display_ScaleY(int y) { return y; }
|
||||
// Render everything at half size due to the small resolution
|
||||
int Display_ScaleX(int x) { return x / 2; }
|
||||
int Display_ScaleY(int y) { return y / 2; }
|
||||
|
||||
|
||||
// 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.Height = width; // deliberately swapped
|
||||
DisplayInfo.Depth = 4; // 32 bit
|
||||
DisplayInfo.ScaleX = 1;
|
||||
DisplayInfo.ScaleY = 1;
|
||||
DisplayInfo.ScaleX = 0.5;
|
||||
DisplayInfo.ScaleY = 0.5;
|
||||
|
||||
WindowInfo.Width = height; // deliberately swapped
|
||||
WindowInfo.Height = width; // deliberately swapped
|
||||
@ -101,7 +101,7 @@ static void HandleButtons(u32 mods) {
|
||||
|
||||
static void ProcessJoystickInput(circlePosition* pos, double delta) {
|
||||
float scale = (delta * 60.0) / 8.0f;
|
||||
|
||||
|
||||
// May not be exactly 0 on actual hardware
|
||||
if (Math_AbsI(pos->dx) <= 16) pos->dx = 0;
|
||||
if (Math_AbsI(pos->dy) <= 16) pos->dy = 0;
|
||||
@ -148,7 +148,6 @@ void Window_ProcessEvents(double delta) {
|
||||
hidCircleRead(&pos);
|
||||
ProcessJoystickInput(&pos, delta);
|
||||
}
|
||||
|
||||
if (Input.RawMode && irrst_result == 0) {
|
||||
circlePosition pos;
|
||||
irrstScanInput();
|
||||
@ -277,4 +276,4 @@ cc_result Window_OpenFileDialog(const struct OpenFileDialogArgs* args) {
|
||||
cc_result Window_SaveFileDialog(const struct SaveFileDialogArgs* args) {
|
||||
return ERR_NOT_SUPPORTED;
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user