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
//ofApp.h | |
ofTrueTypeFont font; | |
float fontSize; | |
//-------------------------------------------------------------- | |
void drawTextBoxed(string text, int x, int y, int alpha = 255) | |
{ | |
ofPushStyle(); | |
int pad = 20; |
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
//check if a folder path exist and creates one if not | |
//many times when you try to save a file, this is not possible and do not happens bc the container folder do not exist | |
//-------------------------------------------------------------- | |
void CheckFolder(string _path) | |
{ | |
ofLogNotice(__FUNCTION__) << _path; | |
ofDirectory dataDirectory(ofToDataPath(_path, true)); |
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
params.setName("myGroupParameters"); | |
params.add(separation.set("separation", 5, 1, 100)); | |
separationREF.makeReferenceTo(separation); | |
params.add(separationREF.set("separationREF", 5, 1, 100)); | |
//separationREF - separation are linked |
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) | |
{ |
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
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
//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
//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
//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
template<typename ParameterType> | |
bool AddParameter(ofParameter<ParameterType>& parameter); | |
//-------------------------------------------------------------- | |
template<typename ParameterType> | |
bool ofxImGui::AddParameter(ofParameter<ParameterType>& parameter) | |
{ | |
auto tmpRef = parameter.get(); |