Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include "types.h"
- // useful macro for encoding single bits
- #define BIT( X ) (1<<(X))
- // map bit codes
- const uint8 cQUpper = BIT( 0 ); // can push up
- const uint8 cQLower = BIT( 1 ); // can push down
- const uint8 cQLeft = BIT( 2 ); // can push left
- const uint8 cQRight = BIT( 3 ); // can push right
- const uint8 cWall = BIT( 7 ); // is a wall
- //
- struct sCollideMap
- {
- // map size and scale
- uint32 width, height;
- uint32 tileSize;
- // tile data encoded as above
- uint8 *data;
- };
- //
- struct sCollideObject
- {
- // rectangle area
- sint32 x1, y1, x2, y2;
- // resolution vector
- sint32 r_x, r_y;
- };
- // check for a collision between and object and the map
- extern bool collide_test
- (
- sCollideMap *map,
- sCollideObject *object
- );
- // preprocess a map with bit encoded gradients
- extern void collide_preprocess
- (
- sCollideMap *map
- );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement