Jo Engine  9
Jo Sega Saturn Engine
Macros | Functions
map.h File Reference

Jo Engine MAP file (sprite map) More...

Go to the source code of this file.

Macros

#define JO_MAP_NO_COLLISION
 Value returned by jo_map_hitbox_detection_custom_boundaries();. More...
 

Functions

int jo_map_per_pixel_vertical_collision (const unsigned int layer, int x, int y, unsigned char *attribute)
 Method to get vertical distance between our point (x, y) and the surface of the map (example: hill) More...
 
int jo_map_hitbox_detection_custom_boundaries (const unsigned int layer, const int x, const int y, const int w, const int h)
 Fast method to get if a square intersects with the map (HitBox processing) based on screen coord. More...
 
bool jo_map_create (const unsigned int layer, const unsigned short max_tile_count, const short depth)
 Create a new sprite map. More...
 
void jo_map_add_tile (const unsigned int layer, const short x, const short y, const unsigned char sprite_id, const unsigned char attribute)
 Add a tile on the specific layer. More...
 
void jo_map_add_animated_tile (const unsigned int layer, const short x, const short y, const unsigned char anim_id, const unsigned char attribute)
 Add an animated tile on the specific layer. More...
 
void jo_map_free (const unsigned int layer)
 Destroy the specific layer. More...
 
void jo_map_draw (const unsigned int layer, const short screen_x, const short screen_y)
 Display the specific layer. More...
 
void jo_map_draw_background (const unsigned int layer, const short x, const short y)
 Draw the specific layer on the background. More...
 
void jo_map_move_tiles_by_attribute (const unsigned int layer, const unsigned char attribute_filter, const short incr_x, const short incr_y)
 Move specific tiles by their attributes. More...
 
void jo_map_3d_draw (const unsigned int layer, const int x, const int y, const int z)
 

Detailed Description

Jo Engine MAP file (sprite map)

Author
Johannes Fetz
Bug:
No known bugs.

Macro Definition Documentation

#define JO_MAP_NO_COLLISION

Value returned by jo_map_hitbox_detection_custom_boundaries();.

Warning
Don't change this value

Function Documentation

void jo_map_3d_draw ( const unsigned int  layer,
const int  x,
const int  y,
const int  z 
)
void jo_map_add_animated_tile ( const unsigned int  layer,
const short  x,
const short  y,
const unsigned char  anim_id,
const unsigned char  attribute 
)

Add an animated tile on the specific layer.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
xhorizontal position on the map
yvertical position on the map
anim_idAnimation ID
attributeUser attribute (it's for you)
void jo_map_add_tile ( const unsigned int  layer,
const short  x,
const short  y,
const unsigned char  sprite_id,
const unsigned char  attribute 
)

Add a tile on the specific layer.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
xhorizontal position on the map
yvertical position on the map
sprite_idSprite ID
attributeUser attribute (it's for you)
bool jo_map_create ( const unsigned int  layer,
const unsigned short  max_tile_count,
const short  depth 
)

Create a new sprite map.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
max_tile_countMaximum tile count in the entire map
depthZ index (ex 500)
Returns
true if successful otherwise false (use jo_get_last_error())
void jo_map_draw ( const unsigned int  layer,
const short  screen_x,
const short  screen_y 
)

Display the specific layer.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
screen_xrelative horizontal position between the screen and the map
screen_yrelative vertical position between the screen and the map
void jo_map_draw_background ( const unsigned int  layer,
const short  x,
const short  y 
)

Draw the specific layer on the background.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
xrelative horizontal position between the background image and the map
yrelative vertical position between the background image and the map
void jo_map_free ( const unsigned int  layer)

Destroy the specific layer.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
int jo_map_hitbox_detection_custom_boundaries ( const unsigned int  layer,
const int  x,
const int  y,
const int  w,
const int  h 
)

Fast method to get if a square intersects with the map (HitBox processing) based on screen coord.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
xHorizontal position of square (based on the screen !, so 0 is the left the screen)
yVertical position of square (based on the screen !, so 0 is the top the screen)
wWidth of the square
hHeight of the square
Returns
The attribute of the tile if square collides otherwise JO_MAP_NO_COLLISION
void jo_map_move_tiles_by_attribute ( const unsigned int  layer,
const unsigned char  attribute_filter,
const short  incr_x,
const short  incr_y 
)

Move specific tiles by their attributes.

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
attribute_filterTile attribute value (filtering)
incr_xHorizontal position incrementation
incr_yVertical position incrementation
int jo_map_per_pixel_vertical_collision ( const unsigned int  layer,
int  x,
int  y,
unsigned char *  attribute 
)

Method to get vertical distance between our point (x, y) and the surface of the map (example: hill)

Parameters
layerlayer level (between 0 and JO_MAP_MAX_LAYER)
xHorizontal position of the point (based on the screen !, so 0 is the left the screen)
yVertical position of the point (based on the screen !, so 0 is the top the screen)
attributeTile attribute
Remarks
(x,y)
# | #
### | ##
##### v ##
####### ####
##############
Returns
distance from the surface of the map otherwise JO_MAP_NO_COLLISION
Warning
if distance > 0 then you don't touch the ground but your are on the sprite
if distance <= 0 then you are under the surface of the sprite
Don't use this method if you don't have transparent pixel or if the surface is concave