Tari: I am sorry if I cannot read error messages, but I tried very hard on this one and all the stuff about "C99 Mode" is really confusing me :-/
Code:
And my code:
Code:
Code:
make
/usr/local/cross/bin/sh3eb-elf-gcc -MMD -MP -MF /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/build/example.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib -I/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/build -I/home/flyingfisch/Desktop/PrizmSDK-0.3/include -c /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c -o example.o
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c: In function 'main':
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:18:2: warning: implicit declaration of function 'AlphaSprite' [-Wimplicit-function-declaration]
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:29:2: warning: 'return' with no value, in function returning non-void [-Wreturn-type]
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:16:6: warning: unused variable 'color' [-Wunused-variable]
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c: In function 'CopySprite':
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:37:4: error: 'for' loop initial declarations are only allowed in C99 mode
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:37:4: note: use option -std=c99 or -std=gnu99 to compile your code
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:38:7: error: 'for' loop initial declarations are only allowed in C99 mode
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c: At top level:
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:45:6: warning: conflicting types for 'AlphaSprite' [enabled by default]
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:18:2: note: previous implicit declaration of 'AlphaSprite' was here
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c: In function 'AlphaSprite':
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:49:5: error: 'for' loop initial declarations are only allowed in C99 mode
/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/nyan/src/example.c:50:8: error: 'for' loop initial declarations are only allowed in C99 mode
make[1]: *** [example.o] Error 1
make: *** [build] Error 2
And my code:
Code:
#include <display_syscalls.h>
#include <keyboard_syscalls.h>
#include <display_syscalls.h>
#include <display.h>
#include <color.h>
#include "data.h"
#define MAGIC_PINK 0xf81f
int LCD_WIDTH_PX = 384;
int LCD_HEIGHT_PX = 216;
int main(void) {
int key;
int color = TEXT_COLOR_BLACK;
AlphaSprite(nyan1, 1, 1, 129, 90, MAGIC_PINK);
Bdisp_PutDisp_DD();
while (1) {
GetKey(&key);
switch (key) {
}
}
return;
}
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;
}
}
void AlphaSprite(short* data, int x, int y, int width, int height, char alpha) {
short* VRAM = (short*)0xA8000000;
int CurColor = 0;
VRAM += (LCD_WIDTH_PX*y)+x;
for(int j=y; j<y+height; j++) {
for(int i=x; i<x+width; i++) {
CurColor = (*(VRAM) + (alpha*(*(data++))/256))/2;
*(VRAM++) = CurColor % (65536);
}
VRAM += (LCD_WIDTH_PX-width);
}
}