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.
No, partially, our own stuff, no, and no respectively.
Well I guess I don't need those headers. I can just make some routines, and use other peoples. Thanks though.
*Bump
Icons!
Selected:

Unselected:

What do you guys think? Please comment. I am getting some coding done. Just a little though.
Looks great to me! Have you tried it out on the Prizm to see how it looks? I might mirror the ship/rock to the left side of the icon instead of the right, though, leaving the blank space at right. The letter/number for each add-in is placed at the top-right, so it's better to have that as a blank are of the icon.
Why you don't use more colors ?
Looks great but i agree with purobaz you could use more colors ( but thats just my personal opinion).
And explosions, make sure you have lots of those. They're not too hard to code, really, especially in zero gravity.
And possibly fire, from the ship. Well asteroids is in black and white in its classic form. But I might add color options.
@Kerm: mmhmm it looks good on the Prizm to me. Oh, I didn't think about the numbers/letters because on my Prizm it is past Z so nothing is there. Haha, I might flip it though.
Bump: I am trying to compile for the first time, but the compiler doesn't like this:

Code:

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;

Is there any way I can change this to Prizm acceptable code?
Thanks
You appear to be missing several semicolons.
Tari wrote:
You appear to be missing several semicolons.
Indeed. The other thing I don't like is typedef'ing structs instead of just using struct mystructtype xyz;.
any updates on this project?
Question:

Code:

void keymenu();
int PRGM_GetKey();
int main(void) {   
  while(true) {   
    if(PRGM_GetKey() == KEY_PRGM_MENU) { 
      keymenu();
//main code
    } 
  } 
  return 0; 
}

I was wondering if this is the best way to code. Making a while loop until they push [Menu]. I am not sure how to structure my code. Can someone help? Thanks.
That's usually how I do it.
I am using KermMartians "fillArea" routine, but the compiler seems to not like it. This is what I have:

Code:

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); 
   } 
}

This is what the compiler gave me as error:

Code:

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

If anyone cares to help that would be great, thanks.
Did you forget a semicolon before that function?
What do you mean?
Like in your previous block of code with the structs, you forgot to put semicolons at the end of some lines. I was asking if you did that again, but you didn't post the code before the fillArea function.
Oh... I fixed it, thanks souvik.
Nevermind, I fix that and many more stuff comes up Sad
Here is my code so far, I know not too advanced.

Code:

#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); 
        } 
    } 
}

upon compiling I get these errors. I don't undertand why.

Code:


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 . . .

Sorry about the large amount of code.
  
Register to Join the Conversation
Have your own thoughts to add to this or any other topic? Want to ask a question, offer a suggestion, share your own programs and projects, upload a file to the file archives, get help with calculator and computer programming, or simply chat with like-minded coders and tech and calculator enthusiasts via the site-wide AJAX SAX widget? Registration for a free Cemetech account only takes a minute.

» Go to Registration page
Page 2 of 5
» All times are UTC - 5 Hours
 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

 

Advertisement