CFLAGS = $(warn) $(opt) $(dbg) $(inc) `pkg-config --cflags sdl2`
CXXFLAGS = -std=c++11 $(warn) $(opt) $(dbg) $(inc) `pkg-config --cflags sdl2`
-LDFLAGS = $(libgl) -lgmath -limago -lgoatvr -loptcfg `pkg-config --libs sdl2`
+LDFLAGS = $(libgl) -lgmath -limago -lgoatvr -loptcfg -ldrawtext `pkg-config --libs sdl2`
ifeq ($(shell uname -s), Darwin)
#include "gmath/gmath.h"
#include "opengl.h"
#include "app.h"
+#include "drawtext.h"
static IconRenderer *iconrend;
static FSNode *cur_node;
static int start_child;
+static dtx_font *fat_font;
+#define FAT_FONT_SZ 32
+
+
bool init_fs()
{
iconrend = new ShapesIcons;
return false;
}
+ if(!(fat_font = dtx_open_font("data/fat.font", FAT_FONT_SZ))) {
+ fprintf(stderr, "failed to open font file data/fat.font\n");
+ return false;
+ }
+
cur_node = get_fsnode(0);
cur_node->expand();
return true;
for(int i=0; i<nchildren; i++) {
int idx = (i + first) % nchildren;
+ FSNode *node = cur_node->children[idx];
- if(cur_node->children[idx]->type == FSTYPE_DIR) {
+ if(node->type == FSTYPE_DIR) {
continue;
}
- Vec3 pos = icon_pos(row, col, ncols, row_spacing, radius);
+ float angle = -2.0 * M_PI * (float)col / (float)ncols;
Mat4 xform = base_xform;
- xform.translate(pos);
+ xform.translate(0, row * row_spacing, -radius);
+ xform.rotate_y(angle);
glPushMatrix();
glMultMatrixf(xform[0]);
- iconrend->draw(cur_node->children[idx]);
+ iconrend->draw(node);
+ glPopMatrix();
+
+ glPushMatrix();
+ xform = Mat4::identity;
+ xform.translate(-dtx_string_width(node->path.get_name()) / 2.0, 0, 0);
+ xform.scale(0.01);
+ xform.translate(0, 1 + row * row_spacing, -radius);
+ xform.rotate_y(angle);
+ glMultMatrixf(xform[0]);
+
+ dtx_string(node->path.get_name());
glPopMatrix();
if(++col >= ncols) {