├── .gitignore
├── .gitmodules
├── README
├── bounds.h
├── conffile.cpp
├── conffile.h
├── display.cpp
├── display.h
├── frustum.cpp
├── frustum.h
├── ftgl
└── FTUnicode.h
├── fxfont.cpp
├── fxfont.h
├── gl.h
├── logger.cpp
├── logger.h
├── mousecursor.cpp
├── mousecursor.h
├── pi.h
├── plane.cpp
├── plane.h
├── png_writer.cpp
├── png_writer.h
├── ppm.cpp
├── ppm.h
├── quadtree.cpp
├── quadtree.h
├── regex.cpp
├── regex.h
├── resource.cpp
├── resource.h
├── sdlapp.cpp
├── sdlapp.h
├── seeklog.cpp
├── seeklog.h
├── settings.cpp
├── settings.h
├── shader.cpp
├── shader.h
├── shader_common.cpp
├── shader_common.h
├── stringhash.cpp
├── stringhash.h
├── texture.cpp
├── texture.h
├── tga.cpp
├── tga.h
├── timer.cpp
├── timer.h
├── timezone.cpp
├── timezone.h
├── ui
├── action.h
├── button.cpp
├── button.h
├── checkbox.cpp
├── checkbox.h
├── colour.cpp
├── colour.h
├── console.cpp
├── console.h
├── element.cpp
├── element.h
├── file_selector.cpp
├── file_selector.h
├── group.cpp
├── group.h
├── image.cpp
├── image.h
├── label.cpp
├── label.h
├── layout.cpp
├── layout.h
├── scroll_bar.cpp
├── scroll_bar.h
├── scroll_layout.cpp
├── scroll_layout.h
├── select.cpp
├── select.h
├── slider.cpp
├── slider.h
├── solid_layout.cpp
├── solid_layout.h
├── subgroup.cpp
├── subgroup.h
├── ui.cpp
└── ui.h
├── utf8
├── checked.h
├── core.h
├── cpp11.h
├── unchecked.h
└── utf8.h
├── vbo.cpp
├── vbo.h
├── vectors.cpp
└── vectors.h
/.gitignore:
--------------------------------------------------------------------------------
1 | .deps
2 | .dirstamp
3 | .makepp
4 | Makefile
5 | *.o
6 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/acaudwell/Core/df513a31f531e869a0eb7a2a6174a0e93b8d2ffb/.gitmodules
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | Core library used by Gource and Logstalgia.
2 |
--------------------------------------------------------------------------------
/bounds.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009 Andrew Caudwell (acaudwell@gmail.com)
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions
7 | are met:
8 | 1. Redistributions of source code must retain the above copyright
9 | notice, this list of conditions and the following disclaimer.
10 | 2. Redistributions in binary form must reproduce the above copyright
11 | notice, this list of conditions and the following disclaimer in the
12 | documentation and/or other materials provided with the distribution.
13 | 3. The name of the author may not be used to endorse or promote products
14 | derived from this software without specific prior written permission.
15 |
16 | THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
17 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
18 | OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
19 | IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 | INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 | NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
22 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
23 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 | THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 | */
27 |
28 | #ifndef BOUNDS_H
29 | #define BOUNDS_H
30 |
31 | #include "display.h"
32 | #include "vectors.h"
33 |
34 | class Bounds2D {
35 | public:
36 | vec2 min;
37 | vec2 max;
38 | bool first;
39 |
40 | vec2 centre() const {
41 | return min + (max - min) * 0.5f;
42 | }
43 |
44 | float width() const {
45 | return max.x - min.x;
46 | }
47 |
48 | float height() const {
49 | return max.y - min.y;
50 | }
51 |
52 | float area() const {
53 | return width() * height();
54 | }
55 |
56 | void reset() {
57 | min = vec2(0.0, 0.0);
58 | max = vec2(0.0, 0.0);
59 | first = true;
60 | }
61 |
62 | Bounds2D() {
63 | reset();
64 | }
65 |
66 | Bounds2D(const vec2& min, const vec2& max) {
67 | reset();
68 | update(min);
69 | update(max);
70 | }
71 |
72 | void update(const Bounds2D& bounds) {
73 | update(bounds.min);
74 | update(bounds.max);
75 | }
76 |
77 |
78 | void set(const Bounds2D& bounds) {
79 | reset();
80 | update(bounds);
81 | }
82 |
83 | void set(vec2 point) {
84 | reset();
85 | update(point);
86 | }
87 |
88 | void set(const vec2& a, const vec2& b) {
89 | reset();
90 | update(a);
91 | update(b);
92 | }
93 |
94 | void update(const vec2& point) {
95 | if(first) {
96 | min = point;
97 | max = point;
98 | first=false;
99 | return;
100 | }
101 |
102 | if(min.x > point.x) min.x = point.x;
103 | if(min.y > point.y) min.y = point.y;
104 | if(max.x < point.x) max.x = point.x;
105 | if(max.y < point.y) max.y = point.y;
106 | }
107 |
108 | bool contains(const vec2& point) const {
109 | if(first) return false;
110 |
111 | if(min.x<=point.x && min.y<=point.y && max.x >= point.x && max.y >= point.y)
112 | return true;
113 |
114 | return false;
115 | }
116 |
117 | bool overlaps(const Bounds2D & b) const {
118 |
119 | if(max.y < b.min.y) return false;
120 | if(min.y > b.max.y) return false;
121 | if(max.x < b.min.x) return false;
122 | if(min.x > b.max.x) return false;
123 |
124 | return true;
125 | }
126 |
127 | void draw() const{
128 | glBegin(GL_LINE_STRIP);
129 | glVertex2fv(glm::value_ptr(min));
130 | glVertex2f(max.x, min.y);
131 | glVertex2fv(glm::value_ptr(max));
132 | glVertex2f(min.x, max.y);
133 | glVertex2fv(glm::value_ptr(min));
134 | glEnd();
135 | }
136 | };
137 |
138 | class Bounds3D {
139 | public:
140 | vec3 min;
141 | vec3 max;
142 | bool first;
143 |
144 | void reset() {
145 | min = vec3(0.0, 0.0, 0.0);
146 | max = vec3(0.0, 0.0, 0.0);
147 | first = true;
148 | }
149 |
150 | Bounds3D() {
151 | reset();
152 | }
153 |
154 | Bounds3D(vec3 min, vec3 max) {
155 | reset();
156 | update(min);
157 | update(max);
158 | }
159 |
160 | float width() {
161 | return max.x - min.x;
162 | }
163 |
164 | float height() {
165 | return max.y - min.y;
166 | }
167 |
168 | float depth() {
169 | return max.z - min.z;
170 | }
171 |
172 | float area() {
173 | return width() * height() * depth();
174 | }
175 |
176 | vec3 centre() {
177 | return min + ((max-min) * 0.5f);
178 | }
179 |
180 | void update(vec3 point) {
181 | if(first) {
182 | min = point;
183 | max = point;
184 | first = false;
185 | return;
186 | }
187 |
188 | if(min.x > point.x) min.x = point.x;
189 | if(min.y > point.y) min.y = point.y;
190 | if(min.z > point.z) min.z = point.z;
191 | if(max.x < point.x) max.x = point.x;
192 | if(max.y < point.y) max.y = point.y;
193 | if(max.z < point.z) max.z = point.z;
194 | }
195 |
196 | bool contains(vec3& point) {
197 | if(first) return false;
198 |
199 | if(min.x<=point.x && min.y<=point.y && min.z<=point.z && max.x >= point.x && max.y >= point.y && max.z >= point.z)
200 | return true;
201 |
202 | return false;
203 | }
204 |
205 | void draw() {
206 | glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
207 | glBegin(GL_LINES);
208 | glVertex3fv(glm::value_ptr(min));
209 | glVertex3fv(glm::value_ptr(max));
210 | glEnd();
211 | }
212 |
213 | };
214 |
215 | #endif
216 |
--------------------------------------------------------------------------------
/conffile.h:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (C) 2009 Andrew Caudwell (acaudwell@gmail.com)
3 |
4 | This program is free software; you can redistribute it and/or
5 | modify it under the terms of the GNU General Public License
6 | as published by the Free Software Foundation; either version
7 | 3 of the License, or (at your option) any later version.
8 |
9 | This program is distributed in the hope that it will be useful,
10 | but WITHOUT ANY WARRANTY; without even the implied warranty of
11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 | GNU General Public License for more details.
13 |
14 | You should have received a copy of the GNU General Public License
15 | along with this program. If not, see .
16 | */
17 |
18 | #ifndef CONF_FILE_H
19 | #define CONF_FILE_H
20 |
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include