void wxVideoTerminal::OnPaint(wxPaintEvent& WXUNUSED(evt)) { wxPaintDC dc(this); DrawTexts(); if (mp_bitmap) { wxMemoryDC dc_mem(*mp_bitmap); dc.Blit( wxPoint(0, 0), dc_mem.GetSize(), &dc_mem, wxPoint(0, 0) ); dc.SetPen( pens[1] ); dc.DrawLine( mp_bitmap->GetWidth(), 0, mp_bitmap->GetWidth(), dc_mem.GetSize().GetHeight() ); } #if 0 if (m_cursor_blink) { dc.SetBrush( brushes[7] ); dc.SetPen( pens[7] ); int scroll_gap = m_topscreen_row - m_scrollpos_row; int virtual_y = m_screen_cur.y+scroll_gap; if (virtual_y >= 0 && virtual_y < m_viewport.y) { dc.DrawRectangle(m_screen_cur.x*m_font_size.GetWidth(), virtual_y * m_font_size.GetHeight(), m_font_size.GetWidth(), m_font_size.GetHeight()); } } #endif }
void CSkillDLG::Draw() { if( !IsVision() ) return ; CTDialog::Draw(); DrawTexts(); }
void Scene::Update(const ObjectList& objList, float dt) { UNREFERENCED_PARAMETER(objList); //Refresh the screen glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glClearColor(m_bgColor.x, m_bgColor.y, m_bgColor.z, m_bgColor.w); // Set mouse position GetPerspPosition(); GetOrthoPosition(); //Todo: Lambda loop expression //std::for_each(m_DrawList.begin(), m_DrawList.end(), [&](DrawList::iterator& it) //{ for (auto it = m_DrawList.begin(); it != m_DrawList.end(); ++it) { if ((*it)->GetType() != PARTICLE) { //Update pipeline Pipeline((*it), dt); vec4 sptColor = (*it)->GetColor(); glUniform4f(m_GSM->GetGLManager()->GetUnifrom(COLOR), sptColor.x, sptColor.y, sptColor.z, sptColor.w); glUniform1i(m_GSM->GetGLManager()->GetUnifrom(TYPE), (*it)->GetType()); glUniform1f(m_GSM->GetGLManager()->GetUnifrom(TIME), Timer::GetInstance().GetElapsedTime()); //Todo: high quality? //glUniformMatrix4fv(); // Draw Texts if ((*it)->GetType() == TEXT) DrawTexts(static_cast<Text*>(*it)); else if ((*it)->GetType() == LIGHT) DrawLights(static_cast<Light*>(*it)); // Draw Sprites else if ((*it)->GetType() == SPRITE || (*it)->GetType() == DARKNESS) DrawSprites(*it); } // Draw Particles else DrawParticle(static_cast<Emitter*>(*it), dt); } }
void CZXingBarcodeReaderAppView::Draw(const TRect& /*aRect*/) const { CWindowGc& gc = SystemGc (); // Draw backbuffer that has camera picture gc.BitBlt(TPoint(0, 0), iBackBuffer); // Draw texts DrawTexts(gc); // Focus rect if (iCameraWrapper && iCameraWrapper->State() == CCameraEngine::EEngineFocusing) { gc.SetPenColor(KRgbWhite); gc.DrawRect(iFocusRect); } }
void CCursorIcons::DrawCursors() { if (icons.empty() || !cmdColors.UseQueueIcons()) { return; } glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluOrtho2D(0.0f, 1.0f, 0.0f, 1.0f); glMatrixMode(GL_MODELVIEW); glPushMatrix(); glLoadIdentity(); glColor4f(1.0f, 1.0f, 1.0f, cmdColors.QueueIconAlpha()); int currentCmd = (icons.begin()->cmd + 1); // force the first binding CMouseCursor* currentCursor = NULL; std::set<Icon>::iterator it; for (it = icons.begin(); it != icons.end(); ++it) { const int command = it->cmd; if (command != currentCmd) { currentCmd = command; currentCursor = GetCursor(currentCmd); if (currentCursor != NULL) { currentCursor->BindTexture(); } } if (currentCursor != NULL) { const float3 winPos = camera->CalcWindowCoordinates(it->pos); if (winPos.z <= 1.0f) { currentCursor->DrawQuad((int)winPos.x, (int)winPos.y); } } } DrawTexts(); // use the same transformation glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); glPopMatrix(); }
// --------------------------------------------------------------------------- // CAknDiscreetPopupDrawer::CreatePopupBitmap // --------------------------------------------------------------------------- // void CAknDiscreetPopupDrawer::CreatePopupBitmapL( const TRect& aRect ) { delete iPopupBitmap; iPopupBitmap = NULL; // create a bitmap to draw to CFbsBitmap* bitmap = new ( ELeave ) CFbsBitmap; CleanupStack::PushL( bitmap ); bitmap->Create( aRect.Size(), CCoeEnv::Static()->ScreenDevice()->DisplayMode() ); CFbsBitGc* fbsBitGc = CFbsBitGc::NewL(); CleanupStack::PushL( fbsBitGc ); CFbsBitmapDevice* bmpDevice = CFbsBitmapDevice::NewL( bitmap ); CleanupStack::PushL( bmpDevice ); fbsBitGc->Activate( bmpDevice ); // draw background of the popup MAknsSkinInstance* skin = AknsUtils::SkinInstance(); AknsDrawUtils::DrawFrame( skin, *fbsBitGc, aRect, aRect, KAknsIIDQsnFrPopupPreview, KAknsIIDDefault, KAknsDrawParamDefault ); // Draw the texts TRgb textColor( EikonEnv()->ControlColor( EColorControlText, *iControl ) ); if ( iAction ) { fbsBitGc->SetUnderlineStyle( EUnderlineOn ); AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnHighlightColors, EAknsCIQsnHighlightColorsCG3 ); } else { AknsUtils::GetCachedColor( skin, textColor, KAknsIIDQsnTextColors, EAknsCIQsnTextColorsCG55 ); } fbsBitGc->SetPenColor( textColor ); DrawTexts( fbsBitGc ); fbsBitGc->SetUnderlineStyle( EUnderlineOff ); // draw the icon if ( iIcon && iIcon->Bitmap() && iIcon->Mask() ) { fbsBitGc->BitBltMasked( iIconRect.iTl, iIcon->Bitmap(), iIcon->Bitmap()->SizeInPixels(), iIcon->Mask(), EFalse ); } else if( iIcon && iIcon->Bitmap() ) { fbsBitGc->BitBlt( iIconRect.iTl, iIcon->Bitmap() ); } CleanupStack::PopAndDestroy( bmpDevice ); CleanupStack::PopAndDestroy( fbsBitGc ); CleanupStack::Pop( bitmap ); iPopupBitmap = bitmap; }
void Game::Update(sf::Time const diff) { // Old way to handle keyboard's user inputs // Handle the events /*sf::Event event; while (window.pollEvent(event)) { switch (event.type) { case sf::Event::LostFocus: PreviousState = State; State = GAME_STATE_PAUSED; break; case sf::Event::GainedFocus: State = PreviousState; PreviousState = GAME_STATE_NONE; return; // Process on next tick case sf::Event::Resized: window.setView(sf::View(sf::FloatRect(0.f, 0.f, float(event.size.width), float(event.size.height)))); break; case sf::Event::KeyPressed: { switch (event.key.code) { case sf::Keyboard::Q: GetPlayer()->EmitParticle(sf::seconds(1), true); break; case sf::Keyboard::Up: if (State == GAME_STATE_MENU) MenuMap->ChangeOption(true); break; case sf::Keyboard::Down: if (State == GAME_STATE_MENU) MenuMap->ChangeOption(false); break; case sf::Keyboard::BackSpace: if (State == GAME_STATE_MENU) MenuMap->ChangeMenu(true); break; case sf::Keyboard::Space: if (State == GAME_STATE_MENU) MenuMap->ChangeMenu(false); else if (State == GAME_STATE_PLAYING) GetPlayer()->Jump(); break; case sf::Keyboard::R: PrepareWorld(); break; } break; } } }*/ // New way to handle user inputs (keyboard, joystick, ...) InputHandler.Update(window); if (InputHandler.IsActive(0, ACTION_ENABLE_DEBUG)) debugMode ^= true; if (InputHandler.IsActive(0, ACTION_ENTER)) if (State == GAME_STATE_MENU) MenuMap->ChangeMenu(false); if (State == GAME_STATE_PAUSED) return; window.clear(sf::Color(136, 247, 255)); if (State == GAME_STATE_PLAYING) { if (CurrentMap) CurrentMap->Update(diff); for (std::list<Entity*>::iterator itr = Entities.begin(); itr != Entities.end(); ++itr) (*itr)->Update(diff); for (std::list<Player*>::iterator itr = Players.begin(); itr != Players.end(); ++itr) (*itr)->Update(diff); } else if (State == GAME_STATE_MENU) { if (!MenuMap) MenuMap = new Menu(this); MenuMap->Update(diff); } DrawTexts(); window.display(); if (State == GAME_STATE_PLAYING) { sf::View view = window.getView(); view.setCenter(GetPlayer()->GetPositionX(), GetPlayer()->GetPositionY()); window.setView(view); } }