first commit
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#ifndef CARD_H
|
||||
#define CARD_H
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
#include "sprite.h"
|
||||
|
||||
// Card suits
|
||||
#define HEARTS 0
|
||||
#define DIAMONDS 1
|
||||
#define CLUBS 2
|
||||
#define SPADES 2
|
||||
|
||||
// Card ranks
|
||||
#define TWO 0
|
||||
#define THREE 1
|
||||
#define FOUR 2
|
||||
#define FIVE 3
|
||||
#define SIX 4
|
||||
#define SEVEN 5
|
||||
#define EIGHT 6
|
||||
#define NINE 7
|
||||
#define TEN 8
|
||||
#define JACK 9
|
||||
#define QUEEN 10
|
||||
#define KING 11
|
||||
#define ACE 12
|
||||
|
||||
typedef struct
|
||||
{
|
||||
u8 suit;
|
||||
u8 rank;
|
||||
} Card;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
Card *card;
|
||||
Sprite *sprite;
|
||||
FIXED x, y; // position
|
||||
FIXED vx, vy; // velocity
|
||||
bool selected;
|
||||
} CardObject;
|
||||
|
||||
// Card methods
|
||||
Card *card_new(u8 suit, u8 rank);
|
||||
void card_destroy(Card **card);
|
||||
|
||||
// CardObject methods
|
||||
CardObject *card_object_new(Card *card);
|
||||
void card_object_destroy(CardObject **card_object);
|
||||
|
||||
// Card functions
|
||||
void card_init();
|
||||
void card_update();
|
||||
void card_draw();
|
||||
|
||||
// Hand functions
|
||||
void hand_index(int index); // This makes the card at the given index the one that's being looked at
|
||||
void hand_select(); // This lets the player select the card they're looking at for the next action
|
||||
void hand_change_sort(); // This sorts the hand by suit or rank
|
||||
|
||||
#endif // CARD_H
|
||||
@@ -0,0 +1,8 @@
|
||||
#ifndef GAME_H
|
||||
#define GAME_H
|
||||
|
||||
// Game functions
|
||||
void game_init();
|
||||
void game_update();
|
||||
|
||||
#endif // GAME_H
|
||||
@@ -0,0 +1,30 @@
|
||||
#ifndef SPRITE_H
|
||||
#define SPRITE_H
|
||||
|
||||
#include <tonc.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
OBJ_ATTR *obj;
|
||||
OBJ_AFFINE *aff;
|
||||
u32 tid, pb;
|
||||
POINT pos;
|
||||
} Sprite;
|
||||
|
||||
// Sprite methods
|
||||
Sprite *sprite_new(u16 a0, u16 a1, u32 tid, u32 pb, int sprite_index);
|
||||
Sprite *affine_sprite_new(u16 a0, u16 a1, u32 tid, u32 pb);
|
||||
void sprite_destroy(Sprite **sprite);
|
||||
INLINE void sprite_position(Sprite *sprite, int x, int y)
|
||||
{
|
||||
sprite->pos.x = x;
|
||||
sprite->pos.y = y;
|
||||
|
||||
obj_set_pos(sprite->obj, x, y);
|
||||
}
|
||||
|
||||
// Sprite functions
|
||||
void sprite_init();
|
||||
void sprite_draw();
|
||||
|
||||
#endif // SPRITE_H
|
||||
Reference in New Issue
Block a user