From: Mikko Rasa Date: Wed, 3 Sep 2008 16:44:14 +0000 (+0000) Subject: Add a simple Hello World application to demonstrate the library X-Git-Tag: 1.0~6 X-Git-Url: http://git.tdb.fi/?a=commitdiff_plain;h=7fab31cbb378ff8cbd63afad62c6f3b1cb3fd33e;p=libs%2Fgltk.git Add a simple Hello World application to demonstrate the library --- diff --git a/Build b/Build index 637801e..5f02b61 100644 --- a/Build +++ b/Build @@ -17,4 +17,13 @@ package "mspgltk" install true; install_headers "msp/gltk"; }; + + program "helloworld" + { + source "helloworld.cpp"; + build_info + { + library "mspgltk"; + }; + }; }; diff --git a/dejavu-10.font b/dejavu-10.font new file mode 100644 index 0000000..21de49b --- /dev/null +++ b/dejavu-10.font @@ -0,0 +1,1341 @@ +texture "dejavu-10.png"; +default_size 10; +ascent 1.000; +descent -0.300; +glyph 32 +{ + texcoords 0.035156 0.960938 0.035156 0.960938; + size 0.000 0.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 33 +{ + texcoords 0.101562 0.960938 0.105469 0.988281; + size 0.100 0.700; + offset 0.200 0.000; + advance 0.400; +}; +glyph 34 +{ + texcoords 0.167969 0.976562 0.179688 0.988281; + size 0.300 0.300; + offset 0.100 0.400; + advance 0.500; +}; +glyph 35 +{ + texcoords 0.230469 0.960938 0.257812 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 36 +{ + texcoords 0.304688 0.957031 0.328125 0.988281; + size 0.600 0.800; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 37 +{ + texcoords 0.371094 0.960938 0.402344 0.988281; + size 0.800 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 38 +{ + texcoords 0.441406 0.960938 0.468750 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.900; +}; +glyph 39 +{ + texcoords 0.523438 0.976562 0.527344 0.988281; + size 0.100 0.300; + offset 0.100 0.400; + advance 0.300; +}; +glyph 40 +{ + texcoords 0.593750 0.957031 0.601562 0.992188; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 41 +{ + texcoords 0.664062 0.957031 0.671875 0.992188; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 42 +{ + texcoords 0.726562 0.972656 0.746094 0.988281; + size 0.500 0.400; + offset 0.000 0.300; + advance 0.500; +}; +glyph 43 +{ + texcoords 0.792969 0.960938 0.820312 0.988281; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 44 +{ + texcoords 0.875000 0.957031 0.878906 0.964844; + size 0.100 0.200; + offset 0.100 -0.100; + advance 0.300; +}; +glyph 45 +{ + texcoords 0.941406 0.968750 0.953125 0.972656; + size 0.300 0.100; + offset 0.100 0.200; + advance 0.400; +}; +glyph 46 +{ + texcoords 0.031250 0.890625 0.035156 0.894531; + size 0.100 0.100; + offset 0.100 0.000; + advance 0.300; +}; +glyph 47 +{ + texcoords 0.097656 0.886719 0.109375 0.917969; + size 0.300 0.800; + offset 0.000 -0.100; + advance 0.300; +}; +glyph 48 +{ + texcoords 0.164062 0.890625 0.183594 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 49 +{ + texcoords 0.234375 0.890625 0.253906 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 50 +{ + texcoords 0.304688 0.890625 0.328125 0.917969; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 51 +{ + texcoords 0.375000 0.890625 0.394531 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 52 +{ + texcoords 0.445312 0.890625 0.464844 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 53 +{ + texcoords 0.515625 0.890625 0.535156 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 54 +{ + texcoords 0.585938 0.890625 0.605469 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 55 +{ + texcoords 0.656250 0.890625 0.675781 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 56 +{ + texcoords 0.726562 0.890625 0.746094 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 57 +{ + texcoords 0.796875 0.890625 0.816406 0.917969; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 58 +{ + texcoords 0.875000 0.890625 0.878906 0.910156; + size 0.100 0.500; + offset 0.100 0.000; + advance 0.300; +}; +glyph 59 +{ + texcoords 0.945312 0.886719 0.949219 0.910156; + size 0.100 0.600; + offset 0.100 -0.100; + advance 0.300; +}; +glyph 60 +{ + texcoords 0.023438 0.824219 0.046875 0.843750; + size 0.600 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 61 +{ + texcoords 0.093750 0.828125 0.117188 0.839844; + size 0.600 0.300; + offset 0.100 0.200; + advance 0.800; +}; +glyph 62 +{ + texcoords 0.164062 0.824219 0.187500 0.843750; + size 0.600 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 63 +{ + texcoords 0.238281 0.820312 0.253906 0.847656; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.500; +}; +glyph 64 +{ + texcoords 0.296875 0.812500 0.332031 0.847656; + size 0.900 0.900; + offset 0.100 -0.200; + advance 1.100; +}; +glyph 65 +{ + texcoords 0.371094 0.820312 0.398438 0.847656; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.700; +}; +glyph 66 +{ + texcoords 0.445312 0.820312 0.464844 0.847656; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 67 +{ + texcoords 0.515625 0.820312 0.539062 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 68 +{ + texcoords 0.585938 0.820312 0.609375 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 69 +{ + texcoords 0.656250 0.820312 0.675781 0.847656; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 70 +{ + texcoords 0.730469 0.820312 0.746094 0.847656; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 71 +{ + texcoords 0.796875 0.820312 0.820312 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 72 +{ + texcoords 0.867188 0.820312 0.890625 0.847656; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 73 +{ + texcoords 0.945312 0.820312 0.949219 0.847656; + size 0.100 0.700; + offset 0.100 0.000; + advance 0.300; +}; +glyph 74 +{ + texcoords 0.027344 0.742188 0.039062 0.777344; + size 0.300 0.900; + offset -0.100 -0.200; + advance 0.300; +}; +glyph 75 +{ + texcoords 0.093750 0.750000 0.117188 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 76 +{ + texcoords 0.164062 0.750000 0.183594 0.777344; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 77 +{ + texcoords 0.230469 0.750000 0.257812 0.777344; + size 0.700 0.700; + offset 0.100 0.000; + advance 0.900; +}; +glyph 78 +{ + texcoords 0.304688 0.750000 0.328125 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 79 +{ + texcoords 0.375000 0.750000 0.398438 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 80 +{ + texcoords 0.445312 0.750000 0.464844 0.777344; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 81 +{ + texcoords 0.515625 0.746094 0.539062 0.777344; + size 0.600 0.800; + offset 0.100 -0.100; + advance 0.800; +}; +glyph 82 +{ + texcoords 0.585938 0.750000 0.609375 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 83 +{ + texcoords 0.656250 0.750000 0.679688 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 84 +{ + texcoords 0.726562 0.750000 0.746094 0.777344; + size 0.500 0.700; + offset 0.000 0.000; + advance 0.500; +}; +glyph 85 +{ + texcoords 0.796875 0.750000 0.820312 0.777344; + size 0.600 0.700; + offset 0.100 0.000; + advance 0.800; +}; +glyph 86 +{ + texcoords 0.859375 0.750000 0.894531 0.777344; + size 0.900 0.700; + offset -0.100 0.000; + advance 0.700; +}; +glyph 87 +{ + texcoords 0.929688 0.750000 0.964844 0.777344; + size 0.900 0.700; + offset 0.000 0.000; + advance 0.900; +}; +glyph 88 +{ + texcoords 0.023438 0.679688 0.046875 0.707031; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 89 +{ + texcoords 0.089844 0.679688 0.117188 0.707031; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.700; +}; +glyph 90 +{ + texcoords 0.164062 0.679688 0.187500 0.707031; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 91 +{ + texcoords 0.242188 0.675781 0.250000 0.710938; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 92 +{ + texcoords 0.308594 0.675781 0.320312 0.707031; + size 0.300 0.800; + offset 0.000 -0.100; + advance 0.300; +}; +glyph 93 +{ + texcoords 0.382812 0.675781 0.390625 0.710938; + size 0.200 0.900; + offset 0.100 -0.100; + advance 0.400; +}; +glyph 94 +{ + texcoords 0.445312 0.695312 0.468750 0.707031; + size 0.600 0.300; + offset 0.100 0.400; + advance 0.800; +}; +glyph 95 +{ + texcoords 0.515625 0.671875 0.535156 0.675781; + size 0.500 0.100; + offset 0.000 -0.200; + advance 0.500; +}; +glyph 96 +{ + texcoords 0.593750 0.703125 0.601562 0.710938; + size 0.200 0.200; + offset 0.100 0.600; + advance 0.500; +}; +glyph 97 +{ + texcoords 0.656250 0.679688 0.675781 0.699219; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 98 +{ + texcoords 0.726562 0.679688 0.746094 0.710938; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 99 +{ + texcoords 0.800781 0.679688 0.816406 0.699219; + size 0.400 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 100 +{ + texcoords 0.867188 0.679688 0.886719 0.710938; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 101 +{ + texcoords 0.937500 0.679688 0.957031 0.699219; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 102 +{ + texcoords 0.027344 0.609375 0.042969 0.640625; + size 0.400 0.800; + offset 0.100 0.000; + advance 0.400; +}; +glyph 103 +{ + texcoords 0.093750 0.601562 0.113281 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 104 +{ + texcoords 0.164062 0.609375 0.183594 0.640625; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 105 +{ + texcoords 0.242188 0.609375 0.246094 0.640625; + size 0.100 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 106 +{ + texcoords 0.312500 0.601562 0.320312 0.640625; + size 0.200 1.000; + offset 0.000 -0.200; + advance 0.200; +}; +glyph 107 +{ + texcoords 0.375000 0.609375 0.394531 0.640625; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.500; +}; +glyph 108 +{ + texcoords 0.453125 0.609375 0.457031 0.640625; + size 0.100 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 109 +{ + texcoords 0.507812 0.609375 0.542969 0.628906; + size 0.900 0.500; + offset 0.100 0.000; + advance 1.000; +}; +glyph 110 +{ + texcoords 0.585938 0.609375 0.605469 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 111 +{ + texcoords 0.656250 0.609375 0.675781 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 112 +{ + texcoords 0.726562 0.601562 0.746094 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 113 +{ + texcoords 0.796875 0.601562 0.816406 0.628906; + size 0.500 0.700; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 114 +{ + texcoords 0.871094 0.609375 0.882812 0.628906; + size 0.300 0.500; + offset 0.100 0.000; + advance 0.400; +}; +glyph 115 +{ + texcoords 0.937500 0.609375 0.957031 0.628906; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 116 +{ + texcoords 0.027344 0.539062 0.042969 0.566406; + size 0.400 0.700; + offset 0.000 0.000; + advance 0.400; +}; +glyph 117 +{ + texcoords 0.093750 0.539062 0.113281 0.558594; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 118 +{ + texcoords 0.160156 0.539062 0.187500 0.558594; + size 0.700 0.500; + offset 0.000 0.000; + advance 0.600; +}; +glyph 119 +{ + texcoords 0.230469 0.539062 0.257812 0.558594; + size 0.700 0.500; + offset 0.100 0.000; + advance 0.800; +}; +glyph 120 +{ + texcoords 0.304688 0.539062 0.324219 0.558594; + size 0.500 0.500; + offset 0.100 0.000; + advance 0.600; +}; +glyph 121 +{ + texcoords 0.371094 0.531250 0.398438 0.558594; + size 0.700 0.700; + offset 0.000 -0.200; + advance 0.600; +}; +glyph 122 +{ + texcoords 0.449219 0.539062 0.464844 0.558594; + size 0.400 0.500; + offset 0.100 0.000; + advance 0.500; +}; +glyph 123 +{ + texcoords 0.519531 0.535156 0.535156 0.570312; + size 0.400 0.900; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 124 +{ + texcoords 0.593750 0.531250 0.597656 0.570312; + size 0.100 1.000; + offset 0.100 -0.200; + advance 0.300; +}; +glyph 125 +{ + texcoords 0.660156 0.535156 0.675781 0.570312; + size 0.400 0.900; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 126 +{ + texcoords 0.726562 0.546875 0.750000 0.558594; + size 0.600 0.300; + offset 0.100 0.200; + advance 0.800; +}; +glyph 160 +{ + texcoords 0.808594 0.539062 0.808594 0.539062; + size 0.000 0.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 161 +{ + texcoords 0.875000 0.539062 0.878906 0.566406; + size 0.100 0.700; + offset 0.200 0.000; + advance 0.400; +}; +glyph 162 +{ + texcoords 0.941406 0.535156 0.957031 0.562500; + size 0.400 0.700; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 163 +{ + texcoords 0.023438 0.468750 0.042969 0.496094; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 164 +{ + texcoords 0.093750 0.468750 0.117188 0.496094; + size 0.600 0.700; + offset 0.000 0.000; + advance 0.600; +}; +glyph 165 +{ + texcoords 0.164062 0.468750 0.183594 0.496094; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 166 +{ + texcoords 0.242188 0.460938 0.246094 0.496094; + size 0.100 0.900; + offset 0.100 -0.200; + advance 0.300; +}; +glyph 167 +{ + texcoords 0.308594 0.464844 0.324219 0.496094; + size 0.400 0.800; + offset 0.000 -0.100; + advance 0.500; +}; +glyph 168 +{ + texcoords 0.378906 0.492188 0.390625 0.496094; + size 0.300 0.100; + offset 0.100 0.600; + advance 0.500; +}; +glyph 169 +{ + texcoords 0.441406 0.468750 0.468750 0.496094; + size 0.700 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 170 +{ + texcoords 0.515625 0.472656 0.535156 0.496094; + size 0.500 0.600; + offset 0.100 0.100; + advance 0.500; +}; +glyph 171 +{ + texcoords 0.589844 0.472656 0.605469 0.488281; + size 0.400 0.400; + offset 0.100 0.100; + advance 0.600; +}; +glyph 172 +{ + texcoords 0.656250 0.472656 0.679688 0.484375; + size 0.600 0.300; + offset 0.100 0.100; + advance 0.800; +}; +glyph 173 +{ + texcoords 0.730469 0.476562 0.742188 0.480469; + size 0.300 0.100; + offset 0.100 0.200; + advance 0.400; +}; +glyph 174 +{ + texcoords 0.792969 0.468750 0.820312 0.496094; + size 0.700 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 175 +{ + texcoords 0.871094 0.492188 0.882812 0.496094; + size 0.300 0.100; + offset 0.100 0.600; + advance 0.500; +}; +glyph 176 +{ + texcoords 0.941406 0.484375 0.953125 0.496094; + size 0.300 0.300; + offset 0.100 0.400; + advance 0.500; +}; +glyph 177 +{ + texcoords 0.019531 0.398438 0.046875 0.421875; + size 0.700 0.600; + offset 0.100 0.000; + advance 0.800; +}; +glyph 178 +{ + texcoords 0.097656 0.410156 0.109375 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 179 +{ + texcoords 0.167969 0.410156 0.179688 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 180 +{ + texcoords 0.242188 0.421875 0.250000 0.429688; + size 0.200 0.200; + offset 0.200 0.600; + advance 0.500; +}; +glyph 181 +{ + texcoords 0.304688 0.390625 0.328125 0.417969; + size 0.600 0.700; + offset 0.100 -0.200; + advance 0.700; +}; +glyph 182 +{ + texcoords 0.375000 0.394531 0.394531 0.425781; + size 0.500 0.800; + offset 0.100 -0.100; + advance 0.600; +}; +glyph 183 +{ + texcoords 0.453125 0.410156 0.457031 0.414062; + size 0.100 0.100; + offset 0.100 0.300; + advance 0.300; +}; +glyph 184 +{ + texcoords 0.523438 0.390625 0.531250 0.398438; + size 0.200 0.200; + offset 0.100 -0.200; + advance 0.500; +}; +glyph 185 +{ + texcoords 0.589844 0.410156 0.601562 0.425781; + size 0.300 0.400; + offset 0.100 0.300; + advance 0.400; +}; +glyph 186 +{ + texcoords 0.660156 0.402344 0.675781 0.425781; + size 0.400 0.600; + offset 0.100 0.100; + advance 0.500; +}; +glyph 187 +{ + texcoords 0.730469 0.402344 0.746094 0.417969; + size 0.400 0.400; + offset 0.100 0.100; + advance 0.600; +}; +glyph 188 +{ + texcoords 0.789062 0.398438 0.824219 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 189 +{ + texcoords 0.859375 0.398438 0.894531 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 190 +{ + texcoords 0.929688 0.398438 0.964844 0.425781; + size 0.900 0.700; + offset 0.100 0.000; + advance 1.000; +}; +glyph 191 +{ + texcoords 0.027344 0.328125 0.042969 0.355469; + size 0.400 0.700; + offset 0.100 0.000; + advance 0.500; +}; +glyph 192 +{ + texcoords 0.089844 0.328125 0.117188 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 193 +{ + texcoords 0.160156 0.328125 0.187500 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 194 +{ + texcoords 0.230469 0.328125 0.257812 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 195 +{ + texcoords 0.300781 0.328125 0.328125 0.367188; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 196 +{ + texcoords 0.371094 0.328125 0.398438 0.363281; + size 0.700 0.900; + offset 0.000 0.000; + advance 0.700; +}; +glyph 197 +{ + texcoords 0.441406 0.328125 0.468750 0.363281; + size 0.700 0.900; + offset 0.000 0.000; + advance 0.700; +}; +glyph 198 +{ + texcoords 0.507812 0.328125 0.542969 0.355469; + size 0.900 0.700; + offset 0.000 0.000; + advance 1.000; +}; +glyph 199 +{ + texcoords 0.585938 0.320312 0.609375 0.355469; + size 0.600 0.900; + offset 0.100 -0.200; + advance 0.800; +}; +glyph 200 +{ + texcoords 0.656250 0.328125 0.675781 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 201 +{ + texcoords 0.726562 0.328125 0.746094 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 202 +{ + texcoords 0.796875 0.328125 0.816406 0.367188; + size 0.500 1.000; + offset 0.100 0.000; + advance 0.700; +}; +glyph 203 +{ + texcoords 0.867188 0.328125 0.886719 0.363281; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.700; +}; +glyph 204 +{ + texcoords 0.945312 0.328125 0.953125 0.367188; + size 0.200 1.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 205 +{ + texcoords 0.027344 0.257812 0.039062 0.296875; + size 0.300 1.000; + offset 0.100 0.000; + advance 0.300; +}; +glyph 206 +{ + texcoords 0.097656 0.257812 0.109375 0.296875; + size 0.300 1.000; + offset 0.000 0.000; + advance 0.300; +}; +glyph 207 +{ + texcoords 0.167969 0.257812 0.179688 0.292969; + size 0.300 0.900; + offset 0.000 0.000; + advance 0.300; +}; +glyph 208 +{ + texcoords 0.230469 0.257812 0.257812 0.285156; + size 0.700 0.700; + offset 0.000 0.000; + advance 0.800; +}; +glyph 209 +{ + texcoords 0.304688 0.257812 0.328125 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 210 +{ + texcoords 0.375000 0.257812 0.398438 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 211 +{ + texcoords 0.445312 0.257812 0.468750 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 212 +{ + texcoords 0.515625 0.257812 0.539062 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 213 +{ + texcoords 0.585938 0.257812 0.609375 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 214 +{ + texcoords 0.656250 0.257812 0.679688 0.292969; + size 0.600 0.900; + offset 0.100 0.000; + advance 0.800; +}; +glyph 215 +{ + texcoords 0.726562 0.257812 0.750000 0.281250; + size 0.600 0.600; + offset 0.100 0.000; + advance 0.800; +}; +glyph 216 +{ + texcoords 0.792969 0.253906 0.824219 0.289062; + size 0.800 0.900; + offset 0.000 -0.100; + advance 0.800; +}; +glyph 217 +{ + texcoords 0.867188 0.257812 0.890625 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 218 +{ + texcoords 0.937500 0.257812 0.960938 0.296875; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 219 +{ + texcoords 0.023438 0.187500 0.046875 0.226562; + size 0.600 1.000; + offset 0.100 0.000; + advance 0.800; +}; +glyph 220 +{ + texcoords 0.093750 0.187500 0.117188 0.222656; + size 0.600 0.900; + offset 0.100 0.000; + advance 0.800; +}; +glyph 221 +{ + texcoords 0.160156 0.187500 0.187500 0.226562; + size 0.700 1.000; + offset 0.000 0.000; + advance 0.700; +}; +glyph 222 +{ + texcoords 0.234375 0.187500 0.253906 0.214844; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.700; +}; +glyph 223 +{ + texcoords 0.304688 0.187500 0.324219 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 224 +{ + texcoords 0.375000 0.187500 0.394531 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 225 +{ + texcoords 0.445312 0.187500 0.464844 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 226 +{ + texcoords 0.515625 0.187500 0.535156 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 227 +{ + texcoords 0.585938 0.187500 0.605469 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 228 +{ + texcoords 0.656250 0.187500 0.675781 0.214844; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 229 +{ + texcoords 0.726562 0.187500 0.746094 0.222656; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.600; +}; +glyph 230 +{ + texcoords 0.789062 0.187500 0.824219 0.207031; + size 0.900 0.500; + offset 0.100 0.000; + advance 1.000; +}; +glyph 231 +{ + texcoords 0.871094 0.179688 0.886719 0.207031; + size 0.400 0.700; + offset 0.100 -0.200; + advance 0.500; +}; +glyph 232 +{ + texcoords 0.937500 0.187500 0.957031 0.218750; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 233 +{ + texcoords 0.023438 0.117188 0.042969 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 234 +{ + texcoords 0.093750 0.117188 0.113281 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 235 +{ + texcoords 0.164062 0.117188 0.183594 0.144531; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 236 +{ + texcoords 0.242188 0.117188 0.250000 0.148438; + size 0.200 0.800; + offset 0.000 0.000; + advance 0.200; +}; +glyph 237 +{ + texcoords 0.312500 0.117188 0.320312 0.148438; + size 0.200 0.800; + offset 0.100 0.000; + advance 0.200; +}; +glyph 238 +{ + texcoords 0.378906 0.117188 0.390625 0.148438; + size 0.300 0.800; + offset 0.000 0.000; + advance 0.200; +}; +glyph 239 +{ + texcoords 0.449219 0.117188 0.460938 0.144531; + size 0.300 0.700; + offset 0.000 0.000; + advance 0.200; +}; +glyph 240 +{ + texcoords 0.515625 0.117188 0.535156 0.152344; + size 0.500 0.900; + offset 0.100 0.000; + advance 0.600; +}; +glyph 241 +{ + texcoords 0.585938 0.117188 0.605469 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 242 +{ + texcoords 0.656250 0.117188 0.675781 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 243 +{ + texcoords 0.726562 0.117188 0.746094 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 244 +{ + texcoords 0.796875 0.117188 0.816406 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 245 +{ + texcoords 0.867188 0.117188 0.886719 0.148438; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 246 +{ + texcoords 0.937500 0.117188 0.957031 0.144531; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 247 +{ + texcoords 0.019531 0.050781 0.046875 0.070312; + size 0.700 0.500; + offset 0.100 0.100; + advance 0.800; +}; +glyph 248 +{ + texcoords 0.089844 0.042969 0.117188 0.070312; + size 0.700 0.700; + offset 0.000 -0.100; + advance 0.600; +}; +glyph 249 +{ + texcoords 0.164062 0.046875 0.183594 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 250 +{ + texcoords 0.234375 0.046875 0.253906 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 251 +{ + texcoords 0.304688 0.046875 0.324219 0.078125; + size 0.500 0.800; + offset 0.100 0.000; + advance 0.600; +}; +glyph 252 +{ + texcoords 0.375000 0.046875 0.394531 0.074219; + size 0.500 0.700; + offset 0.100 0.000; + advance 0.600; +}; +glyph 253 +{ + texcoords 0.441406 0.039062 0.468750 0.078125; + size 0.700 1.000; + offset 0.000 -0.200; + advance 0.600; +}; +glyph 254 +{ + texcoords 0.515625 0.039062 0.535156 0.078125; + size 0.500 1.000; + offset 0.100 -0.200; + advance 0.600; +}; +glyph 255 +{ + texcoords 0.582031 0.039062 0.609375 0.074219; + size 0.700 0.900; + offset 0.000 -0.200; + advance 0.600; +}; diff --git a/dejavu-10.png b/dejavu-10.png new file mode 100644 index 0000000..1547a0b Binary files /dev/null and b/dejavu-10.png differ diff --git a/helloworld.cpp b/helloworld.cpp new file mode 100644 index 0000000..95e5f59 --- /dev/null +++ b/helloworld.cpp @@ -0,0 +1,133 @@ +/* $Id$ + +This file is part of libmspgltk +Copyright © 2008 Mikko Rasa, Mikkosoft Productions +Distributed under the LGPL +*/ + +/* +A simple graphical Hello World application implemented with mspgltk. +Demonstrates some of the most common widget types. +*/ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace Msp; + +// Application class. Because it's so much nicer than global variables. +class HelloWorld: public Msp::Application +{ +private: + // Objects for setting up an OpenGL window + Graphics::Display dpy; + Graphics::Window wnd; + Graphics::GLContext glc; + + // GLtk resources and widgets + GLtk::Resources res; + RefPtr root; + GLtk::Entry *ent_name; + GLtk::Label *lbl_hello; + + // Indicate our main class to the core library + static Application::RegApp reg; + +public: + HelloWorld(int, char **); +private: + virtual void tick(); + void show_hello(); +}; + +Application::RegApp HelloWorld::reg; + + +HelloWorld::HelloWorld(int, char **): + wnd(dpy, 200, 200), + glc(wnd) +{ + wnd.set_title("Hello World"); + wnd.signal_close.connect(sigc::bind(sigc::mem_fun(this, &HelloWorld::exit), 0)); + + // Load resources. This must be done before any widgets are created. + DataFile::load(res, "helloworld.gui"); + + // A Root receives input from a Graphics::Window and passes it on + root=new GLtk::Root(res, wnd); + + /* Container widgets will delete their contents upon destruction so we can + safely forget about the pointers after setting the widgets up. */ + + // Panels can be used to divide the window into sub-areas + GLtk::Panel *panel=new GLtk::Panel(res); + root->add(*panel); + panel->set_geometry(GLtk::Geometry(20, 20, 160, 160)); + + GLtk::Label *lbl; + // Prompts can be displayed with Labels + panel->add(*(lbl=new GLtk::Label(res, "Type your name below:"))); + lbl->set_geometry(GLtk::Geometry(10, 130, 140, 20)); + + // The user can type text into an Entry + panel->add(*(ent_name=new GLtk::Entry(res))); + ent_name->set_geometry(GLtk::Geometry(10, 110, 140, 20)); + + GLtk::Button *btn; + // Buttons can be wired to cause things to happen + panel->add(*(btn=new GLtk::Button(res, "Hello"))); + btn->set_geometry(GLtk::Geometry(10, 85, 140, 20)); + btn->signal_clicked.connect(sigc::mem_fun(this, &HelloWorld::show_hello)); + + // Another label for displaying some information + panel->add(*(lbl_hello=new GLtk::Label(res))); + lbl_hello->set_geometry(GLtk::Geometry(10, 65, 140, 20)); + + // The user might want to exit the program (*gasp*) + panel->add(*(btn=new GLtk::Button(res, "Exit"))); + btn->set_geometry(GLtk::Geometry(50, 10, 100, 20)); + btn->signal_clicked.connect(sigc::bind(sigc::mem_fun(this, &HelloWorld::exit), 0)); + + // Font rendering requires blending + GL::enable(GL::BLEND); + GL::blend_func(GL::SRC_ALPHA, GL::ONE_MINUS_SRC_ALPHA); + + // Done with setting things up, show the window! + wnd.show(); +} + +// This function will be called periodically from the main loop +void HelloWorld::tick() +{ + dpy.tick(); + + // Set up an orthogonal projection matching the root widget + GL::matrix_mode(GL::PROJECTION); + GL::load_identity(); + GL::ortho_bottomleft(200, 200); + GL::matrix_mode(GL::MODELVIEW); + GL::load_identity(); + + root->render(); + + glc.swap_buffers(); +} + +// Displays a greeting to the user +void HelloWorld::show_hello() +{ + lbl_hello->set_text("Hello, "+ent_name->get_text()+"!"); +} diff --git a/helloworld.gui b/helloworld.gui new file mode 100644 index 0000000..94188c7 --- /dev/null +++ b/helloworld.gui @@ -0,0 +1,106 @@ +/* $Id$ */ + +default_font "dejavu-10.font"; + +graphic "button_bg" +{ + texture "helloworld.png"; + slice 0 54 20 10; + border { left 3; right 3; top 3; bottom 3; }; +}; + +graphic "button_bg_pressed" +{ + texture "helloworld.png"; + slice 22 54 20 10; + border { left 3; right 3; top 3; bottom 3; }; +}; + +style "button" +{ + font_color 0.0 0.0 0.0; + + part + { + graphic NORMAL "button_bg"; + graphic ACTIVE "button_bg_pressed"; + }; + + special "text" + { + align 0.5 0.5; + fill 0.0 0.0; + margin { left 3; right 3; top 3; bottom 3; }; + }; +}; + +style "label" +{ + font_color 0.0 0.0 0.0; + + special "text" + { + align 0.5 0.5; + fill 0.0 0.0; + }; +}; + +graphic "entry_bg" +{ + texture "helloworld.png"; + slice 0 42 20 10; + border { left 3; right 3; top 3; bottom 3; }; +}; + +graphic "entry_cursor" +{ + texture "helloworld.png"; + slice 22 42 1 10; +}; + +style "entry" +{ + font_color 0.0 0.0 0.0; + + part + { + graphic NORMAL "entry_bg"; + }; + + special "text" + { + align 0.0 0.5; + fill 0.0 0.0; + margin { left 3; right 3; top 3; bottom 3; }; + }; + + special "cursor" + { + graphic FOCUS "entry_cursor"; + align 0.0 0.0; + fill 0.0 1.0; + margin { left 3; right 3; top 3; bottom 3; }; + }; +}; + +graphic "panel_bg" +{ + texture "helloworld.png"; + slice 0 20 20 20; + border { left 4; right 4; top 4; bottom 4; }; +}; + +style "panel" +{ + part + { + graphic NORMAL "panel_bg"; + }; + + special "children"; +}; + +style "root" +{ + special "children"; +}; diff --git a/helloworld.png b/helloworld.png new file mode 100644 index 0000000..86b945a Binary files /dev/null and b/helloworld.png differ