Skip to content

Commit

Permalink
WIP on support for configurable data dir
Browse files Browse the repository at this point in the history
  • Loading branch information
mattfelsen committed Mar 21, 2016
1 parent a42c490 commit bb3f814
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
10 changes: 10 additions & 0 deletions src/ofxDatGui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ void ofxDatGui::init()
mThemeChanged = false;
mAlignmentChanged = false;
mAlignment = ofxDatGuiAlignment::LEFT;
mDataDir = "ofxbraitsch/";

// load a default theme //
if (theme == nullptr) theme = make_unique<ofxDatGuiTheme>(true);
mAlpha = 1.0f;
Expand Down Expand Up @@ -173,6 +175,14 @@ void ofxDatGui::setLabelAlignment(ofxDatGuiAlignment align)
mAlignmentChanged = true;
}

void ofxDatGui::setDataDir(const std::string& dir) {
mDataDir = dir;
}

string ofxDatGui::getDataDir() {
return mDataDir;
}

int ofxDatGui::getWidth()
{
return mWidth;
Expand Down
6 changes: 5 additions & 1 deletion src/ofxDatGui.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,10 @@ class ofxDatGui : public ofxDatGuiInteractiveObject
void setTheme(ofxDatGuiTheme* t);
void setAutoDraw(bool autodraw, int priority = 0);
void setLabelAlignment(ofxDatGuiAlignment align);


static void setDataDir(const std::string& dir);
static string getDataDir();

int getWidth();
int getHeight();
bool getFocused();
Expand Down Expand Up @@ -120,6 +123,7 @@ class ofxDatGui : public ofxDatGuiInteractiveObject
static ofxDatGui* mActiveGui;
static vector<ofxDatGui*> mGuis;
static unique_ptr<ofxDatGuiTheme> theme;
static string mDataDir;

void init();
void layoutGui();
Expand Down
11 changes: 6 additions & 5 deletions src/themes/ofxDatGuiTheme.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

#pragma once
#include "ofMain.h"
#include "ofxDatGui.h"
#include "ofxSmartFont.h"

#define RETINA_MIN_WIDTH 2560
Expand Down Expand Up @@ -207,15 +208,15 @@ class ofxDatGuiTheme{

struct {
int size = 6;
string file = "ofxbraitsch/fonts/Verdana.ttf";
string file = ofxDatGui::getDataDir() + "fonts/Verdana.ttf";
shared_ptr<ofxSmartFont> ptr;
} font;

struct{
string rainbow = "ofxbraitsch/ofxdatgui/picker-rainbow.png";
string radioOn = "ofxbraitsch/ofxdatgui/icon-radio-on.png";
string radioOff = "ofxbraitsch/ofxdatgui/icon-radio-off.png";
string dropdown = "ofxbraitsch/ofxdatgui/icon-dropdown.png";
string rainbow = ofxDatGui::getDataDir() + "ofxdatgui/picker-rainbow.png";
string radioOn = ofxDatGui::getDataDir() + "ofxdatgui/icon-radio-on.png";
string radioOff = ofxDatGui::getDataDir() + "ofxdatgui/icon-radio-off.png";
string dropdown = ofxDatGui::getDataDir() + "ofxdatgui/icon-dropdown.png";
} icon;

static ofColor hex(int n)
Expand Down

0 comments on commit bb3f814

Please sign in to comment.