blobwarsAttrition/src/structs.h

115 lines
2.3 KiB
C

/*
Copyright (C) 2018 Parallel Realities
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
typedef struct Texture Texture;
typedef struct Lookup Lookup;
typedef struct Entity Entity;
typedef struct {
int debug;
int takeScreenshots;
char *screenshotFolder;
int noAIWeapons;
int showFPS;
int playerImmortal;
int playerUnlimitedMissiles;
int noEntityActions;
int allImmortal;
int fps;
} Dev;
struct Texture {
char name[MAX_DESCRIPTION_LENGTH];
long hash;
long ttl;
SDL_Texture *texture;
Texture *next;
};
typedef struct {
SDL_Color red;
SDL_Color orange;
SDL_Color yellow;
SDL_Color green;
SDL_Color blue;
SDL_Color cyan;
SDL_Color purple;
SDL_Color white;
SDL_Color black;
SDL_Color lightGrey;
SDL_Color darkGrey;
} Colors;
struct Lookup {
char name[MAX_NAME_LENGTH];
long value;
Lookup *next;
};
typedef struct {
void (*logic)(void);
void (*draw)(void);
void (*handleClick)(int x, int y, int btn);
void (*handleDrag)(int x, int y, int dx, int dy, int cx, int cy);
void (*handleMouseUp)(int x, int y, int btn);
} Delegate;
struct Entity {
float x;
float y;
};
typedef struct {
int x;
int y;
int w;
int h;
int dx;
int dy;
int button[MAX_MOUSE_BUTTONS];
int dragging;
} Mouse;
typedef struct {
char saveDir[MAX_FILENAME_LENGTH];
int winWidth;
int winHeight;
float scaleX;
float scaleY;
int fullscreen;
int musicVolume;
int soundVolume;
int hideMouse;
Mouse mouse;
int keyboard[MAX_KEYBOARD_KEYS];
SDL_Texture *backBuffer;
SDL_Renderer *renderer;
SDL_Window *window;
Delegate delegate;
int awaitingWidgetInput;
int lastKeyPressed;
int lastButtonPressed;
int keyControls[CONTROL_MAX];
} App;
typedef struct {
long timePlayed;
} Game;