ObjectivelyMVC
Object oriented MVC framework for SDL3 and GNU C
Loading...
Searching...
No Matches
ImageAtlas.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for SDL3 and C.
3 * Copyright (C) 2014 Jay Dolan <jay@jaydolan.com>
4 * This software is provided 'as-is', without any express or implied
5 * warranty. In no event will the authors be held liable for any damages
6 * arising from the use of this software.
7 * Permission is granted to anyone to use this software for any purpose,
8 * including commercial applications, and to alter it and redistribute it
9 * freely, subject to the following restrictions:
10 * 1. The origin of this software must not be misrepresented; you must not
11 * claim that you wrote the original software. If you use this software
12 * in a product, an acknowledgment in the product documentation would be
13 * appreciated but is not required.
14 * 2. Altered source versions must be plainly marked as such, and must not be
15 * misrepresented as being the original software.
16 */
17
18
19#pragma once
20
21#include <Objectively/Array.h>
22#include <Objectively/Dictionary.h>
23
24#include <ObjectivelyGPU/RenderDevice.h>
25
27
33#define IMAGE_ATLAS_MAX_SIZE 4096
34
35typedef struct ImageAtlasInterface ImageAtlasInterface;
36
49struct ImageAtlas {
50
54 Object object;
55
60 ImageAtlasInterface *interface[0];
61
66 unsigned generation;
67
72
76 Array *images;
77
82 Dictionary *names;
83
91
96 Texture *texture;
97};
98
102struct ImageAtlasInterface {
103
107 ObjectInterface objectInterface;
108
118 AtlasImage *(*addImage)(ImageAtlas *self, Image *image);
119
128 AtlasImage *(*addImageWithResourceName)(ImageAtlas *self, const char *name, float pixelDensity);
129
142 AtlasImage *(*addImageWithName)(ImageAtlas *self, const char *name, Image *image);
143
155 bool (*compile)(ImageAtlas *self);
156
164 AtlasImage *(*imageWithName)(const ImageAtlas *self, const char *name);
165
173 ImageAtlas *(*init)(ImageAtlas *self);
174
184 void (*renderDeviceWillReset)(ImageAtlas *self);
185
194 Texture *(*texture)(ImageAtlas *self, RenderDevice *device);
195};
196
An Image packed into an ImageAtlas.
static String * name(const Font *self)
Definition Font.c:303
OBJECTIVELYMVC_EXPORT Class * _ImageAtlas(void)
Definition ImageAtlas.c:324
static Image * image(Theme *self, const char *name, float pixelDensity)
Definition Theme.c:82
#define OBJECTIVELYMVC_EXPORT
Definition Types.h:40
An Image packed into an ImageAtlas.
Definition AtlasImage.h:41
Packs many Images into one sheet, backed by one Texture.
Definition ImageAtlas.h:49
int maxSize
The largest sheet dimension ImageAtlas::compile will attempt.
Definition ImageAtlas.h:90
Object object
The superclass.
Definition ImageAtlas.h:54
Image * image
The compiled sheet, or NULL until ImageAtlas::compile.
Definition ImageAtlas.h:71
Array * images
The AtlasImages, in the order added.
Definition ImageAtlas.h:76
ImageAtlasInterface * interface[0]
The interface type.
Definition ImageAtlas.h:60
unsigned generation
Incremented by every ImageAtlas::addImageWithName and ImageAtlas::compile, so that anything derived f...
Definition ImageAtlas.h:66
Image loading.
Definition Image.h:41