void process_text(char *in_buffer) { uint8_t last_pos = *ringbuffer_pos; char buffer[64] = {0}; while(1) { uint8_t new_pos; while(last_pos == (new_pos = *ringbuffer_pos)) { uint64_t info = wait_for_interrupt(); if(INT_ID(info) == CLOCK_ID) { toggle_pos(cursor_pos, normal, inverted); } } while(last_pos != new_pos) { uint8_t c; c = keyboard_ringbuffer[last_pos]; process_char(c,1); last_pos = ((last_pos + 1) % RINGBUFFER_SIZE); if(c == '\r') { strcpy(in_buffer, input); process_char('\r',0); input_size = 0; memset(input,0,sizeof(input)); goto done; } } } done: return; }
void process_text(char *in_buffer, int remaining) { uint8_t last_pos = *ringbuffer_pos; char buffer[64] = {0}; if(remaining > 0) { //Dammit there's no standard library so I can't use sprintf :( strcpy(buffer,"You have guesses remaining\r>"); if(remaining >= 10) { buffer[9] = '0' + (remaining/10); } buffer[10] = '0' + (remaining%10); process_string(buffer); } else { process_string("You ran out, I picked a new number\r>"); } while(1) { uint8_t new_pos; while(last_pos == (new_pos = *ringbuffer_pos)) { uint64_t info = wait_for_interrupt(); if(INT_ID(info) == CLOCK_ID) { toggle_pos(cursor_pos, normal, inverted); } } while(last_pos != new_pos) { uint8_t c; c = keyboard_ringbuffer[last_pos]; process_char(c,1); last_pos = ((last_pos + 1) % RINGBUFFER_SIZE); if(c == '\r') { memcpy(in_buffer, input, input_size); input_size = 0; memset(input,0,sizeof(input)); goto done; } } } done: return; }
void ofxSimpleGui::render(float xpos, float ypos) { if(!doRender) return; //ofSetupScreen(); glPushMatrix(); glTranslatef(0, 0, 0); ofPoint offset(10, 10); xspace = 10; yspace = 10; int sp = 50; //Gui Title guiTitle.render(xpos, GUI_OFFSET_Y+ypos); //Save XML Button saveButton->render(xpos, GUI_OFFSET_Y+42+ypos); yspace += sp; //Sliders 2d ofPoint slider2d_pos(0, 0); for(int i=0; i<sliders2d.size(); i++) { slider2d_pos.x = xpos+260 + ((i%3) * (SLIDER2D_W+5)); slider2d_pos.y = ypos+GUI_OFFSET_Y+77 + (floor(i/3) * (SLIDER2D_H+50)); sliders2d[i]->render(slider2d_pos.x, slider2d_pos.y); if(guiFocus == sliders2d[i]->guiID) sliders2d[i]->focused = true; else sliders2d[i]->focused = false; } //Movie ofPoint movie_pos(GUI_OFFSET_X+250, 250); for(int i=0; i<slidersMovie.size(); i++) { slidersMovie[i]->render(movie_pos.x, movie_pos.y); movie_pos.y += 66; } //Int Slider ofPoint slider_pos(GUI_OFFSET_X, GUI_OFFSET_Y+40+ypos); for(int i=0; i<slidersI.size(); i++) { slider_pos.x = xpos; slider_pos.y += SLIDER_H+25; slidersI[i]->render(slider_pos.x, slider_pos.y); if(guiFocus == slidersI[i]->guiID) slidersI[i]->focused = true; else slidersI[i]->focused = false; } //Float Slider for(int i=0; i<slidersF.size(); i++) { slider_pos.x = xpos; slider_pos.y += SLIDER_H+25; slidersF[i]->render(slider_pos.x, slider_pos.y); if(guiFocus == slidersF[i]->guiID) slidersF[i]->focused = true; else slidersF[i]->focused = false; } //Toggles ofPoint toggle_pos(GUI_OFFSET_X, slider_pos.y+45); for(int i=0; i<toggles.size(); i++) { toggle_pos.x = xpos; toggles[i]->render(toggle_pos.x, toggle_pos.y); if(guiFocus == toggles[i]->guiID) toggles[i]->focused = true; else toggles[i]->focused = false; toggle_pos.y += 25; } //VIDEO WARPER for(int i=0; i<quadWarpers.size(); i++) { quadWarpers[i]->render(); } glPopMatrix(); }