| Last change
                  on this file since 694 was
                  683,
                  checked in by guerin, 10 years ago | 
        
          | 
raycast: initial distributed implementation
 
The main task runs on processor (0,0,0). It manages game logic andinitialization, and participates in the rendering process.
 The render task runs on all other processors. It tries to render a frame
 slice when available, which is raycasting + pixel drawing for a pixel
 column of the frame.
 
 | 
        | File size:
            639 bytes | 
      
      
        
  | Line |  | 
|---|
| 1 | #ifndef __GAME_H | 
|---|
| 2 | #define __GAME_H | 
|---|
| 3 |  | 
|---|
| 4 | #include <stdint.h> | 
|---|
| 5 | #include <stdbool.h> | 
|---|
| 6 |  | 
|---|
| 7 | #define M_PI            (3.14159f) | 
|---|
| 8 | #define COLLIDE_GAP     (0.2f) | 
|---|
| 9 | #define PLAYER_MOVE     (0.13f) | 
|---|
| 10 | #define PLAYER_ROT      (0.1f) | 
|---|
| 11 | #define TIME_TOTAL      (30) | 
|---|
| 12 |  | 
|---|
| 13 | typedef struct | 
|---|
| 14 | { | 
|---|
| 15 | float x; | 
|---|
| 16 | float y; | 
|---|
| 17 | float dir; | 
|---|
| 18 | } Player; | 
|---|
| 19 |  | 
|---|
| 20 | typedef struct | 
|---|
| 21 | { | 
|---|
| 22 | uint8_t tile[10][10]; | 
|---|
| 23 | uint8_t w; | 
|---|
| 24 | uint8_t h; | 
|---|
| 25 | float startX; | 
|---|
| 26 | float startY; | 
|---|
| 27 | float startDir; | 
|---|
| 28 | } Map; | 
|---|
| 29 |  | 
|---|
| 30 | typedef struct | 
|---|
| 31 | { | 
|---|
| 32 | Player player; | 
|---|
| 33 | Map *map; | 
|---|
| 34 | int mapId; | 
|---|
| 35 | int timeLeft; | 
|---|
| 36 | } Game; | 
|---|
| 37 |  | 
|---|
| 38 | int gameLocate(int x, int y); | 
|---|
| 39 | void gameRun(); | 
|---|
| 40 | void gameTick(); | 
|---|
| 41 | Game *gameInstance(); | 
|---|
| 42 |  | 
|---|
| 43 | #endif // __GAME_H | 
|---|
       
      
      Note: See 
TracBrowser
        for help on using the repository browser.