define {Int,Float}Rect in terms of offset and extent

This commit is contained in:
Andrei Alexeyev 2019-04-11 12:30:20 +03:00
parent eea6aa094c
commit 874da52127
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
3 changed files with 38 additions and 8 deletions

View file

@ -72,6 +72,10 @@ enum {
GAMEOVER_SCORE_DELAY = 60,
};
#define VIEWPORT_OFFSET { VIEWPORT_X, VIEWPORT_Y }
#define VIEWPORT_SIZE { VIEWPORT_W, VIEWPORT_H }
#define VIEWPORT_RECT { VIEWPORT_X, VIEWPORT_Y, VIEWPORT_W, VIEWPORT_H }
typedef enum GameoverType {
GAMEOVER_NONE,
GAMEOVER_DEFEAT = 1,

View file

@ -11,18 +11,42 @@
#include "taisei.h"
typedef struct FloatOffset {
float x, y;
} FloatOffset;
typedef struct FloatExtent {
float w, h;
} FloatExtent;
typedef struct FloatRect {
float x;
float y;
float w;
float h;
union {
FloatOffset offset;
struct { float x, y; };
};
union {
FloatExtent extent;
struct { float w, h; };
};
} FloatRect;
typedef struct IntOffset {
int x, y;
} IntOffset;
typedef struct IntExtent {
int w, h;
} IntExtent;
typedef struct IntRect {
int x;
int y;
int w;
int h;
union {
IntOffset offset;
struct { int x, y; };
};
union {
IntExtent extent;
struct { int w, h; };
};
} IntRect;
typedef struct Ellipse {

View file

@ -28,6 +28,8 @@ enum {
SCREEN_H = 600,
};
#define SCREEN_SIZE { SCREEN_W, SCREEN_H }
typedef struct VideoMode {
int width;
int height;