Homebrew 3DS Textstuff fooling around

thekman

Well-Known Member
OP
Newcomer
Joined
Dec 3, 2014
Messages
52
Trophies
0
Age
26
XP
65
Country
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.​
 

Attachments

  • example.zip
    97.1 KB · Views: 129

thekman

Well-Known Member
OP
Newcomer
Joined
Dec 3, 2014
Messages
52
Trophies
0
Age
26
XP
65
Country
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
 

thekman

Well-Known Member
OP
Newcomer
Joined
Dec 3, 2014
Messages
52
Trophies
0
Age
26
XP
65
Country
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?
 

Cyan

GBATemp's lurking knight
Former Staff
Joined
Oct 27, 2002
Messages
23,749
Trophies
4
Age
46
Location
Engine room, learning
XP
15,662
Country
France
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.
 
  • Like
Reactions: thekman

Site & Scene News

Popular threads in this forum

General chit-chat
Help Users
  • No one is chatting at the moment.
    K3Nv2 @ K3Nv2: https://youtube.com/shorts/FdYTKAVSsXY?si=9E-2AU0JN-4hRZi3