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

Discussion in '3DS - Homebrew Development and Emulators' started by ShinyMK, Jul 1, 2016.

  1. ShinyMK
    OP

    ShinyMK known as @PRAGMA

    Member
    6
    Dec 29, 2015
    Ireland
    127.0.0.1
    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?
     
  2. gnmmarechal

    gnmmarechal GBAtemp Guru

    Member
    12
    GBAtemp Patron
    gnmmarechal is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 13, 2014
    Portugal
    https://gs2012.xyz
    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, Jul 1, 2016
  3. ShinyMK
    OP

    ShinyMK known as @PRAGMA

    Member
    6
    Dec 29, 2015
    Ireland
    127.0.0.1
    Correct: ({screen size} - {text x + y} / 2) = Centered Text?
    I believe
    But I just dont know how to get the screen size itself.
     
  4. gnmmarechal

    gnmmarechal GBAtemp Guru

    Member
    12
    GBAtemp Patron
    gnmmarechal is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 13, 2014
    Portugal
    https://gs2012.xyz
    what do you mean get the screen size? It's 400x240 (+ 400x240 for the other "eye" on the 3D)

    — Posts automatically merged - Please don't double post! —

    This is the screen of every 3DS (the 2DS doesn't show the Top Screen right, as it lacks 3D anyway)
    [​IMG]

    Correct me if I am wrong.


    You know the size of the screen is 400*240.
     
  5. ShinyMK
    OP

    ShinyMK known as @PRAGMA

    Member
    6
    Dec 29, 2015
    Ireland
    127.0.0.1
    Ok so the text is lets say 32 width: ({400} - {32} / 2) = 184. That would be the center of the screen right?
     
  6. gnmmarechal

    gnmmarechal GBAtemp Guru

    Member
    12
    GBAtemp Patron
    gnmmarechal is a Patron of GBAtemp and is helping us stay independent!

    Our Patreon
    Jul 13, 2014
    Portugal
    https://gs2012.xyz
    I suppose that would indeed be centered.

    Edit: check below
     
    Last edited by gnmmarechal, Jul 1, 2016
  7. GalladeGuy

    GalladeGuy Freeze Kirby :3

    Member
    9
    Oct 28, 2015
    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
     
    gnmmarechal likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice