ObjectivelyGPU
Object oriented graphics framework for SDL3 and C
Loading...
Searching...
No Matches
Types.h
Go to the documentation of this file.
1/*
2 * ObjectivelyGPU: Object oriented graphics framework for SDL3 and C.
3 * Copyright (C) 2026 Jay Dolan <jay@jaydolan.com>
4 *
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
8 *
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, subject to the following restrictions:
12 *
13 * 1. The origin of this software must not be misrepresented; you must not
14 * claim that you wrote the original software. If you use this software
15 * in a product, an acknowledgment in the product documentation would be
16 * appreciated but is not required.
17 *
18 * 2. Altered source versions must be plainly marked as such, and must not be
19 * misrepresented as being the original software.
20 *
21 * 3. This notice may not be removed or altered from any source distribution.
22 */
23
24#pragma once
25
26#include <stdlib.h>
27
28#include <SDL3/SDL_assert.h>
29#include <SDL3/SDL_gpu.h>
30#include <SDL3/SDL_log.h>
31
32#include <Objectively/Types.h>
33
34#ifndef OBJECTIVELYGPU_EXPORT
35 #define OBJECTIVELYGPU_EXPORT extern
36#endif
37
38#ifndef OBJECTIVELYGPU_EXPORT_DATA
39 #define OBJECTIVELYGPU_EXPORT_DATA
40#endif
41
42typedef struct SDL_Size SDL_Size;
43
47struct SDL_Size {
48 int w, h;
49};
50
54#define MakePoint(x, y) (SDL_Point) { (x), (y) }
55
59#define MakeRect(x, y, w, h) (SDL_Rect) { (x), (y), (w), (h) }
60
64#define MakeSize(w, h) (SDL_Size) { (w), (h) }
65
70#define GPU_Assert(cond, fmt, ...) \
71 do { \
72 if (!(cond)) { \
73 SDL_LogCritical(SDL_LOG_CATEGORY_GPU, "%s::%d::%s: " fmt ": %s", __FILE__, __LINE__, __func__, ## __VA_ARGS__, SDL_GetError()); \
74 SDL_TriggerBreakpoint(); \
75 exit(EXIT_FAILURE); \
76 } \
77 } while (0)
The SDL_Size type.
Definition Types.h:47
int w
Definition Types.h:48
int h
Definition Types.h:48