void Body::draw(Boy::Graphics *g) { int w = Boy::Environment::screenWidth(); int h = Boy::Environment::screenHeight(); BoyLib::Vector2 pos = mPos; g->setDrawMode(Boy::Graphics::DRAWMODE_ADDITIVE); _draw(g,pos); // center pos.x += w; _draw(g,pos); // right pos.y += h; _draw(g,pos); // bottom right pos.x -= w; _draw(g,pos); // bottom pos.x -= w; _draw(g,pos); // bottom left pos.y -= h; _draw(g,pos); // left pos.y -= h; _draw(g,pos); // top left pos.x += w; _draw(g,pos); // top pos.x += w; _draw(g,pos); // top right g->setDrawMode(Boy::Graphics::DRAWMODE_NORMAL); }
void UIRenderer::drawRect(const aabox2f &rect, const color_t &color) { const aabox2f *pcb; if (!_getClippingBox(pcb)) { // not clip _draw(rect, color); } else if (pcb) { // clip aabox2f _rect = rect; if (_clipRect(*pcb, _rect)) { _draw(_rect, color); } } }
void UIRenderer::drawRect(const aabox2f &rect, const color_t &color, const TexturePtr &texture, const vector2f *texcoords) { vnassert(!texture.null() && texcoords); const aabox2f *pcb; if (!_getClippingBox(pcb)) { // not clip _draw(rect, color, texture, texcoords); } else if (pcb) { // clip aabox2f _rect = rect; vector2f _texcoords[4]; if (_clipRect(*pcb, _rect, texcoords, _texcoords)) { _draw(_rect, color, texture, _texcoords); } } }
void TWidget::Draw(TRenderTarget& target) { if (IsVisible() == false) { return; } _draw(target); _drawChildren(target); }
void ofxCVgui::draw() { if (_drawOnEvent) ofLogError() << "ofxCVgui :: draw(). We're drawing on events, please don't try and draw manually. it'll happen automatically. Else use setDrawOnEvent(false) . "; else _draw(); }
void Badger::Engine::run() { SDL_Event event; Clock* clock = new Clock(); while(true) { if (SDL_PollEvent(&event)) { if(event.type == SDL_QUIT) { break; } _fireEvent(&event); } // Get the time since the last draw/update double elapsed = clock->elapsedTime(); // Update the world _world->update(elapsed); // Draw the world _draw(); // Display SDL_GL_SwapBuffers(); } // Uninitialize the joystick //joystick = SDL_JoystickOpen(0); // Destruct SDL SDL_Quit(); }
void SceneObject::draw() { if(_visible) { _draw(); } }
void image::sdraw(SDL_Renderer *_ren, signed int x, signed int y, unsigned int n, unsigned int r, unsigned int g, unsigned int b) { SDL_SetTextureColorMod(img, r, g, b); //glColor4f(r / 255.0, g / 255.0, b / 255.0, 1); _draw(_ren, x, y, n); SDL_SetTextureColorMod(img, 255, 255, 255); }
void SpriteCmp::update(float dt_) { if (!_isInit) return; const Eigen::Vector2i& sz = Graphics::getInstance()->getScreenSize(); posCmp = static_cast<PositionComponent*>(getEntity()->getComponent("PositionComponent")); CK_Vital_ptr(posCmp); // for compatibility reson this line convert position in pixel to OpenGL values if (_screenSpace.get()) { _transform.translation() = Eigen::Vector2f((posCmp->getX() / float(sz[0] / 2) - 1.0f), (posCmp->getY() / float(-sz[1] / 2) + 1.0f)); } else { _transform.translation() = Eigen::Vector2f((posCmp->getX() / float(sz[0])) - 1.0f, (posCmp->getY() / float(-sz[1])) + 1.0f); } _uniformMatrix.get() = _transform.matrix() * _optMatrix; _uniformMatrix.upload(); _screenSpace.upload(); _draw(); if (_setAnimation) { if (BLINK_TIME > _delay && _blinkTime) { _texture.getFilter() = (_blinkTime % 2) ? Eigen::Vector4f::Zero() : _blinkColor; _blinkTime--; } if (_frameDelay < _delay) { _delay = 0; _texture.nextFrame(); } _delay += dt_; } }
void CreateWorld(void) { glPushMatrix(); MakeGrid(); _draw(); glPopMatrix(); // MakeLighting(); }
void Line2D::_notification(int p_what) { switch (p_what) { case NOTIFICATION_DRAW: _draw(); break; } }
void _draw(state_stack *stack) { state_desc *top = (state_desc*) table_ind(stack, stack->m_len-1); _talk_state *st = (_talk_state*) top->m_pData; int err; switch (st->m_iState) { case _STARTED: err = lua_resume(st->m_pThread, nullptr, 0); if (_util_lua_done(err, top)) { return; } _draw(stack); break; case _WAIT_CHOICE: font_print(g_font, 100, 100, "%s", st->m_sNPCText); menu_render(st->m_pChoices); break; case _WAIT_ANY: font_print(g_font, 100, 100, "%s", st->m_sNPCText); font_print(g_font, 100, 240, "Press a button for more exposition..."); break; case _STOPPED: top->m_isDead = true; break; } }
void BasicScreenObject::draw() { // int elapsed = 0; if ((isvisible && _isParentTreeVisible && _isAddedToRenderer) || ismask) { glPushMatrix(); glMultMatrixf(getLocalTransformMatrix().getPtr()); if (hasmask) setupMask(); glBlendFunc(sfactor, dfactor); lightingbefore = glIsEnabled(GL_LIGHTING); depthtestbefore = glIsEnabled(GL_DEPTH_TEST); if (depthtestenabled && !depthtestbefore) glEnable(GL_DEPTH_TEST); if (!depthtestenabled && depthtestbefore) glDisable(GL_DEPTH_TEST); if (lightingenabled && !lightingbefore) glEnable(GL_LIGHTING); if (!lightingenabled && lightingbefore) glDisable(GL_LIGHTING); ofPushMatrix(); ofPushStyle(); ofSetColor(color.r, color.g, color.b, getCombinedAlpha()); _draw(); ofPopStyle(); ofPopMatrix(); ofPushMatrix(); drawChildren(); ofPopMatrix(); ofPushMatrix(); _drawAfterChildren(); ofPopMatrix(); // lighting out if (lightingenabled && !lightingbefore) glDisable(GL_LIGHTING); if (!lightingenabled && lightingbefore) glEnable(GL_LIGHTING); // Depthtest out if (depthtestenabled && !depthtestbefore) glDisable(GL_DEPTH_TEST); if (!depthtestenabled && depthtestbefore) glEnable(GL_DEPTH_TEST); if (hasmask) restoreMask(); glPopMatrix(); } }
void SpriteBase3D::_im_update() { _draw(); pending_update = false; //texture->draw_rect_region(ci,dst_rect,src_rect,modulate); }
bool MgRecordShape::draw(int mode, GiGraphics& gs, const GiContext& ctx, int segment) const { const Matrix2d& w2d = gs.xf().worldToDisplay(); for (ITEMS::const_iterator it = _items.begin(); it != _items.end(); ++it) { (*it)->draw(gs, w2d); } return _draw(mode, gs, ctx, segment) || !_items.empty(); }
void ContourSillhouetteApp::update() { ofPushStyle(); OpenCVEngine::getInstance().update(); _colorManager.setHueInterval(_hueInterval); if (ofGetElapsedTimeMillis() - _lastTimerMillis > _timerMillis) { for (int i = 0; i < _walls.size(); i++) { if (_walls[i]->mainBlob.getVertices().size() > 0) { std::vector<ofPolyline> polylines; polylines.push_back(_walls[i]->mainBlob); ofPath path = _polysToPath(polylines); // int sum = 0; // std::vector<ofPolyline> poly = path.getOutline(); // for (int j = 0; j < poly.size(); j++) { // sum += poly[j].getVertices().size(); // } // cout << sum << endl; path.simplify(3); // sum = 0; // poly.clear(); // poly = path.getOutline(); // for (int j = 0; j < poly.size(); j++) { // sum += poly[j].getVertices().size(); // } // cout << sum << endl << endl; ofPoint centroid = _walls[i]->mainBlob.getCentroid2D(); ContourSillhouette* s = new ContourSillhouette(path, centroid); _colorManager.update(); s->setColor(_colorManager.getForeground()); _sillhouettes[i].push_back(s); } } _lastTimerMillis = ofGetElapsedTimeMillis(); } for (int i = 0; i < _sillhouettes.size(); i++) { for (int j = 0; j < _sillhouettes[i].size(); j++) { _sillhouettes[i][j]->alphaDecrement = _alphaDecrement; _sillhouettes[i][j]->scaleIncrement = _scaleIncrement; _sillhouettes[i][j]->update(); if (_sillhouettes[i][j]->isDead()) { delete _sillhouettes[i][j]; _sillhouettes[i].erase(_sillhouettes[i].begin() + j); } } } for (int i = 0; i < _walls.size(); i++) { _walls[i]->update(); } _draw(); ofPopStyle(); }
void image::draw(SDL_Renderer *_ren, signed int x, signed int y, unsigned int r, unsigned int g, unsigned int b, unsigned int a) { SDL_SetTextureColorMod(img, r, g, b); SDL_SetTextureAlphaMod(img, a); //glColor4f(r / 255.0, g / 255.0, b / 255.0, a / 255.0); _draw(_ren, x, y, 0); SDL_SetTextureAlphaMod(img, 255); SDL_SetTextureColorMod(img, 255, 255, 255); }
void toani_draw_dust ( ) { if ( _cnt_dust > 0 ) { return; } _cnt_dust = _draw ( DUST, vdpSpriteCache[splist_griel].x, vdpSpriteCache[splist_griel].y+8, splist_dust ); //OJO al +8 _inc_dust = 1; }
void Display::draw(){ if (_enabled){ if (_dirty){ set_window(); ansi::clear(); _draw(); _dirty = false; } } }
void drawSolidCylinder(GLdouble innter_radius, GLdouble outer_radius, GLdouble height, GLint slices, GLint stacks) { int j; /* Pre-computed circle */ double *sint, *cost; fghCircleTable(&sint, &cost, -slices); /* Do the stacks */ glCullFace(GL_FRONT); _draw(sint, cost, innter_radius, height, slices, stacks); glCullFace(GL_BACK); _draw(sint, cost, outer_radius, height, slices, stacks); /* Cover the base and top */ glBegin(GL_QUAD_STRIP); glNormal3d(0.0, 0.0, -1.0); for (j = 0; j <= slices; j++) { glVertex3d(cost[j] * innter_radius, sint[j] * innter_radius, -height * 0.5); glVertex3d(cost[j] * outer_radius, sint[j] * outer_radius, -height * 0.5); } glEnd(); glBegin(GL_QUAD_STRIP); glNormal3d(0.0, 0.0, 1.0); for (j = slices; j >= 0; j--) { glVertex3d(cost[j] * innter_radius, sint[j] * innter_radius, height * 0.5); glVertex3d(cost[j] * outer_radius, sint[j] * outer_radius, height * 0.5); } glEnd(); /* Release sin and cos tables */ free(sint); free(cost); }
void GameEngine::_update() { ostringstream os; os << _character.getScore(); if (os.str() != _score.getString()) _score.setString(os.str()); _window.clear(); _draw(); _window.display(); }
void SponsorsApp::task() { Tilda::getGUITask().clearRoot(); Tilda::getGUITask().setOrientation(ORIENTATION_LEFT); //Image is rotated _page = 1; while(true) { _draw(); _page = (_page + 1) % 2; for (uint8_t i=0; i<5; ++i) { Tilda::setLedColor({255, 0, 0}); // red Tilda::delay(300); _draw(); Tilda::setLedColor({0, 255, 0}); // green Tilda::delay(300); _draw(); Tilda::setLedColor({0, 0, 255}); // blue Tilda::delay(300); _draw(); } } }
static void _test_imglist(const char *vname) { struct ct_t **pcts; CvRect *objects; int n = 0; int i; const int gray_mode = 0; ImgQueue queue; IplImage *gray = 0; queue.open(vname); gray = queue.nextImg(gray_mode); n = _get_regions(gray, &objects); if (n < 1) { cvReleaseImage(&gray); return ; } pcts = (struct ct_t **)malloc(n * sizeof(struct ct_t **)); for (i = 0; i < n; ++i) { pcts[i] = ct_new(); ct_init(pcts[i], gray, &objects[i]); } cvNamedWindow("tracking", 1); while ( gray = queue.nextImg(gray_mode) ) { #define _draw(f, r) \ cvRectangle(f, cvPoint((r).x, (r).y), \ cvPoint((r).x+(r).width, (r).y+(r).height), \ cvScalar(255,255,255,0), 2,8,0) for (i = 0; i < n; ++i) { ct_update(pcts[i], gray, &objects[i]); _draw(gray, objects[i]); } cvShowImage("tracking", gray); if (27 == cvWaitKey(1)) break; } #undef _draw cvDestroyWindow("tracking"); for (i = 0; i < n; ++i) { ct_free( &pcts[i] ); } free( pcts ); free( objects ); }
static void use_similar (cairo_t *cr, double red, double green, double blue) { cr = _cairo_create_similar (cr, 1, 1); _draw (cr, red, green, blue); cairo_destroy (cr); }
void Cube::draw() { glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); _draw(); /*glPolygonMode(GL_FRONT_AND_BACK,GL_LINE); dx += 0.001f;dy += 0.001f;dz += 0.001f; glColor3f(0,0,0); _draw(); dx -= 0.001f;dy -= 0.001f;dz -= 0.001f;*/ glPolygonMode(GL_FRONT_AND_BACK,GL_FILL); }
void load_graph_clear(LoadGraph * lg) { gint i; for (i = 0; i < lg->size; i++) lg->data[i] = 0; lg->scale = 1.0; lg->max_value = 1; lg->remax_count = 0; _draw(lg); }
static void use_image (cairo_t *cr, cairo_format_t format, double red, double green, double blue) { cr = _cairo_create_image (cr, format, 1, 1); _draw (cr, red, green, blue); cairo_destroy (cr); }
static void _check_draw (Data *data) { /* The frame is only drawn once we know that a new buffer is ready * from GStreamer and that Cogl is ready to accept some new * rendering */ if (data->draw_ready && data->frame_ready) { _draw (data); data->draw_ready = FALSE; data->frame_ready = FALSE; } }
void Projector::display (char* output) { if (_update_needed) _update(); if (not (paused and motion_blur)) { if (motion_blur) _set_rand_tilt(); else _set_tilt(0,0); _draw(); bool effects = motion_blur or reverse_colors or high_contrast; if (effects) { //slower, using accum buffer _draw_buffer(); _show_buffer(output); } else { //faster, no accum buffer #ifdef CAPTURE if (output) _capture_little(output); #endif finish_buffer(); } } else { //draw a long-exposure image //LATER this ignores color inversion, contrast, etc. const int N = NUM_STILL_FRAMES / (high_quality ? 1 : 4); const float part = 1.0f / N; glClear(GL_ACCUM_BUFFER_BIT); for (int n=0; n<N; ++n) { _set_unif_tilt(n,N); _draw(); glAccum(GL_ACCUM, part); //watch image develop //logger.debug() << " frame " << n+1 << " / " << N |0; glAccum(GL_RETURN, 1.0f); if (n == N-1) _show_buffer(output); else _show_buffer(); } } }
//----------------------------------------------------------------------------- void GameWorld::game_process() //----------------------------------------------------------------------------- { _input_processing(); if(mGameState == GS_RUN) { // ii // input _draw(); } }