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 > GBA Input

#75246 - Cooleo - Sat Mar 11, 2006 11:06 am

Im confused Now.This Code:
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 <gba_keys.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
   InitInterrupt();
   SetInterrupt(IE_VBL, Vblank);
   EnableInterrupt(IE_VBL);

   consoleInit( 0 , 4 , 0, NULL , 0 , 15);

   BG_COLORS[0]=RGB8(0,0,0);
   BG_COLORS[241]=RGB5(255,255,255);

   SetMode(MODE_0 | BG0_ON);
   
   // ansi escape sequence to set print co-ordinates
   // /x1b[line;columnH
   iprintf("\x1b[0;0HWinS Command Prompt");
   iprintf("\x1b[1;0HCopyright (C) Mike Miner 2005");
   iprintf("\x1b[3;0HSRAM:");
   
   while (1) {
      VBlankIntrWait();
      ScanKeys();
   }
   if(keyDown(KEY_START))
{
      iprintf("\x1b[3;0HSRAM:");
}
}

Keeps Giving Me

Code:
> "make"
template.c
In file included from c:/devkitPro/examples/gba/template/source/template.c:8:
c:/devkitPro/libgba/include/gba_keys.h:8:22: error: template.c: No such file or directory
c:/devkitPro/libgba/include/gba_keys.h:27:7: warning: no newline at end of file
c:/devkitPro/examples/gba/template/source/template.c: In function 'main':
c:/devkitPro/examples/gba/template/source/template.c:32: warning: large integer implicitly truncated to unsigned type
make[1]: *** [template.o] Error 1
"make": *** [build] Error 2

> Process Exit Code: 2
> Time Taken: 00:00

These errors,i dont know why,can some one help me fix it?

Cooleo
_________________
Flashed DS and stuff for sale:
http://forum.gbadev.org/viewtopic.php?t=9642

#75266 - Miked0801 - Sat Mar 11, 2006 4:36 pm

Guessing a bit but:

1st error A #include'd file within gba_keys doesn't seem to exist. Without seeing the .h file, I'm guessing.

2nd warning - gba_keys.h needs an end_line at the end.
3rd warning:
BG_COLORS[241]=RGB5(255,255,255);

RGB5 returns a 32-bit value. BG_COLORS[] is a 16-bit value. The compiler is warning you that you are losing precision here.

#75328 - wintermute - Sun Mar 12, 2006 6:05 am

gba_keys.h is not a part of libgba, where did you get it from & why is it in the libgba include folder?

As Mike said, gba_keys.h is trying to include something it can't find which appears to be template.c !?

The RGB5 macro compounds 3 5 bit fields into 1 16bit color entry, the values should be in the range 0-15. You either want RGB5(15,15,15) or RGB8(255,255,255) which amount to the same thing .
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#75330 - tepples - Sun Mar 12, 2006 6:07 am

wintermute wrote:
The RGB5 macro compounds 3 5 bit fields into 1 16bit color entry, the values should be in the range 0-15.

It's too dark!

(Isn't it 0 through 31?)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.

#75333 - wintermute - Sun Mar 12, 2006 6:13 am

tepples wrote:
wintermute wrote:
The RGB5 macro compounds 3 5 bit fields into 1 16bit color entry, the values should be in the range 0-15.

It's too dark!

(Isn't it 0 through 31?)


lol, sorry you're quite correct

it's 5am here :P

Have you got some sort of WinterMute error detector going on there? :P
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#75385 - Cooleo - Sun Mar 12, 2006 5:14 pm

Dont worry,I got it fixed on #gbadev :)
_________________
Flashed DS and stuff for sale:
http://forum.gbadev.org/viewtopic.php?t=9642