Code:
#include <stdio.h>
#include <math.h>
#include <graphics.h>
#include <conio.h>
#include <dos.h>
Are there any include (header) equivelents to the above in Prizm C?
Thanks.
#include <stdio.h>
#include <math.h>
#include <graphics.h>
#include <conio.h>
#include <dos.h>
typedef struct
{
int NumPoints;
POINT Point[3];
} SHAPE;
typedef struct
{
POINT Loc; //location
int ViewAngle //Angle facing
POINT Direction; //Direction moving
SHAPE Shape; //Shape of object
Shape Screen //Points it occupies on screen
} OBJECT;
void keymenu();
int PRGM_GetKey();
int main(void) {
while(true) {
if(PRGM_GetKey() == KEY_PRGM_MENU) {
keymenu();
//main code
}
}
return 0;
}
void fillArea(int x, int y, int width, int height, int color) {
//only use lower two bytes of color
char* VRAM = (char*)0xA8000000;
VRAM += 2*(LCD_WIDTH_PX*y + x);
for(int j=y; j<y+height; j++) {
for(int i=x; i<x+width; i++) {
*(VRAM++) = (color&0x0000FF00)>>8;
*(VRAM++) = (color&0x000000FF);
}
VRAM += 2*(LCD_WIDTH_PX-width);
}
}
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c: In function 'fillArea':
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:34:16: error: expected '=', ',', ';
', 'asm' or '__attribute__' before '{' token
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:47:16: error: expected '=', ',', ';
', 'asm' or '__attribute__' before '{' token
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:59:63: error: expected '=', ',', ';
', 'asm' or '__attribute__' before '{' token
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:72:58: error: expected '=', ',', ';
', 'asm' or '__attribute__' before '{' token
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:19:6: error: old-style parameter declarations in prototyped function definition
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:108:1: error: expected '{' at end o
f input
make[1]: *** [Src.o] Error 1
make: *** [build] Error 2
#include "color.h"
#include "display_syscalls.h"
#define LCD_WIDTH_PX 396
#define LCD_HEIGHT_PX 224
#define PIOVERTWO 1.570796327f
#define PI 3.141592654f
#define PISQUARED 9.869604401f
#define __cosf(x) __sinf((PIOVERTWO)+(x))
#define msinf __sinf
#define mcosf __cosf
#define mtanf __tan
float __sinf(float);
float __tanf(float);
void drawLine(int x1, int y1, int x2, int y2, int color);
void Init(void);
void Init_Level(void);
void fillArea(int x, int y, int width, int height, int color);
//Ship Coordinates
int Ship_1X;
int Ship_1Y;
int Ship_2X;
int Ship_2Y;
int Ship_3X;
int Ship_3Y;
//Movement
int X_Move;
int Y_Move;
void keymenu();
int PRGM_GetKey();
int main(void) {
fillArea(0,0,395,223,COLOR_BLACK);
drawline(Ship_1X, Ship_1Y, Ship_3X, Ship_3Y, COLOR_BLUE);
drawline(Ship_2X, Ship_2Y, Ship_3X, Ship_3Y, COLOR_BLUE);
drawline(Ship_1X, Ship_1Y, Ship_2X, Ship_2Y, COLOR_BLUE);
Bdisp_PutDisp_DD( void );
while(true) {
if(PRGM_GetKey() == KEY_PRGM_MENU) {
keymenu();
}
}
return 0;
}
void Init(void){
Ship_1X=198;
Ship_1Y=112;
Ship_2X=198;
Ship_2Y=130;
Ship_3X=222;
Ship_3Y=207;
X_Move=0;
Y_Move=0;
}
//fills a rectangular area of (width,height) with upper-left
//corner at (x,y) with color color
void fillArea(int x, int y, int width, int height, int color) {
//only use lower two bytes of color
char* VRAM = (char*)0xA8000000;
VRAM += 2*(LCD_WIDTH_PX*y + x);
for(int j=y; j<y+height; j++) {
for(int i=x; i<x+width; i++) {
*(VRAM++) = (color&0x0000FF00)>>8;
*(VRAM++) = (color&0x000000FF);
}
VRAM += 2*(LCD_WIDTH_PX-width);
}
}
//Uses the Bresenham line algorithm
void drawLine(int x1, int y1, int x2, int y2, int color) {
signed char ix;
signed char iy;
// if x1 == x2 or y1 == y2, then it does not matter what we set here
int delta_x = (x2 > x1?(ix = 1, x2 - x1):(ix = -1, x1 - x2)) << 1;
int delta_y = (y2 > y1?(iy = 1, y2 - y1):(iy = -1, y1 - y2)) << 1;
plot(x1, y1, color);
if (delta_x >= delta_y) {
int error = delta_y - (delta_x >> 1); // error may go below zero
while (x1 != x2) {
if (error >= 0) {
if (error || (ix > 0)) {
y1 += iy;
error -= delta_x;
} // else do nothing
} // else do nothing
x1 += ix;
error += delta_y;
plot(x1, y1, color);
}
} else {
int error = delta_x - (delta_y >> 1); // error may go below zero
while (y1 != y2) {
if (error >= 0) {
if (error || (iy > 0)) {
x1 += ix;
error -= delta_y;
} // else do nothing
} // else do nothing
y1 += iy;
error += delta_x;
plot(x1, y1, color);
}
}
}
C:\PrizmSDK-0.3\projects\Asteroids>..\..\bin\make.exe
sh3eb-elf-gcc -MMD -MP -MF C:/PrizmSDK-0.3/projects/Asteroids/build/Src.d -Os -W
all -mb -m4a-nofpu -mhitachi -nostdlib -IC:/PrizmSDK-0.3/projects/Asteroids/bu
ild -IC:/PrizmSDK-0.3/include -c C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c -o
Src.o
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c: In function 'main':
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:36:2: warning: implicit declaration
of function 'drawline' [-Wimplicit-function-declaration]
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:39:20: error: expected expression b
efore 'void'
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:39:20: error: too many arguments to
function 'Bdisp_PutDisp_DD'
C:/PrizmSDK-0.3/include/display_syscalls.h:23:6: note: declared here
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:40:9: error: 'true' undeclared (fir
st use in this function)
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:40:9: note: each undeclared identif
ier is reported only once for each function it appears in
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:41:25: error: 'KEY_PRGM_MENU' undec
lared (first use in this function)
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c: In function 'fillArea':
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:63:4: error: 'for' loop initial dec
larations are only allowed in C99 mode
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:63:4: note: use option -std=c99 or
-std=gnu99 to compile your code
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:64:7: error: 'for' loop initial dec
larations are only allowed in C99 mode
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c: In function 'drawLine':
C:/PrizmSDK-0.3/projects/Asteroids/src/Src.c:80:4: warning: implicit declaration
of function 'plot' [-Wimplicit-function-declaration]
make[1]: *** [Src.o] Error 1
make: *** [build] Error 2
C:\PrizmSDK-0.3\projects\Asteroids>pause
Press any key to continue . . .
Advertisement