Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
remove c99 features
Browse files Browse the repository at this point in the history
fixes #26
  • Loading branch information
kkaefer committed Feb 3, 2014
1 parent 9ab9eee commit 82c79b7
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 116 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ set(VERSION_MINOR "0")
set(VERSION_PATCH "1")


set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -std=c++11 -stdlib=libc++ -pedantic")
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -stdlib=libc++")

add_subdirectory(src)
Expand Down
6 changes: 3 additions & 3 deletions bin/build-shaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ module.exports = function() {
consts.push(name.toUpperCase() + '_SHADER');

var line = '';
line += ' [' + name.toUpperCase() + '_SHADER] = {\n';
line += ' .vertex = ' + JSON.stringify(shaders[name].vertex) + ',\n';
line += ' .fragment = ' + JSON.stringify(shaders[name].fragment) + ',\n';
line += ' {\n';
line += ' ' + JSON.stringify(shaders[name].vertex) + ',\n';
line += ' ' + JSON.stringify(shaders[name].fragment) + ',\n';
line += ' }';
lines.push(line);
}
Expand Down
199 changes: 102 additions & 97 deletions src/geometry/debug_font.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include <cstdint>
#include <map>

int8_t simplex_0[] = { };
int8_t simplex_1[] = { 5, 21, 5, 7, -1, -1, 5, 2, 4, 1, 5, 0, 6, 1, 5, 2 };
int8_t simplex_2[] = { 4, 21, 4, 14, -1, -1, 12, 21, 12, 14 };
int8_t simplex_3[] = { 11, 25, 4, -7, -1, -1, 17, 25, 10, -7, -1, -1, 4, 12, 18, 12, -1, -1, 3, 6, 17, 6 };
Expand Down Expand Up @@ -97,107 +97,112 @@ int8_t simplex_93[] = { 5, 25, 7, 24, 8, 23, 9, 21, 9, 19, 8, 17, 7, 16, 6, 14,
int8_t simplex_94[] = { 3, 6, 3, 8, 4, 11, 6, 12, 8, 12, 10, 11, 14, 8, 16, 7, 18, 7, 20, 8, 21, 10, -1, -1, 3, 8, 4, 10, 6, 11, 8, 11, 10, 10, 14, 7, 16, 6, 18, 6, 20, 7, 21, 10, 21, 12 };

struct glyph {
glyph() : width(0), length(0), data(NULL) { }
glyph(uint8_t width, uint8_t length, int8_t *data)
: width(width),
length(length),
data(data) {}
uint8_t width;
uint8_t length;
int8_t *data;
};

// Font data From Hershey Simplex Font
// http://paulbourke.net/dataformats/hershey/
glyph simplex[127] = {
[' '] = { .width = 16, .length = sizeof(simplex_0), .data = simplex_0 },
['!'] = { .width = 10, .length = sizeof(simplex_1), .data = simplex_1 },
['"'] = { .width = 16, .length = sizeof(simplex_2), .data = simplex_2 },
['#'] = { .width = 21, .length = sizeof(simplex_3), .data = simplex_3 },
['$'] = { .width = 20, .length = sizeof(simplex_4), .data = simplex_4 },
['%'] = { .width = 24, .length = sizeof(simplex_5), .data = simplex_5 },
['&'] = { .width = 26, .length = sizeof(simplex_6), .data = simplex_6 },
['\''] = { .width = 10, .length = sizeof(simplex_7), .data = simplex_7 },
['('] = { .width = 14, .length = sizeof(simplex_8), .data = simplex_8 },
[')'] = { .width = 14, .length = sizeof(simplex_9), .data = simplex_9 },
['*'] = { .width = 16, .length = sizeof(simplex_10), .data = simplex_10 },
['+'] = { .width = 26, .length = sizeof(simplex_11), .data = simplex_11 },
[','] = { .width = 10, .length = sizeof(simplex_12), .data = simplex_12 },
['-'] = { .width = 26, .length = sizeof(simplex_13), .data = simplex_13 },
['.'] = { .width = 10, .length = sizeof(simplex_14), .data = simplex_14 },
['/'] = { .width = 22, .length = sizeof(simplex_15), .data = simplex_15 },
['0'] = { .width = 20, .length = sizeof(simplex_16), .data = simplex_16 },
['1'] = { .width = 20, .length = sizeof(simplex_17), .data = simplex_17 },
['2'] = { .width = 20, .length = sizeof(simplex_18), .data = simplex_18 },
['3'] = { .width = 20, .length = sizeof(simplex_19), .data = simplex_19 },
['4'] = { .width = 20, .length = sizeof(simplex_20), .data = simplex_20 },
['5'] = { .width = 20, .length = sizeof(simplex_21), .data = simplex_21 },
['6'] = { .width = 20, .length = sizeof(simplex_22), .data = simplex_22 },
['7'] = { .width = 20, .length = sizeof(simplex_23), .data = simplex_23 },
['8'] = { .width = 20, .length = sizeof(simplex_24), .data = simplex_24 },
['9'] = { .width = 20, .length = sizeof(simplex_25), .data = simplex_25 },
[':'] = { .width = 10, .length = sizeof(simplex_26), .data = simplex_26 },
[';'] = { .width = 10, .length = sizeof(simplex_27), .data = simplex_27 },
['<'] = { .width = 24, .length = sizeof(simplex_28), .data = simplex_28 },
['='] = { .width = 26, .length = sizeof(simplex_29), .data = simplex_29 },
['>'] = { .width = 24, .length = sizeof(simplex_30), .data = simplex_30 },
['?'] = { .width = 18, .length = sizeof(simplex_31), .data = simplex_31 },
['@'] = { .width = 27, .length = sizeof(simplex_32), .data = simplex_32 },
['A'] = { .width = 18, .length = sizeof(simplex_33), .data = simplex_33 },
['B'] = { .width = 21, .length = sizeof(simplex_34), .data = simplex_34 },
['C'] = { .width = 21, .length = sizeof(simplex_35), .data = simplex_35 },
['D'] = { .width = 21, .length = sizeof(simplex_36), .data = simplex_36 },
['E'] = { .width = 19, .length = sizeof(simplex_37), .data = simplex_37 },
['F'] = { .width = 18, .length = sizeof(simplex_38), .data = simplex_38 },
['G'] = { .width = 21, .length = sizeof(simplex_39), .data = simplex_39 },
['H'] = { .width = 22, .length = sizeof(simplex_40), .data = simplex_40 },
['I'] = { .width = 8, .length = sizeof(simplex_41), .data = simplex_41 },
['J'] = { .width = 16, .length = sizeof(simplex_42), .data = simplex_42 },
['K'] = { .width = 21, .length = sizeof(simplex_43), .data = simplex_43 },
['L'] = { .width = 17, .length = sizeof(simplex_44), .data = simplex_44 },
['M'] = { .width = 24, .length = sizeof(simplex_45), .data = simplex_45 },
['N'] = { .width = 22, .length = sizeof(simplex_46), .data = simplex_46 },
['O'] = { .width = 22, .length = sizeof(simplex_47), .data = simplex_47 },
['P'] = { .width = 21, .length = sizeof(simplex_48), .data = simplex_48 },
['Q'] = { .width = 22, .length = sizeof(simplex_49), .data = simplex_49 },
['R'] = { .width = 21, .length = sizeof(simplex_50), .data = simplex_50 },
['S'] = { .width = 20, .length = sizeof(simplex_51), .data = simplex_51 },
['T'] = { .width = 16, .length = sizeof(simplex_52), .data = simplex_52 },
['U'] = { .width = 22, .length = sizeof(simplex_53), .data = simplex_53 },
['V'] = { .width = 18, .length = sizeof(simplex_54), .data = simplex_54 },
['W'] = { .width = 24, .length = sizeof(simplex_55), .data = simplex_55 },
['X'] = { .width = 20, .length = sizeof(simplex_56), .data = simplex_56 },
['Y'] = { .width = 18, .length = sizeof(simplex_57), .data = simplex_57 },
['Z'] = { .width = 20, .length = sizeof(simplex_58), .data = simplex_58 },
['['] = { .width = 14, .length = sizeof(simplex_59), .data = simplex_59 },
['\\'] = { .width = 14, .length = sizeof(simplex_60), .data = simplex_60 },
[']'] = { .width = 14, .length = sizeof(simplex_61), .data = simplex_61 },
['^'] = { .width = 16, .length = sizeof(simplex_62), .data = simplex_62 },
['_'] = { .width = 16, .length = sizeof(simplex_63), .data = simplex_63 },
['`'] = { .width = 10, .length = sizeof(simplex_64), .data = simplex_64 },
['a'] = { .width = 19, .length = sizeof(simplex_65), .data = simplex_65 },
['b'] = { .width = 19, .length = sizeof(simplex_66), .data = simplex_66 },
['c'] = { .width = 18, .length = sizeof(simplex_67), .data = simplex_67 },
['d'] = { .width = 19, .length = sizeof(simplex_68), .data = simplex_68 },
['e'] = { .width = 18, .length = sizeof(simplex_69), .data = simplex_69 },
['f'] = { .width = 12, .length = sizeof(simplex_70), .data = simplex_70 },
['g'] = { .width = 19, .length = sizeof(simplex_71), .data = simplex_71 },
['h'] = { .width = 19, .length = sizeof(simplex_72), .data = simplex_72 },
['i'] = { .width = 8, .length = sizeof(simplex_73), .data = simplex_73 },
['j'] = { .width = 10, .length = sizeof(simplex_74), .data = simplex_74 },
['k'] = { .width = 17, .length = sizeof(simplex_75), .data = simplex_75 },
['l'] = { .width = 8, .length = sizeof(simplex_76), .data = simplex_76 },
['m'] = { .width = 30, .length = sizeof(simplex_77), .data = simplex_77 },
['n'] = { .width = 19, .length = sizeof(simplex_78), .data = simplex_78 },
['o'] = { .width = 19, .length = sizeof(simplex_79), .data = simplex_79 },
['p'] = { .width = 19, .length = sizeof(simplex_80), .data = simplex_80 },
['q'] = { .width = 19, .length = sizeof(simplex_81), .data = simplex_81 },
['r'] = { .width = 13, .length = sizeof(simplex_82), .data = simplex_82 },
['s'] = { .width = 17, .length = sizeof(simplex_83), .data = simplex_83 },
['t'] = { .width = 12, .length = sizeof(simplex_84), .data = simplex_84 },
['u'] = { .width = 19, .length = sizeof(simplex_85), .data = simplex_85 },
['v'] = { .width = 16, .length = sizeof(simplex_86), .data = simplex_86 },
['w'] = { .width = 22, .length = sizeof(simplex_87), .data = simplex_87 },
['x'] = { .width = 17, .length = sizeof(simplex_88), .data = simplex_88 },
['y'] = { .width = 16, .length = sizeof(simplex_89), .data = simplex_89 },
['z'] = { .width = 17, .length = sizeof(simplex_90), .data = simplex_90 },
['{'] = { .width = 14, .length = sizeof(simplex_91), .data = simplex_91 },
['|'] = { .width = 8, .length = sizeof(simplex_92), .data = simplex_92 },
['}'] = { .width = 14, .length = sizeof(simplex_93), .data = simplex_93 },
['~'] = { .width = 24, .length = sizeof(simplex_94), .data = simplex_94 }
std::map<char, glyph> simplex = {
{ ' ', { 16, 0, NULL } },
{ '!', { 10, sizeof(simplex_1), simplex_1 } },
{ '"', { 16, sizeof(simplex_2), simplex_2 } },
{ '#', { 21, sizeof(simplex_3), simplex_3 } },
{ '$', { 20, sizeof(simplex_4), simplex_4 } },
{ '%', { 24, sizeof(simplex_5), simplex_5 } },
{ '&', { 26, sizeof(simplex_6), simplex_6 } },
{ '\'', { 10, sizeof(simplex_7), simplex_7 } },
{ '(', { 14, sizeof(simplex_8), simplex_8 } },
{ ')', { 14, sizeof(simplex_9), simplex_9 } },
{ '*', { 16, sizeof(simplex_10), simplex_10 } },
{ '+', { 26, sizeof(simplex_11), simplex_11 } },
{ ',', { 10, sizeof(simplex_12), simplex_12 } },
{ '-', { 26, sizeof(simplex_13), simplex_13 } },
{ '.', { 10, sizeof(simplex_14), simplex_14 } },
{ '/', { 22, sizeof(simplex_15), simplex_15 } },
{ '0', { 20, sizeof(simplex_16), simplex_16 } },
{ '1', { 20, sizeof(simplex_17), simplex_17 } },
{ '2', { 20, sizeof(simplex_18), simplex_18 } },
{ '3', { 20, sizeof(simplex_19), simplex_19 } },
{ '4', { 20, sizeof(simplex_20), simplex_20 } },
{ '5', { 20, sizeof(simplex_21), simplex_21 } },
{ '6', { 20, sizeof(simplex_22), simplex_22 } },
{ '7', { 20, sizeof(simplex_23), simplex_23 } },
{ '8', { 20, sizeof(simplex_24), simplex_24 } },
{ '9', { 20, sizeof(simplex_25), simplex_25 } },
{ ':', { 10, sizeof(simplex_26), simplex_26 } },
{ ';', { 10, sizeof(simplex_27), simplex_27 } },
{ '<', { 24, sizeof(simplex_28), simplex_28 } },
{ '=', { 26, sizeof(simplex_29), simplex_29 } },
{ '>', { 24, sizeof(simplex_30), simplex_30 } },
{ '?', { 18, sizeof(simplex_31), simplex_31 } },
{ '@', { 27, sizeof(simplex_32), simplex_32 } },
{ 'A', { 18, sizeof(simplex_33), simplex_33 } },
{ 'B', { 21, sizeof(simplex_34), simplex_34 } },
{ 'C', { 21, sizeof(simplex_35), simplex_35 } },
{ 'D', { 21, sizeof(simplex_36), simplex_36 } },
{ 'E', { 19, sizeof(simplex_37), simplex_37 } },
{ 'F', { 18, sizeof(simplex_38), simplex_38 } },
{ 'G', { 21, sizeof(simplex_39), simplex_39 } },
{ 'H', { 22, sizeof(simplex_40), simplex_40 } },
{ 'I', { 8, sizeof(simplex_41), simplex_41 } },
{ 'J', { 16, sizeof(simplex_42), simplex_42 } },
{ 'K', { 21, sizeof(simplex_43), simplex_43 } },
{ 'L', { 17, sizeof(simplex_44), simplex_44 } },
{ 'M', { 24, sizeof(simplex_45), simplex_45 } },
{ 'N', { 22, sizeof(simplex_46), simplex_46 } },
{ 'O', { 22, sizeof(simplex_47), simplex_47 } },
{ 'P', { 21, sizeof(simplex_48), simplex_48 } },
{ 'Q', { 22, sizeof(simplex_49), simplex_49 } },
{ 'R', { 21, sizeof(simplex_50), simplex_50 } },
{ 'S', { 20, sizeof(simplex_51), simplex_51 } },
{ 'T', { 16, sizeof(simplex_52), simplex_52 } },
{ 'U', { 22, sizeof(simplex_53), simplex_53 } },
{ 'V', { 18, sizeof(simplex_54), simplex_54 } },
{ 'W', { 24, sizeof(simplex_55), simplex_55 } },
{ 'X', { 20, sizeof(simplex_56), simplex_56 } },
{ 'Y', { 18, sizeof(simplex_57), simplex_57 } },
{ 'Z', { 20, sizeof(simplex_58), simplex_58 } },
{ '[', { 14, sizeof(simplex_59), simplex_59 } },
{ '\\', { 14, sizeof(simplex_60), simplex_60 } },
{ ']', { 14, sizeof(simplex_61), simplex_61 } },
{ '^', { 16, sizeof(simplex_62), simplex_62 } },
{ '_', { 16, sizeof(simplex_63), simplex_63 } },
{ '`', { 10, sizeof(simplex_64), simplex_64 } },
{ 'a', { 19, sizeof(simplex_65), simplex_65 } },
{ 'b', { 19, sizeof(simplex_66), simplex_66 } },
{ 'c', { 18, sizeof(simplex_67), simplex_67 } },
{ 'd', { 19, sizeof(simplex_68), simplex_68 } },
{ 'e', { 18, sizeof(simplex_69), simplex_69 } },
{ 'f', { 12, sizeof(simplex_70), simplex_70 } },
{ 'g', { 19, sizeof(simplex_71), simplex_71 } },
{ 'h', { 19, sizeof(simplex_72), simplex_72 } },
{ 'i', { 8, sizeof(simplex_73), simplex_73 } },
{ 'j', { 10, sizeof(simplex_74), simplex_74 } },
{ 'k', { 17, sizeof(simplex_75), simplex_75 } },
{ 'l', { 8, sizeof(simplex_76), simplex_76 } },
{ 'm', { 30, sizeof(simplex_77), simplex_77 } },
{ 'n', { 19, sizeof(simplex_78), simplex_78 } },
{ 'o', { 19, sizeof(simplex_79), simplex_79 } },
{ 'p', { 19, sizeof(simplex_80), simplex_80 } },
{ 'q', { 19, sizeof(simplex_81), simplex_81 } },
{ 'r', { 13, sizeof(simplex_82), simplex_82 } },
{ 's', { 17, sizeof(simplex_83), simplex_83 } },
{ 't', { 12, sizeof(simplex_84), simplex_84 } },
{ 'u', { 19, sizeof(simplex_85), simplex_85 } },
{ 'v', { 16, sizeof(simplex_86), simplex_86 } },
{ 'w', { 22, sizeof(simplex_87), simplex_87 } },
{ 'x', { 17, sizeof(simplex_88), simplex_88 } },
{ 'y', { 16, sizeof(simplex_89), simplex_89 } },
{ 'z', { 17, sizeof(simplex_90), simplex_90 } },
{ '{', { 14, sizeof(simplex_91), simplex_91 } },
{ '|', { 8, sizeof(simplex_92), simplex_92 } },
{ '}', { 14, sizeof(simplex_93), simplex_93 } },
{ '~', { 24, sizeof(simplex_94), simplex_94 } }
};
Loading

0 comments on commit 82c79b7

Please sign in to comment.