You can help CodeWalrus stay online by donating here. | New CodeWalrus | Old (dark mode) | Old (light) | Discord server

Ivoah's GBA programming thread [GBA]

b/Consoles Started by Ivoah, October 30, 2015, 02:57:24 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

u/alexgt November 02, 2015, 02:55:57 AM
O.O cool
u/Dream of Omnimaga November 02, 2015, 04:08:40 AM
OOh that looks cool. :D Do you think the text speed can be improved?
u/Ivoah November 02, 2015, 04:09:52 AM
Quote from: DJ Omnimaga on November 02, 2015, 04:08:40 AM
OOh that looks cool. :D Do you think the text speed can be improved?

I'm sure it could be improved, but I probably won't bother. Here's the rom for anyone that's interested: https://sr.ht/qrIf.gba
u/Dream of Omnimaga November 02, 2015, 04:27:19 AM
As long as games that you make don't have text this slow I am fine :P (sprite-based games I mean. Imagine if the score took longer to display than the map XD)
u/novenary November 02, 2015, 09:07:55 AM
I suppose this text library uses software rendering which should explain why it's so slow.
u/Dream of Omnimaga November 03, 2015, 04:27:44 AM
YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?
u/Ivoah November 03, 2015, 04:29:49 AM
Quote from: Streetwalrus on November 02, 2015, 09:07:55 AM
I suppose this text library uses software rendering which should explain why it's so slow.

I've changed some code up a bit and now it runs much better:


I replaced
int mvaddch(int y, int x, const char ch)
{
    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%c", y, x, ch);
    return OK;
}

int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;
    for ( ; *str != '\0'; ++str, ++x)
        if (mvaddch(y, x, *str) == ERR)  return ERR;
    return OK;
}


with
int my_mvaddstr(int y, int x, char *str)
{
    for ( ; x < 0; ++x, ++str)
        if (*str == '\0')  return ERR;

    if (x >= COLS || x < 0 || y >= LINES || y < 0) return ERR;
    iprintf("\033[%d;%dH%.*s", y, x, COLS - x, str);

    return OK;
}


Quote from: DJ Omnimaga on November 03, 2015, 04:27:44 AM
YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?

I haven't gotten around to doing anything beyond messing with the text output yet.
Last Edit: November 03, 2015, 04:31:32 AM by Ivoah
u/Dream of Omnimaga November 03, 2015, 06:51:18 AM
I see. By the way nice speed improvement. Does the text engine support background color for individual characters and foreground?
u/novenary November 03, 2015, 11:16:49 AM
I don't think it needs any kind of scrolling routines, the hardware is designed to draw sprites at any place on the screen. If I recall correctly it supports a couple background and map layers, and standalone sprites. So whatever you do it's going to be fast.
u/Dream of Omnimaga November 03, 2015, 06:15:52 PM
Yeah I was wondering because I wasn't sure if redrawing a tilemap every frame caused massive slowdowns.
Website statistics


MyCalcs | Ticalc.org | Cemetech | Omnimaga | TI-Basic Developer | MaxCoderz | TI-Story | Casiocalc.org | Casiopeia | The Museum of HP Calculators | HPCalc.org | CnCalc.org | Music 2000 Community | TI Education | Casio Education | HP Calcs | NumWorks | SwissMicros | Sharp Calculators
Powered by EzPortal