gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Beginners > getting started

#143028 - meshounah - Tue Oct 16, 2007 4:23 am

ok i'm really serious about gba dev now... i have the following example code but there is a few places i don't understand.

Code:
#include <gba_console.h>
#include <gba_video.h>
#include <gba_interrupt.h>
#include <gba_systemcalls.h>
#include <gba_input.h>
#include <stdio.h>
#include <stdlib.h>

int frame = 0;

void Vblank() {

   frame++;
}
//---------------------------------------------------------------------------------
// Program entry point
//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------


   // the vblank interrupt must be enabled for VBlankIntrWait() to work
   // since the default dispatcher handles the bios flags no vblank handler
   // is required
   irqInit();
   irqSet(IRQ_VBLANK, Vblank);
   irqEnable(IRQ_VBLANK);
    /////////////////////////////////////////////////////////////////////////////
   consoleInit( 0 , 4 , 0, NULL , 0 , 15);

   BG_COLORS[0]=RGB8(58,110,165);
   BG_COLORS[241]=RGB5(31,31,31);

   SetMode(MODE_0 | BG0_ON);
    /////////////////////////////////////////////////////////////////////////////
   // ansi escape sequence to set print co-ordinates
   // /x1b[line;columnH
   iprintf("\x1b[10;10HHello World!\n");
   iprintf("%x",malloc(200));
   while (1) {
      VBlankIntrWait();
      scanKeys();

   }
}


the stuff between the //////////////////////////// is what i don't understand
_________________
My Blog

#143044 - Lick - Tue Oct 16, 2007 10:14 am

Code:
   consoleInit(0, 4, 0, NULL, 0, 15); // Initialize libgba's console

   BG_COLORS[0] = RGB8(58,110,165); // Set backgroundpalette colors
   BG_COLORS[241] = RGB5(31,31,31); // Probably used by the console

   SetMode(MODE_0 | BG0_ON); // Set the mode of the 2D engine

_________________
http://licklick.wordpress.com

#143061 - meshounah - Tue Oct 16, 2007 1:38 pm

ok i understand now thanks
_________________
My Blog

#143106 - meshounah - Tue Oct 16, 2007 10:47 pm

ok another question how can i waste cpu cycles?
_________________
My Blog

#143107 - keldon - Tue Oct 16, 2007 11:08 pm

Why would you want to "waste" CPU cycles?

#143112 - meshounah - Tue Oct 16, 2007 11:56 pm

because loops will run at full speed.
_________________
My Blog

#143116 - gmiller - Wed Oct 17, 2007 12:07 am

The routine "VBlankIntrWait();" will wait till the next VBlank interval so it will slow your code to 60 frames per sec or at least till the next 60th of a sec. You should avoid changing video memory till the blank interval to avoid visual artifacts.

#143201 - meshounah - Thu Oct 18, 2007 3:09 am

ok another question is what is the best map editor and bitmap to sprite converter? Just want other people's opinions.
_________________
My Blog

#143205 - tepples - Thu Oct 18, 2007 4:01 am

My opinion is that the best map editor is the one you write yourself specifically for your game. You could even write a map editor within the game engine that outputs to SRAM or libfat.

But before you write a map editor, you need to think about how you will be representing maps. There are two schools of thought on how to do this. One school states that a map should consist of objects, which have a type, length, and width. Super Mario World uses this, and if your engine uses this, your editor will look sort of like Lunar Magic or a vector graphics program. The other school is that a map is a direct 2D array of metatiles. An editor for this will look like the built-in editor of Lode Runner or a paint program.

As for bitmap to sprite converter, what do you want it to be able to do?
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#143219 - meshounah - Thu Oct 18, 2007 1:35 pm

as for sprite maker I would like it to just make static images(I'll animate in the game)
_________________
My Blog

#143226 - gauauu - Thu Oct 18, 2007 2:34 pm

There's plenty of tools out there that convert graphics to gba format...you then use your own code to make "sprites" out of it.

My favorite is Usenti and Grit, but there are plenty of others...