Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

3DS touchscreen controls toggle #2617

Merged
merged 6 commits into from
Sep 2, 2021

Conversation

troybonneau
Copy link
Contributor

Hello! This PR intends to replace the current keyboard on the 3DS touch screen with one that can be toggled. This is accomplished by adding an additional row of buttons and shifting the current interface down a bit. I have this marked WIP because while it is compiling fine I think I am missing a step to get .3dsx files working with the homebrew launcher because it crashes to a black screen on startup. This is my first PR here so any guidance is appreciated! 馃槃

keyboard_on

Creates an additional row of buttons and moves the current interface down.
@Ghabry Ghabry mentioned this pull request Aug 24, 2021
@carstene1ns
Copy link
Member

Good work so far.

What I dislike here is the big top row for just disabling the screen. IMO this should be made smaller, so the others buttons only loose a bit of height, I would suggest around 20-26 pixels.
This complicates the button logic a bit, though.
I have an old branch for this, but unfinished... The top row has additional space for example for a battery indicator and a restart(F11) button.

Code for the battery indicator (drawing in whole, fixed image should be better):

// in anonymous namespace
u8 battery_charging = 0;
u8 battery_level = 0;
u32 c2d_black = C2D_Color32f(0, 0, 0, 1);
u32 c2d_gray = C2D_Color32f(0.8f, 0.8f, 0.8f, 1);
u32 c2d_white = C2D_Color32f(1, 1, 1, 1);
u32 c2d_red = C2D_Color32f(1, 0, 0, 1);
u32 c2d_orange = C2D_Color32f(0, 1, 1, 1);
u32 c2d_green = C2D_Color32f(0, 1, 0, 1);

// in constructor
ptmuInit();

// in destructor
ptmuExit();

// in processEvents()
PTMU_GetBatteryChargeState(&battery_charging);
PTMU_GetBatteryLevel(&battery_level);

// in UpdateDisplay() when drawing on bottom screen
// battery indicator
int battery_x = 296;
int battery_y = 6;
u32 color = c2d_gray;
if (battery_charging) {
    color = c2d_white;
}
C2D_DrawRectSolid(battery_x, battery_y, 0.5f, 18, 8, color);
C2D_DrawRectSolid(battery_x + 18, battery_y + 3, 0.5f, 2, 2, color);
if (battery_level > 4) color = c2d_green;
else if (battery_level > 2) color = c2d_orange;
else color = c2d_red;
for (int i = 0; i < battery_level; i++)
    C2D_DrawRectSolid(battery_x + 2 + i*2 + i, battery_y + 2, 0.5f, 2, 4, color);

@ItsSchoko
Copy link

There were already plans a couple years back...

So, I made some changes, switched the burger menu icon to an off button, changed the font and darkened it a bit.

If there are plans to introduce other buttons/indicators, it shouldn't be a problem to find a visual solution by making the main buttons smaller and have those extra features on top of the screen, or something like that.

(Note: Will have to convert my version to Inkscape sometime.)

easyRPG_3DS_keypad_OriginalPlan_2016
easyRPG_3DS_keypad_flat_2021
easyRPG_3DS_keypad_2021

@Ghabry
Copy link
Member

Ghabry commented Aug 28, 2021

Reset is already mapped to KEY_SELECT.

I like the proposed solution of Schoko for now (the basic version in the middle). I'm a bit worried of users touching this by accident but we have maybe 10 3DS-users, so this shouldn't hurt too many 馃槄

When the battery indicator is ever added this can be still redesigned again (make everything smaller) in a new PR.

@troybonneau
Copy link
Contributor Author

easyrpgkeyboard

I've adjusted the layout and code to work with the proposed basic version in the middle

@Ghabry
Copy link
Member

Ghabry commented Aug 31, 2021

I do not really understand why you created a new image instead of just taking the one from Schoko but okay...

Imo this is now good enough for inclusion, can you mark the PR as ready?

@troybonneau troybonneau marked this pull request as ready for review August 31, 2021 19:15
src/platform/3ds/3ds_ui.cpp Show resolved Hide resolved
src/platform/3ds/3ds_ui.cpp Outdated Show resolved Hide resolved
@Ghabry Ghabry added this to the 0.7.0 milestone Aug 31, 2021
@Ghabry Ghabry added the 3DS label Aug 31, 2021
Copy link
Member

@carstene1ns carstene1ns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay for now.

@Ghabry Ghabry changed the title WIP: 3DS touchscreen controls toggle 3DS touchscreen controls toggle Aug 31, 2021
@Ghabry
Copy link
Member

Ghabry commented Aug 31, 2021

jenkins: test this please

3ds build: https://ci.easyrpg.org/view/Pull%20Requests/job/player-3ds-pr/71/

Variable width buttons no longer needed, button_width can be used in its place.
@carstene1ns
Copy link
Member

Looks good to squash and merge 馃憤馃徏

Copy link
Contributor Author

@troybonneau troybonneau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Alright looks like everything is building well. Ready on my end.

src/platform/3ds/3ds_ui.cpp Show resolved Hide resolved
@fdelapena fdelapena merged commit ffe946b into EasyRPG:master Sep 2, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging this pull request may close these issues.

None yet

5 participants