This commit is contained in:
Steve 2018-01-24 08:43:08 +00:00
parent e59085b133
commit 7146f71ae9
4 changed files with 108 additions and 0 deletions

View File

@ -8,6 +8,7 @@ vpath %.h $(SEARCHPATH)
DEPS += defs.h structs.h
OBJS += atlas.o
OBJS += camera.o combat.o
OBJS += draw.o
OBJS += effects.o entities.o explosions.o

View File

@ -30,6 +30,7 @@ typedef struct Sprite Sprite;
typedef struct Tuple Tuple;
typedef struct HubMission HubMission;
typedef struct Widget Widget;
typedef struct Atlas Atlas;
typedef struct {
int debug;
@ -313,3 +314,9 @@ struct Widget {
int clicked;
Widget *next;
};
struct Atlas {
char filename[MAX_FILENAME_LENGTH];
SDL_Rect rect;
Atlas *next;
};

78
src/system/atlas.c Normal file
View File

@ -0,0 +1,78 @@
/*
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.
*/
#include "atlas.h"
static void loadAtlasTexture(void);
static void loadAtlasData(void);
static Atlas atlasHead;
static Atlas *atlasTail;
/*
static Texture atlasTexture;
static int atlasSize;
*/
void initAtlas(void)
{
memset(&atlasHead, 0, sizeof(Atlas));
atlasTail = &atlasHead;
loadAtlasTexture();
loadAtlasData();
}
Atlas *getImageFromAtlas(char *filename)
{
Atlas *a;
for (a = atlasHead.next ; a != NULL ; a = a->next)
{
if (strcmp(a->filename, filename) == 0)
{
return a;
}
}
SDL_LogMessage(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_ERROR, "No such atlas image '%s'", filename);
exit(1);
}
static void loadAtlasTexture(void)
{
}
static void loadAtlasData(void)
{
}
void loadImageData(cJSON *root)
{
}
void createRectangle(char *filename, int x, int y, int w, int h)
{
}

22
src/system/atlas.h Normal file
View File

@ -0,0 +1,22 @@
/*
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.
*/
#include "../common.h"
#include "../json/cJSON.h"