ObjectivelyMVC 0.1.0
Object oriented MVC framework for OpenGL, SDL2 and GNU C
Text.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 <ObjectivelyMVC/View.h>
27#include <ObjectivelyMVC/Font.h>
28
34typedef struct Text Text;
35typedef struct TextInterface TextInterface;
36
41struct Text {
42
47
52 TextInterface *interface;
53
57 SDL_Color color;
58
65
69 _Bool lineWrap;
70
76 char *text;
77
82 GLuint texture;
83};
84
88struct TextInterface {
89
93 ViewInterface viewInterface;
94
104 Text *(*initWithText)(Text *self, const char *text, Font *font);
105
112 SDL_Size (*naturalSize)(const Text *self);
113
121 void (*setFont)(Text *self, Font *font);
122
130 void (*setText)(Text *self, const char *text);
131
139 void (*setTextWithFormat)(Text *self, const char *fmt, ...);
140};
141
142OBJECTIVELYMVC_EXPORT Class *_Text(void);
static SDL_Size naturalSize(const CollectionView *self)
TrueType fonts.
static void setFont(Text *self, Font *font)
Definition: Text.c:239
static void setTextWithFormat(Text *self, const char *fmt,...)
Definition: Text.c:289
static void setText(Text *self, const char *text)
Definition: Text.c:261
#define OBJECTIVELYMVC_EXPORT
Definition: Types.h:39
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
TrueType fonts.
Definition: Font.h:63
The SDL_Size type.
Definition: Types.h:62
Text rendered with TrueType fonts.
Definition: Text.h:41
Class * _Text(void)
Definition: Text.c:333
_Bool lineWrap
If true, wrap text along word boundaries to fit this Text's width.
Definition: Text.h:69
GLuint texture
The rendered texture.
Definition: Text.h:82
View view
The superclass.
Definition: Text.h:46
TextInterface * interface
The interface.
Definition: Text.h:52
SDL_Color color
The text color.
Definition: Text.h:57
Font * font
The Font.
Definition: Text.h:64
char * text
The text.
Definition: Text.h:76
Views are the fundamental building blocks of ObjectivelyMVC user interfaces.
Definition: View.h:133