Skip to content

Instantly share code, notes, and snippets.

@pwenzel
Created October 30, 2019 14:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pwenzel/f97f3a4a738f6d4fc9268d13259f23f2 to your computer and use it in GitHub Desktop.
Save pwenzel/f97f3a4a738f6d4fc9268d13259f23f2 to your computer and use it in GitHub Desktop.
oscilloscope-letters-module.c
// For use within OsciStudio by Jerobeam Fenderson
#include <OsciText.h>
SLIDER(which,0..37);
// Letters
OsciText text1("A");
OsciText text2("B");
OsciText text3("C");
OsciText text4("D");
OsciText text5("E");
OsciText text6("F");
OsciText text7("G");
OsciText text8("H");
OsciText text9("I");
OsciText text10("J");
OsciText text11("K");
OsciText text12("L");
OsciText text13("M");
OsciText text14("N");
OsciText text15("O");
OsciText text16("P");
OsciText text17("Q");
OsciText text18("R");
OsciText text19("S");
OsciText text20("T");
OsciText text21("U");
OsciText text22("V");
OsciText text23("W");
OsciText text24("X");
OsciText text25("Y");
OsciText text26("Z");
// Numbers
OsciText text27("0");
OsciText text28("1");
OsciText text29("2");
OsciText text30("3");
OsciText text31("4");
OsciText text32("5");
OsciText text33("6");
OsciText text34("7");
OsciText text35("8");
OsciText text36("9");
vec3 gen_text(float t, OsciText & text){
return text.gen(t,OsciText::Center,OsciText::Middle,1,1,0.5);
}
vec3 gen(float t){
int idx = clamp(which,0,37);
switch(idx){
case 0: return gen_text(t, text1);
case 1: return gen_text(t, text1);
case 2: return gen_text(t, text2);
case 3: return gen_text(t, text3);
case 4: return gen_text(t, text4);
case 5: return gen_text(t, text5);
case 6: return gen_text(t, text6);
case 7: return gen_text(t, text7);
case 8: return gen_text(t, text8);
case 9: return gen_text(t, text9);
case 10: return gen_text(t, text10);
case 11: return gen_text(t, text11);
case 12: return gen_text(t, text12);
case 13: return gen_text(t, text13);
case 14: return gen_text(t, text14);
case 15: return gen_text(t, text15);
case 16: return gen_text(t, text16);
case 17: return gen_text(t, text17);
case 18: return gen_text(t, text18);
case 19: return gen_text(t, text19);
case 20: return gen_text(t, text20);
case 21: return gen_text(t, text21);
case 22: return gen_text(t, text22);
case 23: return gen_text(t, text23);
case 24: return gen_text(t, text24);
case 25: return gen_text(t, text25);
case 26: return gen_text(t, text26);
case 27: return gen_text(t, text27);
case 28: return gen_text(t, text28);
case 29: return gen_text(t, text29);
case 30: return gen_text(t, text30);
case 31: return gen_text(t, text31);
case 32: return gen_text(t, text32);
case 33: return gen_text(t, text33);
case 34: return gen_text(t, text34);
case 35: return gen_text(t, text35);
default:
case 36: return gen_text(t, text36);
}
}
@pwenzel
Copy link
Author

pwenzel commented Oct 30, 2019

For anyone that finds this on the internet, this is not a concise programming example and I am not proud of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment