2018-01-22 23:50:08 +08:00
|
|
|
#ifndef COMMON_H
|
|
|
|
#define COMMON_H
|
|
|
|
|
|
|
|
#include <SDL2/SDL_stdinc.h>
|
|
|
|
|
2018-03-25 21:23:00 +08:00
|
|
|
#define ARRAY_LEN(a) (sizeof(a) / sizeof(a[0]))
|
2018-01-22 23:50:08 +08:00
|
|
|
#define MIN(X,Y) (X) < (Y) ? (X) : (Y)
|
|
|
|
#define MAX(X,Y) (X) > (Y) ? (X) : (Y)
|
|
|
|
|
|
|
|
struct size {
|
|
|
|
Uint16 width;
|
|
|
|
Uint16 height;
|
|
|
|
};
|
|
|
|
|
2018-01-29 21:52:22 +08:00
|
|
|
struct point {
|
2018-01-22 23:50:08 +08:00
|
|
|
Uint16 x;
|
|
|
|
Uint16 y;
|
|
|
|
};
|
|
|
|
|
2018-01-29 21:52:22 +08:00
|
|
|
struct position {
|
2018-01-22 23:50:08 +08:00
|
|
|
// The video screen size may be different from the real device screen size,
|
|
|
|
// so store to which size the absolute position apply, to scale it accordingly.
|
|
|
|
struct size screen_size;
|
2018-01-29 21:52:22 +08:00
|
|
|
struct point point;
|
2018-01-22 23:50:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|