Skip to content

Instantly share code, notes, and snippets.

View moebiussurfing's full-sized avatar
🔥

moebiusSurfing moebiussurfing

🔥
View GitHub Profile
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active August 16, 2022 08:44
openFrameworks | ofParameters callbacks using modern lambdas. Exclusive toggle bool's behaviour. ofParameterGroup different types filtetering / casting too.
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup(){
ofSetFrameRate(30);
listenerMouse = ofEvents().mousePressed.newListener([this](ofMouseEventArgs&mouse) {
ofLogNotice() << __FUNCTION__ << "mouse:"<<ofToString(mouse);
});
@moebiussurfing
moebiussurfing / ofApp.cpp
Created January 5, 2021 20:18
openFrameworks | ofxImGui fbo + image + texture + clickable
//.h
ofTexture tex;
ofFbo fbo;
void quantizerRefreshImage();
//.cpp
//setup
bool b = ofGetUsingArbTex();
ofDisableArbTex();
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active January 21, 2023 10:14
openFrameworks | Int / Lambda callbacks : ofParameters
ofParameter<int> MODE_COLOR{ "Palette Type", 1, 1, 3 };
ofParameter<int> MODE_SORTING{ "Sorting Mode", 0, 1, 5 };
ofParameter<bool> bPlayerBeat{"Next", false};
ofEventListener listener_ModeColor;
ofEventListener listener_ModeSorting;
ofEventListener listener_Beat;
//--------------------------------------------------------------
listener_ModeSorting = MODE_SORTING.newListener([this](int &i) {
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active January 5, 2021 20:19
openFrameworks / ofParameters cast
// 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
//--
@moebiussurfing
moebiussurfing / CaptureWindow.h
Created September 10, 2020 22:24
openFrameworks / CaptureWindow.h : realtime video capturer for Windows. Using ofxFFmpegRecorder & ofxFastFboReader
#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"
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active August 22, 2020 16:55
openFrameworks / get a widget/parameter from and ofxGuiGroup
//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
@moebiussurfing
moebiussurfing / ofApp.cpp
Created August 5, 2020 22:59
openFrameworks / customize ofxGui theme dark theme
//ofxGui theme
//.cpp
//setup
setTheme_ofxGui();
//ofApp.h
void setTheme_ofxGui()
{
string pathFont = "assets/fonts/overpass-mono-bold.otf";
@moebiussurfing
moebiussurfing / ofApp.cpp
Created August 4, 2020 09:45
openFrameworks / quaternions euler glimbal lock
https://forum.openframeworks.cc/t/best-way-to-convert-between-euler-angles-and-quaternions-avoiding-gimbal-lock/34296/2
@moebiussurfing
moebiussurfing / ofApp.cpp
Last active August 3, 2020 21:19
openFrameworks / Windows set window on top
HWND AppWindow = GetActiveWindow();
SetWindowPos(AppWindow, HWND_TOPMOST, NULL, NULL, NULL, NULL, SWP_NOMOVE | SWP_NOSIZE);
@moebiussurfing
moebiussurfing / ofApp.cpp
Created July 19, 2020 05:44
openframeworks / ofxImGui / my custom ImGui helpers: big button and big toggle for bool parameters
//AddBigButton(bRandomizeIndex, 25);//index
AddBigButton(bRandomizeEditor, 25);//preset
AddBigToggle(PLAY_RandomizeTimer, 30);
//--
//my custom ImGui helpers
////toggle ImGui button
////https://github.com/ocornut/imgui/issues/1537
//--------------------------------------------------------------