[ADD] sprites .h and .c files for loading sprites
This commit is contained in:
3
.gitignore
vendored
3
.gitignore
vendored
@@ -75,7 +75,8 @@ CMakeUserPresets.json
|
|||||||
*-prefix/
|
*-prefix/
|
||||||
|
|
||||||
### vscode ###
|
### vscode ###
|
||||||
.vscode/*
|
.vscode/
|
||||||
|
.vscode/**
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
!.vscode/launch.json
|
!.vscode/launch.json
|
||||||
|
|||||||
16
src/sprites/sprites.c
Normal file
16
src/sprites/sprites.c
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
#include <psp2/ctrl.h>
|
||||||
|
#include <psp2/kernel/processmgr.h>
|
||||||
|
|
||||||
|
#include <vita2d.h>
|
||||||
|
|
||||||
|
#include "sprites.h"
|
||||||
|
|
||||||
|
#define printf psvDebugScreenPrintf
|
||||||
|
|
||||||
|
void sprites_draw_bullet(BULLET *bullet)
|
||||||
|
{
|
||||||
|
if (bullet->active)
|
||||||
|
{
|
||||||
|
vita2d_draw_rectangle(bullet->x, bullet->y, (float)5, (float)10, bullet->color);
|
||||||
|
}
|
||||||
|
}
|
||||||
30
src/sprites/sprites.h
Normal file
30
src/sprites/sprites.h
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
#ifndef SPRITES_H
|
||||||
|
#define SPRITES_H
|
||||||
|
|
||||||
|
//TODO draw main player sprite
|
||||||
|
typedef struct player_sprite_t
|
||||||
|
{
|
||||||
|
/* data */
|
||||||
|
} PLAYER;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief a struct that holds a bullet sprite, basically a rectangle
|
||||||
|
* there will be at most a few bullets available
|
||||||
|
*/
|
||||||
|
typedef struct bullet_sprite_t
|
||||||
|
{
|
||||||
|
size_t active; // whether or not the bullet should be drawn (0 or 1)
|
||||||
|
float x; // the x position
|
||||||
|
float y; // the y position
|
||||||
|
unsigned int color; // color of the bullet
|
||||||
|
} BULLET;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief function that draws the given bullet, if it is active
|
||||||
|
*
|
||||||
|
* @param bullet the bullet struct pointer that points to the bullet that should be drawn
|
||||||
|
*/
|
||||||
|
void sprites_draw_bullet(BULLET *bullet);
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
||||||
Reference in New Issue
Block a user