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

PRAGMA

Well-Known Member
OP
Member
Joined
Dec 29, 2015
Messages
2,258
Trophies
1
Location
Ireland
Website
github.com
XP
5,036
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,039
Trophies
2
Age
25
Location
https://gs2012.xyz
Website
gs2012.xyz
XP
5,990
Country
Portugal
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?

The screen is always 400x240, right? Or 800x240 for 3D anyway?
 
Last edited by gnmmarechal,

gnmmarechal

Well-Known Member
Member
GBAtemp Patron
Joined
Jul 13, 2014
Messages
6,039
Trophies
2
Age
25
Location
https://gs2012.xyz
Website
gs2012.xyz
XP
5,990
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,258
Trophies
1
Location
Ireland
Website
github.com
XP
5,036
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?
 

gnmmarechal

Well-Known Member
Member
GBAtemp Patron
Joined
Jul 13, 2014
Messages
6,039
Trophies
2
Age
25
Location
https://gs2012.xyz
Website
gs2012.xyz
XP
5,990
Country
Portugal
Ok so the text is lets say 32 width: ({400} - {32} / 2) = 184. That would be the center of the screen right?
I suppose that would indeed be centered.

Edit: check below
 
Last edited by gnmmarechal,

GalladeGuy

Cool and Epic
Member
Joined
Oct 28, 2015
Messages
2,686
Trophies
1
XP
3,105
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

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    SylverReZ @ SylverReZ: @Psionic Roshambo, I always see this dude's shorts, he sounds pretty annoying.