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

  • Thread starter Thread starter pman152
  • Start date Start date
  • Views Views 1,094
  • Replies Replies 6

pman152

Well-Known Member
Member
Joined
Dec 29, 2015
Messages
2,262
Reaction score
1,448
Trophies
2
XP
5,148
Country
United States
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?
 
hum, it doesn't matter afaik, both XL and non-XL have the same resolution? When printing text, don't you use (x,y) coordinates where x and y are in pixels?
Correct: ({screen size} - {text x + y} / 2) = Centered Text?
I believe
But I just dont know how to get the screen size itself.
 
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.
 
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?
 
@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

Site & Scene News

Popular threads in this forum