static void ganv_circle_update(GanvItem* item, int flags) { GanvCircle* circle = GANV_CIRCLE(item); GanvCircleImpl* impl = circle->impl; impl->coords.width = circle->node.impl->border_width; GanvItemClass* item_class = GANV_ITEM_CLASS(parent_class); if (item_class->update) { (*item_class->update)(item, flags); } // Request redraw of old location request_redraw(item, &impl->old_coords, TRUE); // Store old coordinates in world relative coordinates in case the // group we are in moves between now and the next update impl->old_coords = impl->coords; coords_i2w(item, &impl->old_coords); // Update world-relative bounding box ganv_circle_bounds(item, &item->impl->x1, &item->impl->y1, &item->impl->x2, &item->impl->y2); ganv_item_i2w_pair(item, &item->impl->x1, &item->impl->y1, &item->impl->x2, &item->impl->y2); // Request redraw of new location request_redraw(item, &impl->coords, FALSE); }
void BatteryIndicator::set_fill(int percentage) { percentage = percentage * 24 / 100; if(percentage == newPercentage) return; newPercentage = percentage; request_redraw(); }
void StringPrimitive::set(const std::string nextString, bool notify) { if(nextString == oldString) return; newString = nextString; if(notify) request_redraw(); }
virtual BOOL on_timer (HELEMENT he ) { dom::element el = he; if( !el.visible()) return FALSE; request_redraw(he); return TRUE; /*keep going*/ }
void StringPrimitive::set_centering(bool hCenter, bool vCenter) { if(hCenter != this->hCenter) wasChanged = true; if(vCenter != this->vCenter) wasChanged = true; this->hCenter = hCenter; this->vCenter = vCenter; if(wasChanged) request_redraw(); }
void r1_dx9_render_window_class::draw(i4_draw_context_class &context) { static i4_bool recursion=i4_F; r1_dx9_class_instance.x_off = context.xoff; r1_dx9_class_instance.y_off = context.yoff; //request_redraw(i4_T); if (!recursion) //if this is called recursively, ignore second call. { //must not call BeginScene twice recursion=i4_T; //i4_warning("TRACE: At beginning of new frame"); if (dx9_common.device->TestCooperativeLevel()!=D3D_OK) { recursion=i4_F; return; //skip current frame (might be other problems pending) } dx9_common.device->BeginScene(); //api->set_z_range(0.01f, 1000.0f); clip_with_z(context,RENDER_DEFAULT_NEAR_DISTANCE, RENDER_DEFAULT_FAR_DISTANCE); r1_render_window_class::draw(context); r1_dx9_class_instance.flush_vert_buffer(); dx9_common.device->EndScene(); recursion=i4_F; //i4_warning("TRACE: Frame rendered successfully"); } else { r1_render_window_class::draw(context); //the render context is already active. r1_dx9_class_instance.flush_vert_buffer(); } request_redraw(i4_T); //request redrawing of our childs for next frame request_redraw(); };
virtual BOOL on_timer (HELEMENT he ) { dom::element el = he; if( !el.visible()) return FALSE; step += 1; if( step >= steps ) { step = steps - 1; return FALSE; // done animation. } request_redraw(he,true); return TRUE; // keep going }
virtual void receive_event(i4_event * ev) { if (ev->type()==i4_event::MOUSE_BUTTON_DOWN && state!=NO_CHILDREN) { if (state==EXPANDED) { state=COMPACTED; browse_parent->compress(); } else { state=EXPANDED; browse_parent->expand(); } request_redraw(); } }
void draw(i4_draw_context_class &context) { int i; // initialize the rendering api to a "normal" state api->default_state(); // the z range tells the api what range your vertexes will be in so it can scale // them to fit it's own internal z buffer range float far_z=1000; api->set_z_range(0.01, far_z); // clear the screen black, since frame buffer is initialized to far_z, the clear z // bust be less than this to appear w32 color=0; api->clear_area(0,0,width()-1,height()-1, color, far_z-1); // points on the cube float cube_points[8*3]={ -1, 1, -1, 1,1,-1, 1,-1,-1, -1, -1, -1, -1, 1, 1, 1,1,1, 1,-1,1, -1, -1, 1 }; // some colors red green blue white float colors[4 * 3] = { 1,0,0, 0,1,0, 0,0,1, 1,1,1 }; int point_colors[8] = { 0,1,2,3,3,2,1,1 }; // faces on the cube int verts[4 * 6] = { 0,1,2,3, 4,5,6,7, 3,2,6,7, 0,1,5,4, 1,5,6,2, 0,3,7,4 }; float tcoord_s[4] = { 0,1,1,0 }; float tcoord_t[4] = { 1,1,0,0 }; // setup of the transformation matrix i4_transform_class matrix, tmp_matrix; matrix.identity(); matrix.t.z=4; // move camera 5 units away from cube tmp_matrix.rotate_x(xr); matrix.multiply(tmp_matrix); tmp_matrix.rotate_y(yr); matrix.multiply(tmp_matrix); tmp_matrix.rotate_y(zr); matrix.multiply(tmp_matrix); xr+=0.01; yr+=0.02; zr+=0.011; // change rotation for next draw // transform the points into view spave i4_3d_point_class transformed_points[8]; for (i=0; i<8; i++) { i4_3d_point_class p(cube_points[i * 3], cube_points[i * 3+1], cube_points[i * 3+2]); matrix.transform(p, transformed_points[i]); } api->use_texture(texture, 256, 0); // now copy the points into an r1_vert and project them onto the scren float center_x=width()/2, center_y=height()/2; r1_vert v[4]; for (i=0; i<6; i++) // loop through the faces { for (int j=0; j<4; j++) // loop through the points on the face { int pn=verts[i*4+j]; //point number // this stores the x,y,z of the point in world space (only x & y are actually needed, // unless you clip the polygon - which we are not) v[j].v=*((r1_3d_point_class *)&transformed_points[pn]); // w is the homogenous coordinate (1/z) v[j].w=1.0/v[j].v.z; // project onto screen and scale to fit the camera view port v[j].px=v[j].w * v[j].v.x * center_x + center_x; v[j].py=v[j].w * v[j].v.y * center_y + center_y; // set the color of the points v[j].r=colors[point_colors[pn]*3]; // color values are [0..1] 1=brightest v[j].g=colors[point_colors[pn]*3+1]; v[j].b=colors[point_colors[pn]*3+2]; // we don't need to set s & t (texture coordinates) // because we aren't texture mapping, but just so you know they are there.. v[j].s = tcoord_s[j]; // texture coordinates are between 0..1, 0 is left or top v[j].t = tcoord_t[j]; } api->render_poly(4, v); } request_redraw(); }