Duet/src/duet.h

87 lines
1.5 KiB
C

#pragma once
#include <gint/defs/types.h>
#include <stdint.h>
#include <stdbool.h>
#include <gint/display.h>
#define __BSD_VISIBLE 1
#include <math.h>
//---
// Level strucutres
//---
typedef enum {
Shape_Square = 0,
Shape_SmallBar = 2,
Shape_MediumBar = 3,
Shape_NormalBar = 4,
Shape_LongBar = 5,
Shape_HugeBar = 6,
} shape_t;
typedef enum {
Action_Normal = 0,
Action_RotateLeft = 1,
Action_RotateRight = 2,
Action_Speed = 3,
Action_FadeOut = 4,
Action_OuterRotateLeft = 5,
Action_OuterRotateRIght = 6,
Action_Slide = 7,
} action_t;
typedef enum {
Position_Left = 0,
Position_Right = 1,
Position_Middle = 2
} position_t;
typedef struct {
int time;
shape_t shape;
position_t position;
action_t action;
} rectmeta_t;
typedef struct {
float tempo;
rectmeta_t *blocks;
} level_t;
//---
// Game
//---
typedef struct {
float w, h; /* px */
float x, y; /* px */
float vx, vy; /* px/s */
float r; /* rad */
float vr; /* rad/s */
} rect_t;
#define RECT_TABLE_SIZE 20
struct game {
int dead;
float time;
level_t *level;
rect_t table[RECT_TABLE_SIZE];
int cursor;
float player_rota;
};
//---
// Rendering
//---
void dcircle(int x, int y, int r, int color, bool fill);
void dtriangle(int x1, int y1, int x2, int y2, int x3, int y3, int color);
void drectoid(rect_t const *r, int color);