*Bump question
Code:
#include <color.h>
#include <display.h>
#include <display_syscalls.h>
#include <keyboard.hpp>
#include <string.h>
#include <keyboard_syscalls.h>
#include <system.h>
#include <stdlib.h>
#include <stdio.h>
#include "data.h"
#define true 1
#define LCD_WIDTH_PX 384
#define LCD_HEIGHT_PX 216
void CopySprite(const void* data, int x, int y, int width, int height);
int keydownlast(int basic_keycode);
int curX=10;
int curY=10;
int main() {
CopySprite(cursor, curX, curY, 16, 16);
int key;
while(true) {
GetKey(&key);
if (keydownlast(KEY_PRGM_UP) && curY > 8) {
curY = curY-1;
CopySprite(cursor, curX, curY, 16, 16);
} else if (keydownlast(KEY_PRGM_DOWN) && curY < 160) {
curY = curY+1;
CopySprite(cursor, curX, curY, 16, 16);
}
Bdisp_PutDisp_DD();
}
return 0;
}
void CopySprite(const void* datar, int x, int y, int width, int height) {
color_t*data = (color_t*) datar;
color_t* VRAM = (color_t*)0xA8000000;
VRAM += LCD_WIDTH_PX*y + x;
for(int j=y; j<y+height; j++) {
for(int i=x; i<x+width; i++) {
*(VRAM++) = *(data++);
}
VRAM += LCD_WIDTH_PX-width;
}
}
int keydownlast(int basic_keycode) {
int row, col, word, bit;
row = basic_keycode%10;
col = basic_keycode/10-1;
word = row>>1;
bit = col + 8*(row&1);
return (0 != (lastkey[word] & 1<<bit));
}
That is my code so far. Just very primitive cursor movements. But when I try to compile I get this:
Code:
C:\PrizmSDK-0.3\projects\Paint>..\..\bin\make.exe clean
rm -f -fr build C:/PrizmSDK-0.3/projects/Paint/Paint.bin C:/PrizmSDK-0.3/project
s/Paint/Paint.g3a
C:\PrizmSDK-0.3\projects\Paint>..\..\bin\make.exe
sh3eb-elf-gcc -MMD -MP -MF C:/PrizmSDK-0.3/projects/Paint/build/Paint.d -Os -Wal
l -std=c99 -mb -m4a-nofpu -mhitachi -nostdlib -IC:/PrizmSDK-0.3/projects/Paint
/build -IC:/PrizmSDK-0.3/include -c C:/PrizmSDK-0.3/projects/Paint/src/Paint.c -
o Paint.o
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c: In function 'keydownlast':
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:55:18: error: 'lastkey' undeclared (f
irst use in this function)
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:55:18: note: each undeclared identifi
er is reported only once for each function it appears in
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:50:18: warning: variable 'word' set b
ut not used [-Wunused-but-set-variable]
C:/PrizmSDK-0.3/projects/Paint/src/Paint.c:56:1: warning: control reaches end of
non-void function [-Wreturn-type]
make[1]: *** [Paint.o] Error 1
make: *** [build] Error 2
C:\PrizmSDK-0.3\projects\Paint>pause
Press any key to continue . . .
I know I sound very dumb, but what is wrong? :/