GUI: save per-chan osc state

This commit is contained in:
tildearrow 2022-06-23 04:02:41 -05:00
parent abbd6e7274
commit 1b5396e814
4 changed files with 50 additions and 5 deletions

View file

@ -19,6 +19,7 @@
#include "gui.h"
#include "imgui.h"
#include <fmt/printf.h>
#include <math.h>
ImU32 Gradient2D::get(float x, float y) {
@ -31,6 +32,19 @@ ImU32 Gradient2D::get(float x, float y) {
return grad[yi*width+xi];
}
String Gradient2D::toString() {
String ret=fmt::sprintf("GRAD #%.2X%.2X%.2X%.2X",(unsigned char)(bgColor.x*255.0f),(unsigned char)(bgColor.y*255.0f),(unsigned char)(bgColor.z*255.0f),(unsigned char)(bgColor.w*255.0f));
for (Gradient2DPoint& i: points) {
ret+=fmt::sprintf(" %f,%f:%f,%f:#%.2X%.2X%.2X%.2X",i.x,i.y,i.distance,i.spread,(unsigned char)(i.color.x*255.0f),(unsigned char)(i.color.y*255.0f),(unsigned char)(i.color.z*255.0f),(unsigned char)(i.color.w*255.0f));
}
return ret;
}
// TODO: this one please
bool Gradient2D::fromString(String val) {
return false;
}
void Gradient2D::render() {
ImU32* g=grad.get();
ImU32 bgColorU=ImGui::ColorConvertFloat4ToU32(bgColor);