Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NF_CreateTextLayer: Using the same font on two screens causes on one screen to be printed in both screens. #13

Open
BG2CNT opened this issue Jun 16, 2024 · 6 comments

Comments

@BG2CNT
Copy link
Contributor

BG2CNT commented Jun 16, 2024

lets take look at A:

    NF_LoadTextFont("fonts/default","Default",256,256,0);
    NF_CreateTextLayer(0,0,0,"Default");
    NF_CreateTextLayer(1,0,0,"Default");

    NF_WriteText(0,0,0,0,"Made with NFlib 1.1.3");
    NF_WriteText(1,0,0,3,"Made with BlocksDS");
    NF_UpdateTextLayers();

    while(1){
        swiWaitForVBlank();
    }

desmume-screenshot-0
now lets take a look at B:

    NF_LoadTextFont("fonts/default","Default",256,256,0);
    NF_LoadTextFont("fonts/default","sDefault",256,256,0);
    NF_CreateTextLayer(0,0,0,"Default");
    NF_CreateTextLayer(1,0,0,"sDefault");

    NF_WriteText(0,0,0,0,"Made with NFlib 1.1.3");
    NF_WriteText(1,0,0,3,"Made with BlocksDS");
    NF_UpdateTextLayers();

    while(1){
        swiWaitForVBlank();
    }

desmume-screenshot-1

i dont know whats causing this issue, but if i had to guess, its probably this line of code /~https://github.com/knightfox75/nds_nflib/blob/master/source/nf_text.c#L133

@BG2CNT
Copy link
Contributor Author

BG2CNT commented Aug 31, 2024

fundemental flaw with nflib i don't think it can be fixed :/

explanation: text fonts are basically just tiled bgs that are loaded and it's tiles are changed with text, using the same font is basically using the same bg and they first get written to ram and then updated to vram meaning both are messed up :)

@EthGaming101
Copy link

Is there any issue with loading the same text font, but giving it a different name? The text example shows something that might be the solution to that.

@AntonioND
Copy link
Collaborator

That should work, yes.

@BG2CNT
Copy link
Contributor Author

BG2CNT commented Sep 27, 2024

Is there any issue with loading the same text font, but giving it a different name? The text example shows something that might be the solution to that.

no, it works nicely, it just kind of sucks to have to load the same thing again :/

@EthGaming101
Copy link

I'm gonna assume that creating a text font also creates a tile-map in RAM, and writing text to it is just updating that internal tile-map and then writing that to the screen. In that case, the loading also doubles as tile-map allocation, if that makes you feel any better.

@BG2CNT
Copy link
Contributor Author

BG2CNT commented Oct 4, 2024

I'm gonna assume that creating a text font also creates a tile-map in RAM, and writing text to it is just updating that internal tile-map and then writing that to the screen. In that case, the loading also doubles as tile-map allocation, if that makes you feel any better.

yeah it's a fundamental flaw with nflib

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants