Homebrew Regarding windows in the 3DS console...

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
27
XP
76
Country
United States
The example regarding splitting the top screen into 2 separate windows in devkitPro is a great start for something I'm wanting to accomplish, but I'm afraid I don't understand some things.

1. In the example, the author only initializes the top screen console, and splits it into two windows. The code is as follows:
Code:
//In this example we need three PrintConsole, one for each window and one for the whole top screen

PrintConsole leftWindow, rightWindow, topScreen;

//Initialize console for each window

consoleInit(GFX_TOP, &leftWindow);
consoleInit(GFX_TOP, &rightWindow);
consoleInit(GFX_TOP, &topScreen);

How exactly would I type the PrintConsole and consoleinit sections if I wanted to put four different windows, in a 2x2 configuration, on the bottom screen? The top screen is also going to be used in the final product.


2. If I were to do this 2x2 configuration, what exactly would the dimensions be? The example is as follows:
Code:
//Now we specify the window position and dimension for each console window using consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
//x, y, width and height are in terms of cells, not pixel, where each cell is composed by 8x8 pixels.

consoleSetWindow(&leftWindow, 1, 1, 23, 28);
consoleSetWindow(&rightWindow, 26, 1, 23, 28);

I guess I just don't completely understand the numbers.


I would greatly appreciate it if someone would shed some light on the subject. And please, be gentle. I'm just getting started. :wacko:
 
  • Like
Reactions: Arubaro

benjymous

Member
Newcomer
Joined
Feb 26, 2015
Messages
14
Trophies
0
Age
44
XP
93
Country
Yup, that's easy enough:

Code:
    PrintConsole topleftWindow, toprightWindow, bottomleftWindow, bottomrightWindow, topScreen;

    //Initialize console for each window
    consoleInit(GFX_TOP, &topleftWindow);
    consoleInit(GFX_TOP, &toprightWindow);
    consoleInit(GFX_TOP, &bottomleftWindow);
    consoleInit(GFX_TOP, &bottomrightWindow);
    consoleInit(GFX_TOP, &topScreen);

    //Now we specify the window position and dimension for each console window using consoleSetWindow(PrintConsole* console, int x, int y, int width, int height);
    //x, y, width and height are in terms of cells, not pixel, where each cell is composed by 8x8 pixels.
    consoleSetWindow(&topleftWindow, 1, 1, 23, 14);
    consoleSetWindow(&toprightWindow, 26, 1, 23, 14);
    consoleSetWindow(&bottomleftWindow, 1, 15, 23, 14);
    consoleSetWindow(&bottomrightWindow, 26, 15, 23, 14);

    //Before doing any text printing we should select the PrintConsole in which we are willing to write, otherwise the library will print on the last selected/initialized one
    //Let's start by printing something on the top left windown
    consoleSelect(&topleftWindow);
    printf("This text is in the top left window!\n");
    printf("3DS rocks!!!\n");

    //Now write something else on the top right
    consoleSelect(&toprightWindow);
    printf("This text is in the top right window!\n");
    printf("This thing works pretty well!\n");

    // bottom left
    consoleSelect(&bottomleftWindow);
    printf("bottom left ftw!\n");
    printf("hello world!\n");
 
    // bottom right
    consoleSelect(&bottomrightWindow);
    printf("bottom right!\n");
    printf("yay!\n");

I've attached the full example
 

Attachments

  • multiple-windows-text-2.zip
    98.8 KB · Views: 217

benjymous

Member
Newcomer
Joined
Feb 26, 2015
Messages
14
Trophies
0
Age
44
XP
93
Country
the key part is:

Code:
consoleSetWindow(&topleftWindow, 1, 1, 23, 14);

which breaks down to

Code:
consoleSetWindow(&windowHandle, left, top, width, height);

left and top are the top left corner of the window, and width and height define how big the window should be. These are in character cells, which are multiples of 8 pixels.
 

pengawill

Member
OP
Newcomer
Joined
Sep 15, 2015
Messages
10
Trophies
0
Age
27
XP
76
Country
United States
the key part is:

Code:
consoleSetWindow(&topleftWindow, 1, 1, 23, 14);

which breaks down to

Code:
consoleSetWindow(&windowHandle, left, top, width, height);

left and top are the top left corner of the window, and width and height define how big the window should be. These are in character cells, which are multiples of 8 pixels.

After looking over your examples and the explanations, and checking over the original examples again, I totally understand. Thanks so much for the help!
 

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
    Psionic Roshambo @ Psionic Roshambo: https://www.youtube.com/@legolambs