void handle_key_1(s32 val) { if(val == 0) { return; } if(altMode) { if(check_key(1)) { // show / hide on play screen net_toggle_in_play(*pageSelect); // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } } else { if(check_key(1)) { // show preset name in head region draw_preset_name(); // include / exclude in preset net_toggle_in_preset(*pageSelect); // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } } show_foot(); }
// scroll the current selection void select_scroll(s8 dir) { const s32 max = net_num_ops() - 1; s16 newSel; s16 newIdx; if(dir < 0) { /// SCROLL DOWN // if selection is already zero, do nothing if(*pageSelect == 0) { // print_dbg("\r\n reached min selection in inputs scroll. "); return; } // remove highlight from old center render_scroll_apply_hl(SCROLL_CENTER_LINE, 0); // decrement selection newSel = *pageSelect - 1; ///// these bounds checks shouldn't really be needed here... // if(newSel < 0) { newSel = 0; } // if(newSel > max ) { newSel = max; } *pageSelect = newSel; // add new content at top newIdx = newSel - SCROLL_LINES_BELOW; if(newIdx < 0) { // empty row region_fill(lineRegion, 0); } else { render_line(newIdx); } // render tmp region to bottom of scroll // (this also updates scroll byte offset) render_to_scroll_top(); // add highlight to new center render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); } else { // SCROLL UP // if selection is already max, do nothing if(*pageSelect == max) { // print_dbg("\r\n reached max selection in inputs scroll. "); return; } // remove highlight from old center render_scroll_apply_hl(SCROLL_CENTER_LINE, 0); // increment selection newSel = *pageSelect + 1; *pageSelect = newSel; // add new content at bottom of screen newIdx = newSel + SCROLL_LINES_ABOVE; if(newIdx > max) { // empty row region_fill(lineRegion, 0); } else { render_line(newIdx); } // render tmp region to bottom of scroll // (this also updates scroll byte offset) render_to_scroll_bottom(); // add highlight to new center render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); } }
// scroll the current selection static void select_scroll(s32 dir) { // index for new content s16 newIdx; s16 newSel; if(dir < 0) { /// SCROLL DOWN if(*pageSelect == 0) { return; } // remove highlight from old center // render_scroll_apply_hl(SCROLL_CENTER_LINE, 0); // redraw center row without editing cursor, etc render_line(*pageSelect, 0xa); // copy to scroll render_to_scroll_center(); newSel = *pageSelect - 1; *pageSelect = newSel; // add new content at top newIdx = newSel - SCROLL_LINES_BELOW; if(newIdx < 0) { // empty row region_fill(lineRegion, 0); } else { render_line(newIdx, 0xa); } // render tmp region to bottom of scroll // (this also updates scroll byte offset) render_to_scroll_top(); // add highlight to new center render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); } else { // SCROLL UP // if selection is already max, do nothing if(*pageSelect == (maxPresetIdx) ) { return; } // remove highlight from old center render_scroll_apply_hl(SCROLL_CENTER_LINE, 0); // increment selection newSel = *pageSelect + 1; *pageSelect = newSel; // add new content at bottom of screen newIdx = newSel + SCROLL_LINES_ABOVE; if(newIdx > maxPresetIdx) { // empty row region_fill(lineRegion, 0); } else { render_line(newIdx, 0xa); } // render tmp region to bottom of scroll // (this also updates scroll byte offset) render_to_scroll_bottom(); // add highlight to new center render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); } }
void render_hobd_imu_sample_time( const config_s * const config, const hobd_imu_sample_time_s * const data, const GLdouble base_x, const GLdouble base_y ) { char string[512]; GLdouble delta_y = 5.0; const GLdouble bound_x = 355.0; const GLdouble text_yoff = 15.0; const GLdouble text_xoff = 5.0; render_line( base_x, base_y, base_x + bound_x, base_y ); snprintf( string, sizeof(string), "rx_time : %lu", (unsigned long) data->rx_time ); render_text_2d( base_x + text_xoff, base_y + text_yoff, string, NULL ); render_line( base_x, base_y + text_yoff + delta_y, base_x + bound_x, base_y + text_yoff + delta_y ); delta_y += 15.0; snprintf( string, sizeof(string), "sample_time : %lu", (unsigned long) data->sample_time ); render_text_2d( base_x + text_xoff, base_y + text_yoff + delta_y, string, NULL ); delta_y += 5.0; render_line( base_x, base_y + text_yoff + delta_y, base_x + bound_x, base_y + text_yoff + delta_y ); }
//------------------------------------------------------------------------ void outline_aa::render_line(int x1, int y1, int x2, int y2) { enum dx_limit_e { dx_limit = 16384 << poly_base_shift }; int dx = x2 - x1; if(dx >= dx_limit || dx <= -dx_limit) { int cx = (x1 + x2) >> 1; int cy = (y1 + y2) >> 1; render_line(x1, y1, cx, cy); render_line(cx, cy, x2, y2); }
uint8* PPU::Cache::tile_2bpp(unsigned tile) { if(tilevalid[0][tile] == 0) { tilevalid[0][tile] = 1; uint8 *output = (uint8*)tiledata[0] + (tile << 6); unsigned offset = tile << 4; unsigned y = 8; unsigned color, d0, d1; while(y--) { d0 = memory::vram[offset + 0]; d1 = memory::vram[offset + 1]; #define render_line(mask) \ color = !!(d0 & mask) << 0; \ color |= !!(d1 & mask) << 1; \ *output++ = color render_line(0x80); render_line(0x40); render_line(0x20); render_line(0x10); render_line(0x08); render_line(0x04); render_line(0x02); render_line(0x01); #undef render_line offset += 2; } } return tiledata[0] + (tile << 6); }
uint8* PPU::Cache::tile_4bpp(unsigned tile) { if(tilevalid[1][tile] == 0) { tilevalid[1][tile] = 1; uint8 *output = (uint8*)tiledata[1] + (tile << 6); unsigned offset = tile << 5; unsigned y = 8; unsigned color, d0, d1, d2, d3; while(y--) { d0 = ppu.vram[offset + 0]; d1 = ppu.vram[offset + 1]; d2 = ppu.vram[offset + 16]; d3 = ppu.vram[offset + 17]; #define render_line(mask) \ color = !!(d0 & mask) << 0; \ color |= !!(d1 & mask) << 1; \ color |= !!(d2 & mask) << 2; \ color |= !!(d3 & mask) << 3; \ *output++ = color render_line(0x80); render_line(0x40); render_line(0x20); render_line(0x10); render_line(0x08); render_line(0x04); render_line(0x02); render_line(0x01); #undef render_line offset += 2; } } return tiledata[1] + (tile << 6); }
void ff_vorbis_floor1_render_list(floor1_entry_t * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples) { int lx, ly, i; lx = 0; ly = y_list[0] * multiplier; for (i = 1; i < values; i++) { int pos = list[i].sort; if (flag[pos]) { render_line(lx, ly, list[pos].x, y_list[pos] * multiplier, out, samples); lx = list[pos].x; ly = y_list[pos] * multiplier; } if (lx >= samples) break; } if (lx < samples) render_line(lx, ly, samples, ly, out, samples); }
// redraw all lines, force selection void redraw_ins(void) { u8 i=0; s32 n = *pageSelect - 3; // num_ins() includes param count! const s32 max = net_num_ins() - 1; // set scroll region // FIXME: should be separate function i guess render_set_scroll(¢erScroll); print_dbg("\r\n redraw_ins() "); while(i<8) { if(n == -1) { // draw a blank line region_fill(lineRegion, 0); } else if(n == (max+1)) { // draw a blank line region_fill(lineRegion, 0); } else { if(n < -1) { n += (max + 2); } if( n > max ) { n -= (max + 2); } render_line( n, 0xa ); } render_to_scroll_line(i, n == *pageSelect ? 1 : 0); ++i; ++n; } }
void PPU::render_scanline() { if(line >= 1 && line < (!overscan() ? 225 : 240)) { if(framecounter) return; render_line_oam_rto(); render_line(); } }
// function key handlers void handle_key_0(s32 val) { if(val == 0) { return; } if(altMode) { ///// follow // select target on ins page tmpTarget = net_get_target(*pageSelect); if(tmpTarget >= 0) { pages[ePageIns].select = tmpTarget; set_page(ePageIns); redraw_ins(); } } else { // store // show selected preset name draw_preset_name(); if(check_key(0)) { // store in preset net_set_out_preset(*pageSelect, 1); preset_store_out(preset_get_select(), *pageSelect); // redraw selected line render_line(*pageSelect, 0xa); render_scroll_apply_hl(SCROLL_CENTER_LINE, 1); // TODO: store directly in scene? } } show_foot(); }
void handle_key_1(s32 val) { s16 newOut; if(val == 0) { return; } if(check_key(1)) { if(altMode) { print_dbg("\r\n splitting output: "); print_dbg_ulong(*pageSelect); newOut = net_split_out(*pageSelect); *pageSelect = newOut; redraw_outs(); } else { // include / exclude in selected preset // show preset name in head region draw_preset_name(); // include / exclude in preset net_toggle_out_preset(*pageSelect); // re-draw selected line to update inclusion glyph // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } } show_foot(); }
void handle_key_2(s32 val) { if(val == 0) { return; } if(check_key(2)) { if(altMode) { // filter / all } else { if(zeroed) { /// set to max net_set_in_value(*pageSelect, OP_MAX_VAL); zeroed = 0; } else { /// set to 0 net_set_in_value(*pageSelect, 0); zeroed = 1; } // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } } show_foot(); }
//************************************************************************ void DrawPartLine(struct L3PartS *PartPtr,int CurColor,float m[4][4]) { float r[4]; int i, Color; float r2[4]; vector3d bb3d[8]; #ifdef SIXTEEN_EDGE_COLORS if (0 <= CurColor && CurColor <= 15) Color = edge_color(CurColor); else Color = 0; #else Color = edge_color(CurColor); #endif //Color = CurColor; r2[0]=(PartPtr->BBox[0][0] + PartPtr->BBox[1][0]) / 2.0; r2[1]=(PartPtr->BBox[0][1]); r2[2]=(PartPtr->BBox[0][2] + PartPtr->BBox[1][2]) / 2.0; M4V3Mul(r,m,r2); bb3d[0].x=r[0]; bb3d[0].y=r[1]; bb3d[0].z=r[2]; r2[1]=PartPtr->BBox[1][1]; M4V3Mul(r,m,r2); bb3d[1].x=r[0]; bb3d[1].y=r[1]; bb3d[1].z=r[2]; render_line(&bb3d[0],&bb3d[1],Color); }
void ff_vorbis_floor1_render_list(vorbis_floor1_entry * list, int values, uint_fast16_t * y_list, int * flag, int multiplier, float * out, int samples) { int lx, ly, i; lx = 0; ly = y_list[0] * multiplier; for (i = 1; i < values; i++) { int pos = list[i].sort; if (flag[pos]) { int x1 = list[pos].x; int y1 = y_list[pos] * multiplier; if (lx < samples) render_line(lx, ly, FFMIN(x1,samples), y1, out); lx = x1; ly = y1; } if (lx >= samples) break; } if (lx < samples) render_line(lx, ly, samples, ly, out); }
// redraw all lines, based on current selection void redraw_ops(void) { u8 i=0; u8 n = *pageSelect - 3; while(i<8) { render_line( n ); render_to_scroll_line(i, n == *pageSelect ? 1 : 0); ++i; ++n; } }
static void redraw_lines(void) { u8 i=0; u8 n = 3; while(i<5) { render_line(i, 0xa); render_to_scroll_line(n, i == 0 ? 1 : 0); ++n; ++i; } }
// edit the current seleciton static void select_edit(s32 inc) { if(*pageSelect != -1) { // increment input value net_inc_in_value(*pageSelect, inc); // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } }
void logger::render(logger::verbosity const verb, std::string const &full_module, std::string const &msg) { auto const module(strip_module(full_module)); std::lock_guard<std::mutex> const render_lock(m_render_lock); std::lock_guard<std::mutex> const thread_ids_lock(m_thread_ids_lock); std::stringstream ss(msg); std::string line; while(std::getline(ss, line, '\n')) { render_line(verb, module, line); } }
void render_slide(slide *sl) { /* Returns a specially allocated surface only if the "except" subimage != NULL; otherwise uses the slide's built-in render surface. */ style *st = sl->st; displaylinevector *repr = sl->repr; displayline *out; DrawMode *dm; SDL_Surface *surface; if(export_html == 1) printf("Rendering %s\n", sl->content->line); if(sl->image_file != NULL) return; if(sl->render != NULL) SDL_FreeSurface(sl->render); sl->render = alloc_surface(sl->des_w, sl->des_h); reallocate_surfaces(sl); surface = sl->render; render_background(sl, surface); // Render the text lines: dm = new DrawMode; dm->ttmode = dm->boldmode = dm->italicmode = 0; dm->current_text_colour_index = st->textcolour; dm->lastshift = 0; for(int i = 0; i < repr->count(); i++) { out = repr->item(i); render_line(sl, out, dm, surface); } delete dm; draw_logos(sl, st, surface); // Draw embedded images: subimage *img; for(int i = 0; i < sl->visible_images->count(); i++) { img = sl->visible_images->item(i); if(img->surface == NULL) load_subimage(img); draw_subimage(surface, img); } if(sl->deck_size > 1) render_decorations(sl); scale(sl); }
int render_buffer(int buf) { if(!bufs[buf].dirty) return(0); // nothing to do... int uline,e=0; for(uline=0;uline<(bufs[buf].filled?bufs[buf].nlines:bufs[buf].ptr);uline++) { e|=render_line(buf, uline); if(e) return(e); } bufs[buf].dirty=e; // mark it clean return(e); }
void Graphics_RenderCircle(u16 CentreX, u16 CentreY, u16 Radius, u16 colour, TFT *TftPtr){ double x, y, old_x, old_y; int i = 0; x = (Radius*(cos_lookup(i))) + CentreX; y = (Radius*(sin_lookup(i))) + CentreY; for(i = SIN_DIV; i<=360; i = i+SIN_DIV){ old_x = x; old_y = y; x = (Radius*(cos_lookup(i))) + CentreX; y = (Radius*(sin_lookup(i))) + CentreY; render_line(old_x, old_y, x, y, colour, TftPtr); } }
// edit the current seleciton static void select_edit(s32 inc) { s16 tmptmp; // print_dbg("\r\n page_outs: select_edit"); // enter target-select mode if(targetSelect == 0) { // print_dbg(" , set targetSelect mode"); targetSelect = 1; /// only change tmp target selection if connected /// thus, unconnected outputs should default in editor to last connection made. tmptmp = net_get_target(*pageSelect); if(tmptmp > -1) { tmpTarget = tmptmp; } } /* print_dbg("\r\n tmpTarget: "); */ /* print_dbg_ulong(tmpTarget); */ // if(inc > 0) { /* print_dbg(" , inc tmpTarget"); */ /* print_dbg(" , value: "); */ /* print_dbg_ulong(tmpTarget); */ // increment tmpTarget tmpTarget += inc; if(tmpTarget >= net_num_ins() ) { tmpTarget -= (net_num_ins() + 1); } if(tmpTarget < -1) { tmpTarget += (net_num_ins() + 1); } /* ++tmpTarget; */ /* if(tmpTarget == net_num_ins()) { */ /* // print_dbg(" , tmpTarget at max"); */ /* // scroll past all inputs : disconnect and wrap */ /* tmpTarget = -1; */ /* } */ /* } else { */ /* --tmpTarget; */ /* if (tmpTarget == -2) { */ /* // print_dbg(" , tmpTarget at min"); */ /* // scrolled down from disconnect: connect and wrap */ /* tmpTarget = net_num_ins() - 1; */ /* } */ /* } */ // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); show_foot(); // } }
// edit the current seleciton static void select_edit(s32 inc) { print_dbg("\r\n editing ins page selection, idx: "); print_dbg_ulong(*pageSelect); if(*pageSelect != -1) { // increment input value net_inc_in_value(*pageSelect, inc); // render to tmp buffer render_line(*pageSelect, 0xf); // copy to scroll with highlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } }
void draw_pointers() { int first = 1; float lx = 0, ly = 0; int i; for(i=0; i < num_last_events; ++i) { int j = (cur_last_event-i-1 + max_last_events)%max_last_events; float x,y; int pointer = 0; int type = last_events[j].type; float w; if( !last_events[j].common.window ) continue; if( type == ngi_event_mouse_move ) { pointer = 1; x = last_events[j].mouse_move.x; y = screenBox.top-last_events[j].mouse_move.y; } /* if( type == ngi_event_mouse_button ) { x = last_events[j].mouse_button.x; y = last_events[j].mouse_button.y; render_rect(rend, x-3, y-3, 7, 7, event_color(type)); } */ if(!pointer) continue; if(first) { lx = x; ly = y; first = 0; continue; } w = 1.0f + 2*last_events[j].mouse_move.drag; render_line(rend, lx, ly, x, y, w, event_color(type)); // render_rect(rend, x-(w), y-(w), w*2+1, w*2+1, event_color(type)); lx = x; ly = y; } }
void active_line() { wait_until(display.output_delay); render_line(); if (!display.vscale) { display.vscale = display.vscale_const; renderLine += display.hres; } else display.vscale--; if ((display.scanLine + 1) == (int)(display.start_render + (display.vres*(display.vscale_const+1)))) line_handler = &blank_line; display.scanLine++; }
// redraw all lines, based on current selection void redraw_outs(void) { u8 i=0; u8 n = *pageSelect - 3; while(i<8) { /* print_dbg("\r\n redraw_outs, line: "); */ /* print_dbg_ulong(i); */ /* print_dbg("index: "); */ /* print_dbg_ulong(n); */ render_line( n, 0xa ); render_to_scroll_line(i, n == *pageSelect ? 1 : 0); ++i; ++n; } }
void render_hobd_gps_pos_llh4( const config_s * const config, const hobd_gps_pos_llh4_s * const data, const GLdouble base_x, const GLdouble base_y ) { char string[512]; GLdouble delta_y = 5.0; const GLdouble bound_x = 355.0; const GLdouble text_yoff = 15.0; const GLdouble text_xoff = 5.0; render_line( base_x, base_y, base_x + bound_x, base_y ); snprintf( string, sizeof(string), "height : %f", (double) data->height ); render_text_2d( base_x + text_xoff, base_y + text_yoff, string, NULL ); render_line( base_x, base_y + text_yoff + delta_y, base_x + bound_x, base_y + text_yoff + delta_y ); }
// redraw all lines, based on current selection void redraw_presets(void) { u8 i=0; u8 n = *pageSelect - 3; // set scroll region // FIXME: should be separate function i guess render_set_scroll(¢erScroll); while(i<8) { render_line( n, 0xa ); render_to_scroll_line(i, n == *pageSelect ? 1 : 0); ++i; ++n; } }
void handle_key_2(s32 val) { if(val == 0) { return; } if(check_key(2)) { if(targetSelect) { // we are selecting a target, so perform the connection net_connect(*pageSelect, tmpTarget); targetSelect = 0; } else { // not selecting, clear current connection net_disconnect(*pageSelect); // re-draw selected line render_line(*pageSelect, 0xf); // copy to scroll with hi,ghlight render_to_scroll_line(SCROLL_CENTER_LINE, 1); } } show_foot(); }