void button::draw() { color old_fg = get_foreground(); color old_bg = get_background(); if (down_tick) { if ((SDL_GetTicks() - down_tick) < 100) { get_foreground() = old_bg; get_background() = old_fg; } else { down_tick = 0; } } textbox::draw(); // border display::scoped_color fg(get_screen(), get_foreground()); get_screen().draw_line_2d(0, 0, get_w(), 0); get_screen().draw_line_2d(get_w(), 0, get_w(), get_h()); get_screen().draw_line_2d(get_w(), get_h(), 0, get_h()); get_screen().draw_line_2d(0, get_h(), 0, 0); if (down_tick) { get_foreground() = old_fg; get_background() = old_bg; } } // button::draw()
int get_player_name_render() { memcpy(get_program_secondary_buf(),get_background()->color,get_vram_size()); printgr_shade_centered(get_program_secondary_buf(),"Please enter your name",get_v_res()/2-200, 0.75,0xFFFF,5,5, .1, 8); printgr_shade_centered(get_program_secondary_buf(),get_program_playername(),get_v_res()/2, 0.75,0xFFFF,5,5, .1,7); if(*get_date_str_ptr() != NULL) printgr_shade_centered(get_program_secondary_buf(),*get_date_str_ptr(),0, 0.75,0xFFFF,5,5, .1, 1); if(darken > 0) darken_buf(get_program_secondary_buf(),darken); if(darken > 0 && !fade_condition) { darken-= FADE_RATE; } if(fade_condition) { if(darken <= 127) { darken += FADE_RATE; } else { continue_condition = false; } } copy_video_buffer(get_program_video_mem(), get_program_secondary_buf()); return 0; }
void draw_background_tiled(int back,double x,double y) { get_background(bck2d,back); bind_texture(bck2d->texture); glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); x=bck2d->width-fmod(x,bck2d->width); y=bck2d->height-fmod(y,bck2d->height); const float tbx=bck2d->texbordx,tby=bck2d->texbordy; const int hortil= int (ceil(room_width/(bck2d->width*tbx))), vertil= int (ceil(room_height/(bck2d->height*tby))); glBegin(GL_QUADS); for (int i=0; i<hortil; i++) { for (int c=0; c<vertil; c++) { glTexCoord2f(0,0); glVertex2f(i*bck2d->width-x,c*bck2d->height-y); glTexCoord2f(tbx,0); glVertex2f((i+1)*bck2d->width-x,c*bck2d->height-y); glTexCoord2f(tbx,tby); glVertex2f((i+1)*bck2d->width-x,(c+1)*bck2d->height-y); glTexCoord2f(0,tby); glVertex2f(i*bck2d->width-x,(c+1)*bck2d->height-y); } } glEnd(); glPopAttrib(); }
void draw_background_tiled_ext(int back,double x,double y,double xscale,double yscale,int color,double alpha) { get_background(bck2d,back); bind_texture(bck2d->texture); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx=bck2d->texbordx,tby=bck2d->texbordy, w=bck2d->width*xscale, h=bck2d->height*yscale; const int hortil= int (ceil(room_width/(bck2d->width*tbx))), vertil= int (ceil(room_height/(bck2d->height*tby))); x=w-fmod(x,w); y=h-fmod(y,h); glBegin(GL_QUADS); for (int i=0; i<hortil; i++) { for (int c=0; c<vertil; c++) { glTexCoord2f(0,0); glVertex2f(i*w-x,c*h-y); glTexCoord2f(tbx,0); glVertex2f((i+1)*w-x,c*h-y); glTexCoord2f(tbx,tby); glVertex2f((i+1)*w-x,(c+1)*h-y); glTexCoord2f(0,tby); glVertex2f(i*w-x,(c+1)*h-y); } } glEnd(); glPopAttrib(); }
void draw_background_part(int back,double left,double top,double width,double height,double x,double y) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); float tbw = bck2d->width/(float)bck2d->texbordx, tbh = bck2d->height/(float)bck2d->texbordy, tbx1 = left/tbw, tbx2 = tbx1 + width/tbw, tby1 = top/tbh, tby2 = tby1 + height/tbh; glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(tbx1,tby1); glVertex2f(x,y); glTexCoord2f(tbx2,tby1); glVertex2f(x+width,y); glTexCoord2f(tbx1,tby2); glVertex2f(x,y+height); glTexCoord2f(tbx2,tby2); glVertex2f(x+width,y+height); glEnd(); glPopAttrib(); }
void draw_background_tiled(int back, gs_scalar x, gs_scalar y, int color, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d,back); x = (x<0?0:bck2d->width)-fmod(x,bck2d->width); y = (y<0?0:bck2d->height)-fmod(y,bck2d->height); const gs_scalar tbx = bck2d->texturex, tby = bck2d->texturey, tbw = bck2d->texturew, tbh = bck2d->textureh; const int hortil = int (ceil((gs_scalar)room_width/((gs_scalar)bck2d->width))) + 1, vertil = int (ceil((gs_scalar)room_height/((gs_scalar)bck2d->height))) + 1; gs_scalar xvert1 = -x, xvert2 = xvert1 + bck2d->width, yvert1, yvert2; for (int i=0; i<hortil; ++i) { yvert1 = -y; yvert2 = yvert1 + bck2d->height; for (int c=0; c<vertil; ++c) { draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(xvert1,yvert1,tbx,tby,color,alpha); draw_vertex_texture_color(xvert2,yvert1,tbx+tbw,tby,color,alpha); draw_vertex_texture_color(xvert1,yvert2,tbx,tby+tbh,color,alpha); draw_vertex_texture_color(xvert2,yvert2,tbx+tbw,tby+tbh,color,alpha); draw_primitive_end(); yvert1 = yvert2; yvert2 += bck2d->height; } xvert1 = xvert2; xvert2 += bck2d->width; } }
void draw_background_part_ext(int back,double left,double top,double width,double height,double x,double y,double xscale,double yscale,int color,double alpha) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); float tbw = bck2d->width/(float)bck2d->texbordx, tbh = bck2d->height/(float)bck2d->texbordy, xvert1 = x, xvert2 = xvert1 + width*xscale, yvert1 = y, yvert2 = yvert1 + height*yscale, tbx1 = left/tbw, tbx2 = tbx1 + width/tbw, tby1 = top/tbh, tby2 = tby1 + height/tbh; glBegin(GL_TRIANGLE_STRIP); glTexCoord2f(tbx1,tby1); glVertex2f(xvert1,yvert1); glTexCoord2f(tbx2,tby1); glVertex2f(xvert2,yvert1); glTexCoord2f(tbx1,tby2); glVertex2f(xvert1,yvert2); glTexCoord2f(tbx2,tby2); glVertex2f(xvert2,yvert2); glEnd(); glPopAttrib(); }
void draw_background_ext(int back, gs_scalar x, gs_scalar y, gs_scalar xscale, gs_scalar yscale, double rot, int color, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d,back); rot *= M_PI/180; const gs_scalar tbw = bck2d->texturew, tbh = bck2d->textureh, tbx = bck2d->texturex, tby = bck2d->texturey, w = bck2d->width*xscale, h = bck2d->height*yscale, wsinrot = w*sin(rot), wcosrot = w*cos(rot); draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); gs_scalar ulcx = x + xscale * cos(M_PI+rot) + yscale * cos(M_PI/2+rot), ulcy = y - yscale * sin(M_PI+rot) - yscale * sin(M_PI/2+rot); draw_vertex_texture_color(ulcx, ulcy, tbx, tby,color,alpha); draw_vertex_texture_color(ulcx + wcosrot, ulcy - wsinrot, tbx+tbw, tby,color,alpha); const double mpr = 3*M_PI/2 + rot; ulcx += h * cos(mpr); ulcy -= h * sin(mpr); draw_vertex_texture_color(ulcx, ulcy, tbx, tby+tbh,color,alpha); draw_vertex_texture_color(ulcx + wcosrot, ulcy - wsinrot, tbx+tbw, tby+tbh,color,alpha); draw_primitive_end(); }
void draw_background_general(int back, gs_scalar left, gs_scalar top, gs_scalar width, gs_scalar height, gs_scalar x, gs_scalar y, gs_scalar xscale, gs_scalar yscale, double rot, int c1, int c2, int c3, int c4, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d, back); const gs_scalar tbx = bck2d->texturex, tby = bck2d->texturey, tbw = bck2d->texturew, tbh = bck2d->textureh, ttbw = bck2d->width/tbw, ttbh = bck2d->height/tbh, tbx1 = tbx+left/ttbw, tby1 = tby+top/ttbh, tbx2 = tbx+(left+width)/ttbw, tby2 = tby+(top+height)/ttbh, w = width*xscale, h = height*yscale; rot *= M_PI/180; const gs_scalar wcosrot = w*cos(rot), wsinrot = w*sin(rot); gs_scalar ulcx = x + xscale * cos(M_PI+rot) + yscale * cos(M_PI/2+rot), ulcy = y - yscale * sin(M_PI+rot) - yscale * sin(M_PI/2+rot); draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(ulcx, ulcy, tbx1, tby1,c1,alpha); draw_vertex_texture_color((ulcx + wcosrot), (ulcy - wsinrot), tbx2,tby1, c2, alpha); ulcx += h * cos(3*M_PI/2 + rot); ulcy -= h * sin(3*M_PI/2 + rot); draw_vertex_texture_color(ulcx, ulcy, tbx1, tby2,c3,alpha); draw_vertex_texture_color((ulcx + wcosrot), (ulcy - wsinrot), tbx2, tby2,c4,alpha); draw_primitive_end(); }
EditableMap::EditableMap(Resources& resources, Subsystem& subsystem) throw (Exception) : Map(subsystem), resources(resources), subsystem(subsystem) { set_background(get_background()); set_tileset(get_tileset()); untouch(); }
void draw_background_ext(int back,double x,double y,double xscale,double yscale,double rot,int color,double alpha) { get_background(bck2d,back); bind_texture(bck2d->texture); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx=bck2d->texbordx,tby=bck2d->texbordy, w=bck2d->width*xscale, h=bck2d->height*yscale; rot *= M_PI/180; float ulcx = x + xscale * cos(M_PI+rot) + yscale * cos(M_PI/2+rot), ulcy = y - yscale * sin(M_PI+rot) - yscale * sin(M_PI/2+rot); glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(ulcx,ulcy); glTexCoord2f(tbx,0); glVertex2f(ulcx + w*cos(rot), ulcy - w*sin(rot)); glTexCoord2f(tbx,tby); ulcx += h * cos(3*M_PI/2 + rot); ulcy -= h * sin(3*M_PI/2 + rot); glVertex2f(ulcx + w*cos(rot), ulcy - w*sin(rot)); glTexCoord2f(0,tby); glVertex2f(ulcx,ulcy); glEnd(); glPopAttrib(); }
void draw_background_part_ext(int back,double left,double top,double width,double height,double x,double y,double xscale,double yscale,int color,double alpha) { get_background(bck2d,back); bind_texture(bck2d->texture); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx = bck2d->texbordx, tby = bck2d->texbordy, tbw = bck2d->width/tbx, tbh = bck2d->height/tby; glBegin(GL_QUADS); glTexCoord2f(left/tbw,top/tbh); glVertex2f(x,y); glTexCoord2f((left+width)/tbw,top/tbh); glVertex2f(x+width*xscale,y); glTexCoord2f((left+width)/tbw,(top+height)/tbh); glVertex2f(x+width*xscale,y+height*yscale); glTexCoord2f(left/tbw,(top+height)/tbh); glVertex2f(x,y+height*yscale); glEnd(); glPopAttrib(); }
void widget::draw() { display::scoped_state state(get_screen(), display::ENABLE_ORTHO_2D); display::scoped_color bg(get_screen(), get_background()); display::scoped_texture t(get_screen(), tex); get_screen().draw_rect_2d(0, 0, static_cast<float>(w), static_cast<float>(h)); } // widget::draw()
void litehtml::el_image::draw( uint_ptr hdc, int x, int y, const position* clip ) { position pos = m_pos; pos.x += x; pos.y += y; position el_pos = pos; el_pos += m_padding; el_pos += m_borders; // draw standard background here if (el_pos.does_intersect(clip)) { const background* bg = get_background(); if (bg) { background_paint bg_paint; init_background_paint(pos, bg_paint, bg); get_document()->container()->draw_background(hdc, bg_paint); } } // draw image as background if(pos.does_intersect(clip)) { if (pos.width > 0 && pos.height > 0) { background_paint bg; bg.image = m_src; bg.clip_box = pos; bg.origin_box = pos; bg.border_box = pos; bg.border_box += m_padding; bg.border_box += m_borders; bg.repeat = background_repeat_no_repeat; bg.image_size.width = pos.width; bg.image_size.height = pos.height; bg.border_radius = m_css_borders.radius.calc_percents(bg.border_box.width, bg.border_box.height); bg.position_x = pos.x; bg.position_y = pos.y; get_document()->container()->draw_background(hdc, bg); } } // draw borders if (el_pos.does_intersect(clip)) { position border_box = pos; border_box += m_padding; border_box += m_borders; borders bdr = m_css_borders; bdr.radius = m_css_borders.radius.calc_percents(border_box.width, border_box.height); get_document()->container()->draw_borders(hdc, bdr, border_box, have_parent() ? false : true); } }
sprite::sprite(image *Screen, image *Visual, int X, int Y) { CHECK(Visual && Screen); x = X; y = Y; visual = Visual; screen = Screen; save = new image(visual->Size()); get_background(); }
void d3d_draw_background(int back, gs_scalar x, gs_scalar y, gs_scalar z) { get_background(bck2d,back); const gs_scalar tbx=bck2d->texturex,tby=bck2d->texturey, tbw=bck2d->texturew,tbh=bck2d->textureh; draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); d3d_vertex_texture(x,y,z,tbx,tby); d3d_vertex_texture(x+bck2d->width,y,z,tbx+tbw,tby); d3d_vertex_texture(x,y+bck2d->height,z, tbx,tby+tbh); d3d_vertex_texture(x+bck2d->width,y+bck2d->height,z, tbx+tbw,tby+tbh); draw_primitive_end(); }
void draw_background_tiled_area_ext(int back,double x,double y,double x1,double y1,double x2,double y2, double xscale, double yscale, int color, double alpha) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx=bck2d->texbordx,tby=bck2d->texbordy; float sw,sh,i,j,jj,left,top,width,height,X,Y; sw = bck2d->width*xscale; sh = bck2d->height*yscale; i = x1-(fmod(x1,sw) - fmod(x,sw)) - sw*(fmod(x1,sw)<fmod(x,sw)); j = y1-(fmod(y1,sh) - fmod(y,sh)) - sh*(fmod(y1,sh)<fmod(y,sh)); jj = j; glBegin(GL_QUADS); for(i=i; i<=x2; i+=sw) { for(j=j; j<=y2; j+=sh) { if(i <= x1) left = x1-i; else left = 0; X = i+left; if(j <= y1) top = y1-j; else top = 0; Y = j+top; if(x2 <= i+sw) width = ((sw)-(i+sw-x2)+1)-left; else width = sw-left; if(y2 <= j+sh) height = ((sh)-(j+sh-y2)+1)-top; else height = sh-top; glTexCoord2f(left/sw*tbx,top/sh*tby); glVertex2f(X,Y); glTexCoord2f((left+width)/sw*tbx,top/sh*tby); glVertex2f(X+width,Y); glTexCoord2f((left+width)/sw*tbx,(top+height)/sh*tby); glVertex2f(X+width,Y+height); glTexCoord2f(left/sw*tbx,(top+height)/sh*tby); glVertex2f(X,Y+height); } j = jj; } glEnd(); glPopAttrib(); }
void draw_background_stretched(int back, gs_scalar x, gs_scalar y, gs_scalar width, gs_scalar height, int color, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d, back); const gs_scalar tbx=bck2d->texturex,tby=bck2d->texturey, tbw=bck2d->texturew,tbh=bck2d->textureh; draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(x,y,tbx,tby,color,alpha); draw_vertex_texture_color(x+width,y,tbx+tbw,tby,color,alpha); draw_vertex_texture_color(x,y+height, tbx,tby+tbh,color,alpha); draw_vertex_texture_color(x+width,y+height, tbx+tbw,tby+tbh,color,alpha); draw_primitive_end(); }
void draw_background_tiled_area(int back,double x,double y,double x1,double y1,double x2,double y2) { get_background(bck2d,back); bind_texture(bck2d->texture); glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); const float tbx=bck2d->texbordx,tby=bck2d->texbordy; float sw,sh,i,j,jj,left,top,width,height,X,Y; sw = bck2d->width; sh = bck2d->height; i = x1-(fmod(x1,sw) - fmod(x,sw)) - sw*(fmod(x1,sw)<fmod(x,sw)); j = y1-(fmod(y1,sh) - fmod(y,sh)) - sh*(fmod(y1,sh)<fmod(y,sh)); jj = j; glBegin(GL_QUADS); for(i=i; i<=x2; i+=sw) { for(j=j; j<=y2; j+=sh) { if(i <= x1) left = x1-i; else left = 0; X = i+left; if(j <= y1) top = y1-j; else top = 0; Y = j+top; if(x2 <= i+sw) width = ((sw)-(i+sw-x2)+1)-left; else width = sw-left; if(y2 <= j+sh) height = ((sh)-(j+sh-y2)+1)-top; else height = sh-top; glTexCoord2f(left/sw*tbx,top/sh*tby); glVertex2f(X,Y); glTexCoord2f((left+width)/sw*tbx,top/sh*tby); glVertex2f(X+width,Y); glTexCoord2f((left+width)/sw*tbx,(top+height)/sh*tby); glVertex2f(X+width,Y+height); glTexCoord2f(left/sw*tbx,(top+height)/sh*tby); glVertex2f(X,Y+height); } j = jj; } glEnd(); glPopAttrib(); }
int main_menu_render() { memcpy(get_program_secondary_buf(),get_background()->color,get_vram_size()); //draw_cursor(get_program_secondary_buf(),cursor); draw_cursor(get_program_secondary_buf(),get_cursor()); size_t i; for(i = 0; i < NUM_MAIN_MENU_BUTTONS-1; i++) { draw_button_t_centered(main_menu_buttons[i]); } draw_name_button_t(main_menu_buttons[i]); printgr_shade_centered(get_program_secondary_buf(),"O",get_v_res()/2-325, 0.75,0xFFFF,5,5, .1, 10); printgr_shade(get_program_secondary_buf(),"2",get_h_res()/2+35, get_v_res()/2-215, 0.75,0xFFFF,5,5, .1,9); if(*get_date_str_ptr() != NULL) printgr_shade_centered(get_program_secondary_buf(),*get_date_str_ptr(),0, 0.75,0xFFFF,5,5, .1, 1); if(darken > 0) darken_buf(get_program_secondary_buf(),darken); if(darken > 0 && !fade_condition) { darken-= FADE_RATE; } if(fade_condition) { if(darken <= 127) { darken += FADE_RATE; } else { if(function_to_call == NULL) continue_condition = false; else { fade_condition = false; function_to_call(); if(main_menu_buttons[3] != NULL) free (main_menu_buttons[3]); main_menu_buttons[3] = initialize_button_t(to_coord_t(10,get_v_res()-get_line_space(2)),get_program_playername(), get_player_name, 2, 0.9); main_menu_buttons[3]->pos.x = 10; function_to_call = NULL; } } } copy_video_buffer(get_program_video_mem(), get_program_secondary_buf()); return 0; }
void draw_background_tiled_area_ext(int back, gs_scalar x, gs_scalar y, gs_scalar x1, gs_scalar y1, gs_scalar x2, gs_scalar y2, gs_scalar xscale, gs_scalar yscale, int color, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d,back); const gs_scalar tbx=bck2d->texturex,tby=bck2d->texturey, tbw=bck2d->texturew,tbh=bck2d->textureh; gs_scalar sw,sh,i,j,jj,left,top,width,height,X,Y, tbx1, tbx2, tby1, tby2; sw = bck2d->width*xscale; sh = bck2d->height*yscale; i = x1-(fmod(x1,sw) - fmod(x,sw)) - sw*(fmod(x1,sw)<fmod(x,sw)); j = y1-(fmod(y1,sh) - fmod(y,sh)) - sh*(fmod(y1,sh)<fmod(y,sh)); jj = j; for(; i<=x2; i+=sw) { for(; j<=y2; j+=sh) { if(i <= x1) left = x1-i; else left = 0; X = i+left; if(j <= y1) top = y1-j; else top = 0; Y = j+top; if(x2 <= i+sw) width = ((sw)-(i+sw-x2)+1)-left; else width = sw-left; if(y2 <= j+sh) height = ((sh)-(j+sh-y2)+1)-top; else height = sh-top; tbx1 = tbx+left/sw*tbw, tby1 = tby+top/sh*tbh, tbx2 = tbx+(left+width)/sw*tbw, tby2 = tby+(top+height)/sh*tbh; draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(X,Y,tbx1,tby1,color,alpha); draw_vertex_texture_color(X+width,Y,tbx2,tby1,color,alpha); draw_vertex_texture_color(X,Y+height,tbx1,tby2,color,alpha); draw_vertex_texture_color(X+width,Y+height,tbx2,tby2,color,alpha); draw_primitive_end(); } j = jj; } }
void draw_background_part(int back, gs_scalar left, gs_scalar top, gs_scalar width, gs_scalar height, gs_scalar x, gs_scalar y, int color, gs_scalar alpha) { alpha=clamp_alpha(alpha); get_background(bck2d, back); const gs_scalar tbw = bck2d->width/(gs_scalar)bck2d->texturew, tbh = bck2d->height/(gs_scalar)bck2d->textureh, tbx = bck2d->texturex,tby = bck2d->texturey, tbx1 = tbx + left/tbw, tbx2 = tbx + tbx1 + width/tbw, tby1 = tby + top/tbh, tby2 = tby + tby1 + height/tbh; draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(x,y,tbx1,tby1,color,alpha); draw_vertex_texture_color(x+width,y,tbx2,tby1,color,alpha); draw_vertex_texture_color(x,y+height,tbx1,tby2,color,alpha); draw_vertex_texture_color(x+width,y+height,tbx2,tby2,color,alpha); draw_primitive_end(); }
void config_handler::print() { // // Display internal settings set from reading steering // string mn = "print:"; string def = "<default>"; int w1=30; //arbitrary spacing size that makes formatting look pretty for data names int w2=30; //arbitrary spacing size that makes formatting look pretty for data options cout<<cn<<mn<<" >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>" <<"\n"<<setw(w1)<<"DEBUG: " <<setw(w2)<<(debug? "ON":"OFF") <<"\n"<<setw(w1)<<"RUN IN BACKGROUND: " <<setw(w2)<<(get_background()? "ON":"OFF") <<"\n"<<setw(w1)<<"SIMULATION: " <<setw(w2)<<(get_simulate()? "ON":"OFF") <<"\n"<<setw(w1)<<"FILTER FIRST: " <<setw(w2)<<(get_filter()? "ON":"OFF") <<"\n"<<setw(w1)<<"SAVE RECORDINGS: " <<setw(w2)<<(get_save_rec()? "ON":"OFF") <<"\n"<<setw(w1)<<"HUMAN READABLE OUTPUT: " <<setw(w2)<<(get_output_formatted()? "ON":"OFF") <<"\n"<<setw(w1)<<"Output Type ID: " <<setw(w2)<<"\""<<get_output_type_id()<<"\"" <<"\n"<<setw(w1)<<"RPi Latitude: " <<setw(w2)<<"\""<<get_latitude()<<"\"" <<"\n"<<setw(w1)<<"RPi Longitude: " <<setw(w2)<<"\""<<get_longitude()<<"\"" <<"\n"<<setw(w1)<<"RPi ID: " <<setw(w2)<<"\""<<get_rpid()<<"\"" <<"\n"<<setw(w1)<<"Simulation Data Dir: " <<setw(w2)<<"\""<<get_simulate_dir()<<"\"" <<"\n"<<setw(w1)<<"Config Path: " <<setw(w2)<<"\""<<get_config_file_path()<<"\"" <<"\n"<<setw(w1)<<"Config Name: " <<setw(w2)<<"\""<<get_config_file_name()<<"\"" <<"\n"<<setw(w1)<<"Config File: " <<setw(w2)<<"\""<<get_config_file()<<"\"" <<"\n"<<setw(w1)<<"Final Feature Format: " <<setw(w2)<<"\""<<get_final_feature_format()<<"\"" <<"\n"<<setw(w1)<<"Filter Vector Path: " <<setw(w2)<<"\""<<get_fv_filter_path()<<"\"" <<"\n"<<setw(w1)<<"Filter Vector Name: " <<setw(w2)<<"\""<<get_fv_filter_name()<<"\"" <<"\n"<<setw(w1)<<"Filter Vector File: " <<setw(w2)<<"\""<<get_fv_filter()<<"\"" <<"\n"<<setw(w1)<<"Feature Vector Path: " <<setw(w2)<<"\""<<get_fv_file_path()<<"\"" <<"\n"<<setw(w1)<<"Feature Vector Name: " <<setw(w2)<<"\""<<get_fv_file_name()<<"\"" <<"\n"<<setw(w1)<<"Feature Vector File: " <<setw(w2)<<"\""<<get_fv_file()<<"\"" <<"\n"<<setw(w1)<<"Analysis File(s) Path: " <<setw(w2)<<"\""<<get_analysis_location()<<"\"" <<"\n"<<setw(w1)<<"Data File(s) Path: " <<setw(w2)<<"\""<<get_data_location()<<"\"" <<"\n"<<setw(w1)<<"Media Location File Path: " <<setw(w2)<<"\""<<get_media_location()<<"\"" <<"\n"<<setw(w1)<<"Recording Extention: " <<setw(w2)<<"\""<<get_rec_extention()<<"\"" <<"\n"<<setw(w1)<<"Recording File Name Prefix: " <<setw(w2)<<"\""<<get_rec_file_name_prefix()<<"\"" <<"\n"<<setw(w1)<<"Recording Rate: " <<setw(w2)<<"\""<<get_samp_rate()<<"\"" <<"\n"<<setw(w1)<<"Recording Duration: " <<setw(w2)<<"\""<<get_rec_duration()<<"\"" <<"\n"<<setw(w1)<<"Recording Number: " <<setw(w2)<<"\""<<get_rec_number()<<"\""<<endl; cout<<cn<<mn<<" <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"<<endl; return; }
void draw_background_tiled_ext(int back,double x,double y,double xscale,double yscale,int color,double alpha) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx = bck2d->texbordx, tby = bck2d->texbordy, width_scaled = bck2d->width*xscale, height_scaled = bck2d->height*yscale; x = width_scaled-fmod(x,width_scaled); y = height_scaled-fmod(y,height_scaled); const int hortil = int(ceil(room_width/(width_scaled*tbx))) + 1, vertil = int(ceil(room_height/(height_scaled*tby))) + 1; glBegin(GL_QUADS); float xvert1 = -x, xvert2 = xvert1 + width_scaled, yvert1, yvert2; for (int i=0; i<hortil; i++) { yvert1 = -y; yvert2 = yvert1 + height_scaled; for (int c=0; c<vertil; c++) { glTexCoord2f(0,0); glVertex2f(xvert1,yvert1); glTexCoord2f(tbx,0); glVertex2f(xvert2,yvert1); glTexCoord2f(tbx,tby); glVertex2f(xvert2,yvert2); glTexCoord2f(0,tby); glVertex2f(xvert1,yvert2); yvert1 = yvert2; yvert2 += height_scaled; } xvert1 = xvert2; xvert2 += width_scaled; } glEnd(); glPopAttrib(); }
EditableMap::EditableMap(Resources& resources, Subsystem& subsystem, const std::string& filename) throw (Exception) : Map(subsystem, filename), resources(resources), subsystem(subsystem) { char buffer[256]; set_background(get_background()); set_tileset(get_tileset()); untouch(); /* grab objects */ int num_objects = atoi(get_value("objects").c_str()); for (int i = 0; i < num_objects; i++) { sprintf(buffer, "object_name%d", i); const std::string& object_name = get_value(buffer); sprintf(buffer, "object_x%d", i); int x = atoi(get_value(buffer).c_str()); sprintf(buffer, "object_y%d", i); int y = atoi(get_value(buffer).c_str()); try { Object *obj = resources.get_object(object_name); EditableObject *eobj = new EditableObject(obj, x, y); objects.push_back(eobj); } catch (const Exception& e) { subsystem << "WARNING: " << e.what() << std::endl; } } /* grab light sources */ int num_lights = atoi(get_value("lights").c_str()); for (int i = 0; i < num_lights; i++) { sprintf(buffer, "light_x%d", i); int x = atoi(get_value(buffer).c_str()); sprintf(buffer, "light_y%d", i); int y = atoi(get_value(buffer).c_str()); sprintf(buffer, "light_radius%d", i); int radius = atoi(get_value(buffer).c_str()); lights.push_back(new EditableLight(x, y, radius)); } create_lightmap(); }
void draw_background_tiled_ext(int back, gs_scalar x, gs_scalar y, gs_scalar xscale, gs_scalar yscale, int color, gs_scalar alpha, bool htiled, bool vtiled) { alpha=clamp_alpha(alpha); get_background(bck2d,back); const gs_scalar tbx = bck2d->texturex, tby = bck2d->texturey, tbw = bck2d->texturew, tbh = bck2d->textureh, width_scaled = bck2d->width*xscale, height_scaled = bck2d->height*yscale; int hortil, vertil; if (htiled) { hortil = int(ceil((gs_scalar)room_width/((gs_scalar)width_scaled*tbw))) + 1; x = -((x<0?0:width_scaled)-fmod(x,width_scaled)); } else { hortil = 1; } if (vtiled) { vertil = int(ceil((gs_scalar)room_height/((gs_scalar)height_scaled*tbh))) + 1; y = -((y<0?0:height_scaled)-fmod(y,height_scaled)); } else { vertil = 1; } gs_scalar xvert1 = x, xvert2 = xvert1 + width_scaled, yvert1, yvert2; for (int i=0; i<hortil; ++i) { yvert1 = y; yvert2 = yvert1 + height_scaled; for (int c=0; c<vertil; ++c) { draw_primitive_begin_texture(pr_trianglestrip, bck2d->texture); draw_vertex_texture_color(xvert1,yvert1,tbx,tby,color,alpha); draw_vertex_texture_color(xvert2,yvert1,tbx+tbw,tby,color,alpha); draw_vertex_texture_color(xvert1,yvert2,tbx,tby+tbh,color,alpha); draw_vertex_texture_color(xvert2,yvert2,tbx+tbw,tby+tbh,color,alpha); draw_primitive_end(); yvert1 = yvert2; yvert2 += height_scaled; } xvert1 = xvert2; xvert2 += width_scaled; } }
void draw_background_tiled(int back,double x,double y) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); x = bck2d->width-fmod(x,bck2d->width); y = bck2d->height-fmod(y,bck2d->height); const float tbx = bck2d->texbordx,tby=bck2d->texbordy; const int hortil = int (ceil(room_width/(bck2d->width*tbx))) + 1, vertil = int (ceil(room_height/(bck2d->height*tby))) + 1; glBegin(GL_QUADS); float xvert1 = -x, xvert2 = xvert1 + bck2d->width, yvert1, yvert2; for (int i=0; i<hortil; i++) { yvert1 = -y; yvert2 = yvert1 + bck2d->height; for (int c=0; c<vertil; c++) { glTexCoord2f(0,0); glVertex2f(xvert1,yvert1); glTexCoord2f(tbx,0); glVertex2f(xvert2,yvert1); glTexCoord2f(tbx,tby); glVertex2f(xvert2,yvert2); glTexCoord2f(0,tby); glVertex2f(xvert1,yvert2); yvert1 = yvert2; yvert2 += bck2d->height; } xvert1 = xvert2; xvert2 += bck2d->width; } glEnd(); glPopAttrib(); }
void draw_background_stretched(int back, double x, double y, double w, double h) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); const float tbx=bck2d->texbordx,tby=bck2d->texbordy; glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(x,y); glTexCoord2f(tbx,0); glVertex2f(x+w,y); glTexCoord2f(tbx,tby); glVertex2f(x+w,y+h); glTexCoord2f(0,tby); glVertex2f(x,y+h); glEnd(); glPopAttrib(); }
void draw_background(int back, double x, double y) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); // see backgroundstruct and spritestruct are storing the gluint to the texture, and when glPushAttrib(GL_CURRENT_BIT); glColor4f(1,1,1,1); const float tbx=bck2d->texbordx,tby=bck2d->texbordy; glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(x,y); glTexCoord2f(tbx,0); glVertex2f(x+bck2d->width,y); glTexCoord2f(tbx,tby); glVertex2f(x+bck2d->width,y+bck2d->height); glTexCoord2f(0,tby); glVertex2f(x,y+bck2d->height); glEnd(); glPopAttrib(); }
void draw_background_stretched_ext(int back,double x,double y,double w,double h,int color,double alpha) { get_background(bck2d,back); texture_use(GmTextures[bck2d->texture]->gltex); glPushAttrib(GL_CURRENT_BIT); glColor4ub(__GETR(color),__GETG(color),__GETB(color),char(alpha*255)); const float tbx=bck2d->texbordx, tby=bck2d->texbordy; glBegin(GL_QUADS); glTexCoord2f(0,0); glVertex2f(x,y); glTexCoord2f(tbx,0); glVertex2f(x+w,y); glTexCoord2f(tbx,tby); glVertex2f(x+w,y+h); glTexCoord2f(0,tby); glVertex2f(x,y+h); glEnd(); glPopAttrib(); }