The shoutbox is currently out of service. Join us on Discord instead.

Ivoah's GBA programming thread [GBA]

Started by Ivoah, October 30, 2015, 02:57:24 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

alexgt


DJ Omnimaga

OOh that looks cool. :D Do you think the text speed can be improved?

Ivoah

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

DJ Omnimaga

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)

Streetwalrus

I suppose this text library uses software rendering which should explain why it's so slow.

DJ Omnimaga

YEah that could be it. That reminds me, have you gotten any luck displaying sprites, ivoah? Also does the GBA have scrolling routines?

Ivoah

November 03, 2015, 04:29:49 am #21 Last Edit: November 03, 2015, 04:31:32 am by Ivoah
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.

DJ Omnimaga

I see. By the way nice speed improvement. Does the text engine support background color for individual characters and foreground?

Streetwalrus

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.

DJ Omnimaga

Yeah I was wondering because I wasn't sure if redrawing a tilemap every frame caused massive slowdowns.

Powered by EzPortal