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_color_gradient.cpp | |
// imgui extension | |
// | |
// Created by David Gallardo on 11/06/16. | |
#include "imgui_color_gradient.h" | |
#include "imgui_internal.h" |
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
namespace ImGui | |
{ | |
static bool SelectFile(const std::string &path, std::string &selected, const std::vector<std::string> &ext={}) { | |
bool ret = false; | |
if(ofFile(path).isDirectory()) { | |
if(TreeNode(ofFilePath::getBaseName(path).c_str())) { | |
ofDirectory dir; | |
if(!ext.empty()) { | |
dir.allowExt(""); | |
for(auto &&e : ext) { |
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
if (ofxImGui::BeginWindow("TEST", mainSettings, flags)){ | |
ImGui::BeginGroup(); | |
{ | |
int numRows = 2; | |
int numWidgets = 3; | |
float spcx =ImGui::GetStyle().ItemSpacing.x; | |
float spcy =ImGui::GetStyle().ItemSpacing.y; | |
float maxWidth = ImGui::GetContentRegionAvail().x - spcx; |
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
// casting ofParameters | |
float v = static_cast<ofParameter<float>&>(parameter); | |
ofParameter<float> prop = static_cast<ofParameter<float>&>(parameter); | |
ofParameter<float> prop = parameter.cast<float>(); | |
//which internally does the static cast you are using now. | |
//https://forum.openframeworks.cc/t/ofparametergroup-best-practices/18752/8 | |
//-- |
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 | |
ofTexture tex; | |
ofFbo fbo; | |
void quantizerRefreshImage(); | |
//.cpp | |
//setup | |
bool b = ofGetUsingArbTex(); | |
ofDisableArbTex(); |
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
//pass parameter as reference? | |
//https://forum.openframeworks.cc/t/its-posible-to-pass-reference-to-an-ofparameter-float-as-a-simple-c-float-type/34301 | |
ofParameter<float> fParam; | |
ofxPrintMyVars::addFloat("myFloat", (float*)&fParam.get()); | |
//- | |
ofApp.cpp | |
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
#pragma once | |
#include "ofMain.h" | |
//TODO: BUG: when enabled antialias 16 or RGBF32 recording goes grey...? | |
//windows ffmpeg screen recorder | |
#ifdef TARGET_WIN32 | |
#include "ofxFFmpegRecorder.h" | |
#include "ofxFastFboReader.h" |
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://forum.openframeworks.cc/t/can-iterate-though-all-ofxgui-elements/35047/11 | |
//https://forum.openframeworks.cc/t/its-posible-to-avoid-ofxgui-float-ofxslider-label-style-2-8e-15-to-0-000028/35953/2 | |
gui.setup(parameters); | |
//iterate through all elements of this gui | |
for (int i = 0; i < gui.getNumControls(); i++) { | |
auto control = gui.getControl(i); | |
//check if one of the elements might be a parameterGroup; i.e. parameter contains multiple items |
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
//ofxGui theme | |
//.cpp | |
//setup | |
setTheme_ofxGui(); | |
//ofApp.h | |
void setTheme_ofxGui() | |
{ | |
string pathFont = "assets/fonts/overpass-mono-bold.otf"; |
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 | |
//-------------------------------------------------------------- |