Homebrew Devkit - Centering Text on screen/XL/Non-XL Screen Sizes?

PRAGMA

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
2,247
Trophies
1
Location
Ireland
Website
github.com
XP
4,936
Country
Ireland
So basically I need to find a way to center text on the Top screen and the Bottom screen.

Is there any function to get the screens size, As using that info I could just do:
({size} - {Text's Size} / 2) and that would then be the position of the center right?
 

gnmmarechal

Well-Known Member
Member
GBAtemp Patron
Joined
Jul 13, 2014
Messages
6,001
Trophies
2
Age
24
Location
https://gs2012.xyz
Website
gs2012.xyz
XP
5,673
Country
Portugal
Correct: ({screen size} - {text x + y} / 2) = Centered Text?
I believe
But I just dont know how to get the screen size itself.
what do you mean get the screen size? It's 400x240 (+ 400x240 for the other "eye" on the 3D)

--------------------- MERGED ---------------------------

This is the screen of every 3DS (the 2DS doesn't show the Top Screen right, as it lacks 3D anyway)
1ba55a6a36684ed0af53c434e21757f9.png


Correct me if I am wrong.


You know the size of the screen is 400*240.
 

PRAGMA

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
2,247
Trophies
1
Location
Ireland
Website
github.com
XP
4,936
Country
Ireland
what do you mean get the screen size? It's 400x240 (+ 400x240 for the other "eye" on the 3D)

--------------------- MERGED ---------------------------

This is the screen of every 3DS (the 2DS doesn't show the Top Screen right, as it lacks 3D anyway)
1ba55a6a36684ed0af53c434e21757f9.png


Correct me if I am wrong.


You know the size of the screen is 400*240.
Ok so the text is lets say 32 width: ({400} - {32} / 2) = 184. That would be the center of the screen right?
 

GalladeGuy

Cool and Epic
Member
Joined
Oct 28, 2015
Messages
2,687
Trophies
1
XP
2,945
Country
United States
@ShinyMK I think the algorithm would be this:

For the top screen:
x = (400 - width) / 2
y = (240 - (height of font * number of rows of text)) / 2

For the bottom screen:
x = (320 - width) / 2
y = (240 - (height of font * number of rows of text)) / 2
 
  • Like
Reactions: gnmmarechal
General chit-chat
Help Users
    SylverReZ @ SylverReZ: Hope they made lots of spaget