ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Renderer.h
Go to the documentation of this file.
1/*
2 * ObjectivelyMVC: Object oriented MVC framework for OpenGL, SDL2 and GNU C.
3 * Copyright (C) 2014 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 <SDL_opengl.h>
27
28#include <Objectively/MutableArray.h>
29
31
40typedef struct Renderer Renderer;
41typedef struct RendererInterface RendererInterface;
42
50struct Renderer {
51
55 Object object;
56
61 RendererInterface *interface;
62};
63
67struct RendererInterface {
68
72 ObjectInterface objectInterface;
73
82 void (*beginFrame)(Renderer *self);
83
92 GLuint (*createTexture)(const Renderer *self, const SDL_Surface *surface);
93
101 void (*drawLine)(const Renderer *self, const SDL_Point *points);
102
111 void (*drawLines)(const Renderer *self, const SDL_Point *points, size_t count);
112
120 void (*drawRect)(const Renderer *self, const SDL_Rect *rect);
121
129 void (*drawRectFilled)(const Renderer *self, const SDL_Rect *rect);
130
139 void (*drawTexture)(const Renderer *self, GLuint texture, const SDL_Rect *dest);
140
148 void (*drawView)(Renderer *self, View *view);
149
158 void (*endFrame)(Renderer *self);
159
168 Renderer *(*init)(Renderer *self);
169
177 void (*renderDeviceDidReset)(Renderer *self);
178
186 void (*renderDeviceWillReset)(Renderer *self);
187
196 void (*setClippingFrame)(Renderer *self, const SDL_Rect *clippingFrame);
197
205 void (*setDrawColor)(Renderer *self, const SDL_Color *color);
206};
207
215
static void renderDeviceDidReset(Font *self)
Definition: Font.c:247
static void renderDeviceWillReset(View *self)
Definition: ImageView.c:121
static void drawView(Renderer *self, View *view)
Definition: Renderer.c:195
static void drawRectFilled(const Renderer *self, const SDL_Rect *rect)
Definition: Renderer.c:144
static void setDrawColor(Renderer *self, const SDL_Color *color)
Definition: Renderer.c:281
static void setClippingFrame(Renderer *self, const SDL_Rect *clippingFrame)
Definition: Renderer.c:260
static void drawLines(const Renderer *self, const SDL_Point *points, size_t count)
Definition: Renderer.c:105
static void beginFrame(Renderer *self)
Definition: Renderer.c:39
static GLuint createTexture(const Renderer *self, const SDL_Surface *surface)
Definition: Renderer.c:56
static void drawRect(const Renderer *self, const SDL_Rect *rect)
Definition: Renderer.c:118
static void endFrame(Renderer *self)
Definition: Renderer.c:212
static void drawLine(const Renderer *self, const SDL_Point *points)
Definition: Renderer.c:94
static void drawTexture(const Renderer *self, GLuint texture, const SDL_Rect *rect)
Definition: Renderer.c:155
ObjectivelyMVC base types.
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
static SDL_Rect clippingFrame(const View *self)
Definition: View.c:429
The Renderer is responsible for rasterizing the View hierarchy of a WindowController.
Definition: Renderer.h:50
Object object
The superclass.
Definition: Renderer.h:55
Class * _Renderer(void)
The Renderer archetype.
Definition: Renderer.c:312
RendererInterface * interface
The interface.
Definition: Renderer.h:61
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition: View.h:133