35#ifndef __JO_SPRITES_H__
36# define __JO_SPRITES_H__
65void jo_sprite_draw(
const int sprite_id,
const jo_pos3D *
const pos,
const bool centered_style_coordinates,
const bool billboard);
69void jo_sprite_draw_rotate(
const int sprite_id,
const jo_pos3D *
const pos,
const int angle,
const bool centered_style_coordinates,
const bool billboard);
74 __jo_sprite_pos.
x = x;
75 __jo_sprite_pos.
y = y;
76 __jo_sprite_pos.
z = z;
134int __jo_sprite_add_4bits(
const void *
const pixels,
const unsigned short width,
const unsigned short height,
const unsigned short lut);
176# ifdef JO_COMPILE_WITH_SPRITE_HASHTABLE
281# define JO_NO_GOURAUD_COLOR (0xc210)
318# define JO_DEFAULT_BRIGHTNESS (16)
321# define JO_MAX_BRIGHTNESS (31)
376# define JO_NO_ZOOM (65536)
542void jo_sprite_set_clipping_area(
const unsigned int x,
const unsigned int y,
const unsigned int width,
const unsigned int height,
const int depth);
569 return (data[x + y * image_width]);
581 return (data[x + y * image_width]);
#define JO_COLOR_Transparent
Transparent color.
Definition colors.h:87
#define JO_MULT_BY_256(X)
Multiply a variable by 256.
Definition math.h:111
static __jo_force_inline jo_fixed jo_float2fixed(const float x)
Convert float to jo engine fixed (avoid usage of GCC Soft Float).
Definition math.h:497
#define JO_REMOVE_FLAG(BYTEFIELD, FLAG)
Remove flag in bytefield.
Definition math.h:372
#define JO_ADD_FLAG(BYTEFIELD, FLAG)
Add flag in bytefield.
Definition math.h:366
void jo_sprite_draw(const int sprite_id, const jo_pos3D *const pos, const bool centered_style_coordinates, const bool billboard)
(internal engine usage)
void jo_set_gouraud_shading_colors(const jo_color topleft_color, const jo_color topright_color, const jo_color bottomright_color, const jo_color bottomleft_color)
Change Gouraud Shading colors.
unsigned int jo_sprite_free_memory(void)
Get the free sprite memory (VDP1 VRAM).
void jo_set_gouraud_shading_brightness(const unsigned char brightness)
Change Gouraud Shading brightness.
void jo_sprite_free_from(const int sprite_id)
Free all sprites from the given sprite_id.
static __jo_force_inline void jo_sprite_disable_vertical_flip(void)
Disable vertical flip for every sprite displayed after this call.
Definition sprites.h:346
static __jo_force_inline void jo_sprite_draw3D_and_rotate(const int sprite_id, const int x, const int y, const int z, const int angle)
Display a sprite in 3 dimensional space.
Definition sprites.h:449
void jo_sprite_set_system_clipping_area(const unsigned int width, const unsigned int height)
Set the VDP1 drawing area (system clipping).
jo_texture_definition __jo_sprite_def[JO_MAX_SPRITE]
(internal engine usage)
static __jo_force_inline void jo_sprite_enable_horizontal_flip(void)
Activate horizontal flip for every sprite displayed after this call.
Definition sprites.h:352
int jo_sprite_name2id(const char *const filename)
Retrive the Sprite Id from filename based on the four first character in the filename.
static __jo_force_inline int jo_sprite_count(void)
Get sprite count.
Definition sprites.h:636
static __jo_force_inline unsigned char jo_sprite_get_pixel_palette_index(const unsigned char *const data, const unsigned int x, const unsigned int y, const unsigned int image_width)
Get a specific pixel palette index from image bytes.
Definition sprites.h:579
int jo_sprite_replace(const jo_img *const img, const int sprite_id)
Replace a sprite.
static __jo_force_inline bool jo_sprite_is_pixel_transparent(const jo_color *const data, const unsigned int x, const unsigned int y, const unsigned int image_width)
Get if a specific pixel is transparent (JO_COLOR_Transparent) in image bytes.
Definition sprites.h:592
static __jo_force_inline void jo_sprite_draw3D(const int sprite_id, const int x, const int y, const int z)
Display a sprite in 3 dimensional space.
Definition sprites.h:462
void jo_sprite_set_clipping_area(const unsigned int x, const unsigned int y, const unsigned int width, const unsigned int height, const int depth)
Set user clipping area.
static __jo_force_inline void jo_sprite_enable_clipping(bool outside)
Activate sprite clipping for every sprite displayed after this call.
Definition sprites.h:522
static __jo_force_inline void jo_sprite_draw3D2(const int sprite_id, const int x, const int y, const int z)
Display a sprite in 3 dimensional space.
Definition sprites.h:489
static __jo_force_inline void jo_sprite_set_additive_palette(int palette_id)
Change palette for every 8 bits sprite displayed after this call: their light is added to the image u...
Definition sprites.h:436
void jo_sprite_draw_rotated_fixed(const int sprite_id, const jo_fixed x, const jo_fixed y, const jo_fixed z, const jo_fixed half_width, const jo_fixed half_height, const int angle)
Display a sprite turned on the screen (any angle: the 4 corners are computed, the sprite is distorted...
int jo_sprite_usage_percent(void)
Get sprite memory usage.
static __jo_force_inline void jo_sprite_disable_clipping(void)
Disable sprite clipping for every sprite displayed after this call.
Definition sprites.h:529
static __jo_force_inline void jo_sprite_disable_screen_doors_filter(void)
Disable screen doors filter for every sprite displayed after this call.
Definition sprites.h:207
static __jo_force_inline int jo_sprite_get_width(const int sprite_id)
Get sprite width.
Definition sprites.h:601
jo_picture_definition __jo_sprite_pic[JO_MAX_SPRITE]
(internal engine usage)
static __jo_force_inline void jo_sprite_disable_gouraud_shading(void)
Disable Gouraud Shading for every sprite displayed after this call.
Definition sprites.h:303
static __jo_force_inline void jo_sprite_change_sprite_scale_xy(const float scale_x, const float scale_y)
Change scale for every sprite displayed after this call.
Definition sprites.h:391
static __jo_force_inline void jo_sprite_change_sprite_scale(const float scale)
Change scale for every sprite displayed after this call.
Definition sprites.h:381
int jo_sprite_add(const jo_img *const img)
Add a sprite.
static __jo_force_inline void jo_sprite_change_sprite_scale_xy_fixed(const jo_fixed scale_x, const jo_fixed scale_y)
Change scale for every sprite displayed after this call using fixed number.
Definition sprites.h:401
static __jo_force_inline void jo_sprite_restore_sprite_scale(void)
Restore default scale for every sprite displayed after this call.
Definition sprites.h:409
static __jo_force_inline void jo_sprite_disable_horizontal_flip(void)
Disable horizontal flip for every sprite displayed after this call.
Definition sprites.h:359
static __jo_force_inline void jo_sprite_set_palette(int palette_id)
Change palette for every 8 bits sprite displayed after this call.
Definition sprites.h:427
int __jo_sprite_replace(const jo_img *const img, const int sprite_id, const bool async)
Replace a sprite (internal usage).
static __jo_force_inline int jo_sprite_get_height(const int sprite_id)
Get sprite height.
Definition sprites.h:610
static __jo_force_inline void __internal_jo_sprite_set_position3D(const int x, const int y, const int z)
Internal usage don't use it.
Definition sprites.h:71
int jo_sprite_add_image_4bits_lut(const jo_img *const img)
Add an RGB image of 14 colors at most (the index 15 is the end code of the VDP1) as a 16 colors textu...
void jo_sprite_draw_rotate(const int sprite_id, const jo_pos3D *const pos, const int angle, const bool centered_style_coordinates, const bool billboard)
(internal engine usage)
static __jo_force_inline void jo_sprite_enable_vertical_flip(void)
Activate vertical flip for every sprite displayed after this call.
Definition sprites.h:339
static __jo_force_inline void jo_sprite_disable_half_transparency(void)
Disable half transparency for every sprite displayed after this call.
Definition sprites.h:225
unsigned short __jo_sprite_lut[JO_MAX_SPRITE]
(internal engine usage) Color lookup table of a 16 colors texture (VRAM address / 8),...
static __jo_force_inline void jo_sprite_set_gouraud_table(const unsigned short table)
Gouraud table of the sprites displayed after this call with jo_sprite_enable_gouraud_shading() (inste...
Definition sprites.h:312
jo_sprite_attributes __jo_sprite_attributes
Current displayed sprite attribute (internal engine usage).
static __jo_force_inline jo_color jo_sprite_get_pixel_color(const jo_color *const data, const unsigned int x, const unsigned int y, const unsigned int image_width)
Get a specific pixel color from image bytes.
Definition sprites.h:567
bool jo_sprite_add_end_codes(const int sprite_id)
Write the VDP1 end codes after the last visible pixel of each line of a sprite (RGB sprites).
static __jo_force_inline void jo_sprite_enable_half_transparency(void)
Activate half transparency for every sprite displayed after this call.
Definition sprites.h:218
static __jo_force_inline void * jo_sprite_get_raw_data(const int sprite_id)
Get sprite raw image contents.
Definition sprites.h:619
static __jo_force_inline void jo_sprite_free_all(void)
Free all sprites.
Definition sprites.h:171
int jo_sprite_add_4bits_lut(const unsigned char *const pixels, const unsigned short width, const unsigned short height, const jo_color *const lut)
Add a 16 colors texture with its color lookup table: 4 bits per pixel (4 times less VRAM than an RGB ...
int jo_get_last_sprite_id(void)
Get last Sprite Id.
static __jo_force_inline void jo_sprite_disable_shadow_filter(void)
Disable shadow filter for every sprite displayed after this call.
Definition sprites.h:248
int jo_sprite_add_8bits_image(const jo_img_8bits *const img)
Add a 8 bits sprite.
static __jo_force_inline void jo_sprite_enable_screen_doors_filter(void)
Activate screen doors filter for every sprite displayed after this call.
Definition sprites.h:200
#define JO_NO_ZOOM
Value used to keep the original scale (1.0 in jo_fixed).
Definition sprites.h:376
static __jo_force_inline void jo_sprite_enable_gouraud_shading(void)
Activate Gouraud Shading for every sprite displayed after this call.
Definition sprites.h:296
static __jo_force_inline void jo_sprite_enable_dark_filter(void)
Activate dark filter for every sprite displayed after this call.
Definition sprites.h:259
static __jo_force_inline void jo_sprite_enable_shadow_filter(void)
Activate shadow filter for every sprite displayed after this call.
Definition sprites.h:241
static __jo_force_inline void jo_sprite_disable_dark_filter(void)
Disable dark filter for every sprite displayed after this call.
Definition sprites.h:266
static __jo_force_inline void jo_sprite_draw3D_and_rotate2(const int sprite_id, const int x, const int y, const int z, const int angle)
Display a sprite in 3 dimensional space.
Definition sprites.h:476
void jo_sprite_draw_4p_fixed(const int sprite_id, const jo_pos2D_fixed *const four_points, const jo_fixed z, const bool centered_style_coordinates)
int __jo_sprite_add_4bits(const void *const pixels, const unsigned short width, const unsigned short height, const unsigned short lut)
Add a 16 colors texture that uses the color lookup table of another one (internal engine usage: small...
#define __jo_force_inline
force inline attribute (and prevent Doxygen prototype parsing bug)
Definition types.h:39
int y
Definition types.h:76
unsigned int color_table_index
Definition types.h:274
unsigned short jo_color
15 bits color type
Definition types.h:42
unsigned short effect
Definition types.h:272
unsigned int clipping
Definition types.h:278
jo_fixed fixed_scale_y
Definition types.h:277
int jo_fixed
Fixed point Q16.16 number.
Definition types.h:48
int x
Definition types.h:75
int z
Definition types.h:77
unsigned int gouraud_shading_index
Definition types.h:275
unsigned short direction
Definition types.h:273
jo_fixed fixed_scale_x
Definition types.h:276
15 bits image struct
Definition types.h:231
8 bits image struct
Definition types.h:239
Picture definition.
Definition types.h:223
2D position using fixed number
Definition types.h:65
3D position
Definition types.h:74
Sprite attributes.
Definition types.h:271
Texture definition.
Definition types.h:214
#define JO_VDP1_NO_WINDOW
No clipping window.
Definition vdp1_command_pipeline.h:128
#define JO_VDP1_WINDOW_IN
Draw inside the user clipping area.
Definition vdp1_command_pipeline.h:130
#define JO_VDP1_WINDOW_OUT
Draw outside the user clipping area.
Definition vdp1_command_pipeline.h:132