3DS Textstuff fooling around

Discussion in '3DS - Homebrew Development and Emulators' started by thekman, Dec 3, 2014.

  1. thekman
    OP

    thekman Advanced Member

    Newcomer
    52
    12
    Dec 3, 2014
    Canada
    I was using https://gbatemp.net/threads/textstuff-for-homebrew-development-library.374887/ and I came upon this while fooling around with making the text move with the arrow keys. I know it's not anything important, I'm just posting it because I thought it was pretty cool how it drew onto the other screen if I moved the O out of the top screen.​
    Oh and this is my first post on GBATemp, I decided to finally make an account after lurking here for quite awhile.​
     

    Attached Files:

  2. jonthedit

    jonthedit GBAtemp Advanced Maniac

    Member
    1,691
    438
    May 30, 2011
    Bangladesh
    Glad to see people taking an interest in 3DS development! :)

    Welcome to the temp!
     
  3. Jayro

    Jayro MediCat USB and Mini Windows 10 Developer

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

    Our Patreon
    5,228
    2,865
    Jul 23, 2012
    United States
    Octo Canyon
    Which emulator is better at the moment, 3dmoo or citra?
     
  4. thekman
    OP

    thekman Advanced Member

    Newcomer
    52
    12
    Dec 3, 2014
    Canada
    Sofar, I have found that 3dmoo has more capabilities with what I have been emulating anyway.
    And thanks for the welcome jonthedit !

    EDIT: by capabilities, I mean the file extensions that I see more often, and have used way more. Also, I'm pretty sure that the code for 3dmoo is more mature, but I could be wrong. It's able to emulate Yeti3D faster than Citra :D
     
  5. thekman
    OP

    thekman Advanced Member

    Newcomer
    52
    12
    Dec 3, 2014
    Canada
    Hi guys, so pretty much I am trying to figure out how to make it so when I press the R trigger or L trigger, it changes the colour of the text that I print called "colour" which changes colour depending on which number it's on. I am a super noob, and I am trying to use my sub-basic knowledge in Java to do this, so any help will be greatly appreciated. I am using https://gbatemp.net/threads/textstuff-for-homebrew-development-library.374887/ for the text. Also, if anyone could explain how to use the "o" as a cursor, that would be greatly appreciated. (for example, you hover over a certain area, it doesn't draw until you hold the "A" button, which then it print's "o"s over anywhere that the "o" has been) Hopefully that makes sense... there is also a video to elaborate. Only the first part of the video show's what I mean by a cursor, and the second part where it draws all over the second screen(due to some sort of glitch? lol) is what I am trying to accomplish.​

    Code:
    #include <3ds.h>
    #include "memory.h"
     
     
    int main()
    {
        // Initialize services
        srvInit();
        aptInit();
        hidInit(NULL);
        gfxInit();
        //gfxSet3D(true); // uncomment if using stereoscopic 3D
        int x = 50;
        int y = 50;
        int R, G, B;
        int numColour = 1;
     
        char* a = "o";
     
        // Main loop
        while (aptMainLoop())
        {
            gspWaitForVBlank();
            hidScanInput();
         
         
            // Your code goes here
     
            u32 kDown = hidKeysDown();
            u32 kHeld = hidKeysHeld();
            if (kDown & KEY_START) break; // break in order to return to hbmenu
     
            // Example rendering code that displays some text
            // Please note that the 3DS screens are sideways (thus 240x400 and 240x320)
            u8* fb = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
            memset(fb, 0, 240*400*3);
         
         
            if (kHeld & KEY_DUP){
                y++;
                //y++;
                //y++;
            }
            if (kHeld & KEY_DDOWN){
                y--;
                //y--;
                //y--;
            }
            if (kHeld & KEY_DRIGHT){
                x++;
                //x++;
                //x++;
            }
            if (kHeld & KEY_DLEFT){
                x--;
                //x--;
                //x--;
            }
            /*========numColour: 0 = White, 1 = Red, 2 = Blue, 3 = Green, 4 = Yellow======== +1*/
            if (kDown & KEY_R){ //Colours rotate right
                numColour++;
                if ((numColour = 6)){
                    numColour = 1;
                }
            }
            if (kDown & KEY_L){ //Colours rotate left
                numColour--;
                if ((numColour = 0)){
                    numColour = 5;
                }
            }
            if((numColour = 1)){ //White
                R = 255;
                G = 255;
                B = 255;
                paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
            }
            else if((numColour = 2)){ //Red
                R = 255;
                G = 0;
                B = 0;
                paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
            }
            else if((numColour = 3)){ //Blue
                R = 0;
                G = 0;
                B = 255;
                paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
            }
            else if((numColour = 4)){ //Green
                R = 0;
                G = 204;
                B = 0;
                paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
            }
            else if((numColour = 5)){ //Yellow
                R = 255;
                G = 255;
                B = 0;
                paint_word(fb, "colour",/*x*/0,/*y*/230, R, G, B);
            }
            paint_word(fb, a, x, y, 255, 255, 255);
            // Flush and swap framebuffers
            gfxFlushBuffers();
            gfxSwapBuffers();
        }
     
        // Exit services
        gfxExit();
        hidExit();
        aptExit();
        srvExit();
        return 0;
    }
    
    In order to accomplish that would I do kUp instead of kDown?
     
  6. Cyan

    Cyan GBATemp's lurking knight

    Global Moderator
    18,749
    9,035
    Oct 27, 2002
    France
    Engine room, learning
    I merged your two threads together.
    They are about the same thing so please keep it in the same place.
    Creating a new topic for every question will be harder to get an answer, users won't be able to follow your previous work and issues.

    Thanks.
     
    thekman likes this.