I am trying to make a bitmap editor.
here is my code:
#include <color.h>
#include <display.h>
#include <display_syscalls.h>
#include <keyboard.hpp>
#include <keyboard_syscalls.h>
/* USEFUL ROUTINES */
#include "routines.h"
/* FUNCTIONS */
void dispCanvas(int x, int y, int width, int height, int zoom, char canvas) {
for (int i = 0; i < width; i++) {
for (int j = 0; j < height; j++) {
if (canvas[i][j]) {
fillArea(i*zoom+x, j*zoom+y, zoom, zoom, canvas[i][j]);
}
}
}
}
/* MAIN FUNCTION */
int main() {
int key;
int key_dump;
int cursor[2] = {1,1};
int origin[2] = {1,1};
int canvas_height = 8;
int canvas_width = 8;
char canvas[8]<img src='/dot/public/style_emoticons/<#EMO_DIR#>/8.jpg' class='bbc_emoticon' alt='[8]' />;
canvas[0]<img src='/dot/public/style_emoticons/<#EMO_DIR#>/0.jpg' class='bbc_emoticon' alt='[0]' /> = makeColor(255, 100, 0);
canvas[0]<img src='/dot/public/style_emoticons/<#EMO_DIR#>/8.jpg' class='bbc_emoticon' alt='[8]' /> = makeColor(255, 100, 0);
canvas[8]<img src='/dot/public/style_emoticons/<#EMO_DIR#>/0.jpg' class='bbc_emoticon' alt='[0]' /> = makeColor(255, 100, 0);
canvas[8]<img src='/dot/public/style_emoticons/<#EMO_DIR#>/8.jpg' class='bbc_emoticon' alt='[8]' /> = makeColor(255, 100, 0);
/* MAIN LOOP, NEVER BREAK */
while (1) {
/* GETKEY */
/*
switch (PRGM_GetKey()) {
// handle menu
case KEY_PRGM_MENU:
GetKey(&key_dump);
break;
// move cursor
case KEY_PRGM_UP && cursor[0]>0:
cursor[0]--;
break;
case KEY_PRGM_DOWN && cursor[0]<canvas_height:
cursor[0]++;
break;
case KEY_PRGM_LEFT && cursor[1]>0:
cursor[1]--;
break;
case KEY_PRGM_RIGHT && cursor[1]<canvas_width:
cursor[1]++;
break;
}
*/
dispCanvas(origin[0], origin[1], canvas_width, canvas_height, 4, canvas);
}
return 1;
}
And my error.
flyingfisch@Office-Optiplex-745:~/Desktop/PrizmSDK-0.3/projects/paint$ make /usr/local/cross/bin/sh3eb-elf-gcc -MMD -MP -MF /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/build/main.d -Os -Wall -mb -m4a-nofpu -mhitachi -nostdlib -I/home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/build -I/home/flyingfisch/Desktop/PrizmSDK-0.3/include -std=c99 -c /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c -o main.o /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c: In function 'dispCanvas': /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:14:14: error: subscripted value is neither array nor pointer nor vector /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:15:52: error: subscripted value is neither array nor pointer nor vector /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c: In function 'main': /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:63:3: warning: passing argument 6 of 'dispCanvas' makes integer from pointer without a cast [enabled by default] /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:11:6: note: expected 'char' but argument is of type 'char (*)<img src='/dot/public/style_emoticons/<#EMO_DIR#>/8.jpg' class='bbc_emoticon' alt='[8]' />' /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:26:6: warning: unused variable 'cursor' [-Wunused-variable] /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:24:6: warning: unused variable 'key_dump' [-Wunused-variable] /home/flyingfisch/Desktop/PrizmSDK-0.3/projects/paint/src/main.c:23:6: warning: unused variable 'key' [-Wunused-variable] make[1]: *** [main.o] Error 1 make: *** [build] Error 2
Could someone help me figure this out? not sure what a subscripted value is, nor why it can't be int...
(I am very new to C)



