This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//split string path using boost | |
//https://stackoverflow.com/questions/10099206/howto-parse-a-path-to-a-vector-using-c | |
//boost::filesystem::path p1("/usr/local/bin"); | |
boost::filesystem::path p1(videoFilePath.get()); | |
//boost::filesystem::path p2("c:\\"); | |
std::cout << p1.filename() << std::endl; // prints "bin" | |
std::cout << p1.parent_path() << std::endl; // prints "/usr/local" | |
videoName = ofToString(p1.filename()); | |
filename: "NightmoVES4.mov" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImGui::CreateContext(); | |
ImGuiIO& io = ImGui::GetIO(); | |
io.Fonts->AddFontFromFileTTF(&ofToDataPath("ofxPresetsManager/fonts/overpass-mono-bold.otf")[0], 12.0f); | |
gui.setup(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//h | |
ofParameter<float> _edgeSlope; | |
//convert string to char pointer | |
string _str = parameter.getName(); | |
const char * _name(_str.c_str()); | |
/cpp | |
//setup | |
_edgeSlope.set("edgeSlope", 0.3f, 0.0f, 1.0f); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template<typename ParameterType> | |
bool AddParameter(ofParameter<ParameterType>& parameter); | |
//-------------------------------------------------------------- | |
template<typename ParameterType> | |
bool ofxImGui::AddParameter(ofParameter<ParameterType>& parameter) | |
{ | |
auto tmpRef = parameter.get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//h | |
void loadGroup(ofParameterGroup &g, string path); | |
void saveGroup(ofParameterGroup &g, string path); | |
//cpp | |
//-------------------------------------------------------------- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//2 snippets from here: | |
//https://github.com/ocornut/imgui/issues/1537 | |
//1. styled rounded toggle button with animation | |
//add into ofApp.cpp | |
namespace ImGui { | |
void ToggleButton(const char* str_id, bool* v) | |
{ | |
ImVec2 p = ImGui::GetCursorScreenPos(); | |
ImDrawList* draw_list = ImGui::GetWindowDrawList(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//https://github.com/ocornut/imgui/issues/942#issuecomment-268369298 | |
//put code into ofApp.cpp and use between begin/end: | |
if (MyKnob("attack", &myKnob, 0.f, 10.f)) | |
{ | |
cout << "knob:" << myKnob << endl; | |
} | |
// Implementing a simple custom widget using the public API. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ofApp::CheckFolder(string _path) | |
{ | |
ofDirectory dataDirectory(ofToDataPath(_path, true)); | |
//check if target data folder exist | |
if (!dataDirectory.isDirectory()) | |
{ | |
ofLogError("__FUNCTION__") << "FOLDER DOES NOT EXIST!"; | |
//create folder |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//.h | |
// For drawing | |
float waveform[4096]; //make this bigger, just in case | |
int waveIndex; | |
ofSoundStream soundStream; | |
/* ofxMaxi*/ | |
void audioIn(ofSoundBuffer& input) override; // not used in this example | |
void audioOut(ofSoundBuffer& output) override; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// my own helper | |
template<typename ParameterType> | |
bool AddParameter(ofParameter<ParameterType>& parameter); | |
// my own helper | |
//-------------------------------------------------------------- | |
template<typename ParameterType> | |
bool ofApp::AddParameter(ofParameter<ParameterType>& parameter) | |
{ |