/** @param pos The new position. @note Doesn't acctually change the mouse position on the screen, just the data. */ void Input::setMousePosition(Vector pos) { mDx = pos.x - mousePosition().x; mDy = pos.y - mousePosition().y; mMousePosition = pos; }
void buttonDown(Gosu::Button btn) noexcept override { if (btn == Gosu::kbEscape) { close(); } else if (btn == Gosu::msLeft) { auto selected = selectNode(); if (selected) { if (input().down(Gosu::kbLeftShift)) { // dragl grabbedNode = selected; } } else { auto nearest = graph.getNearestNode(mousePosition()); auto node = graph.createNode(mousePosition()); nodeOwner[node] = game.getCurrentPlayer(); node -> connect(nearest); onGraphChanged(); game.endTurn(); } } else if (btn == Gosu::msRight) { auto selected = selectNode(); if (selected) { connectingNode = selected; } } }
void Menu::HandleEvent(const SDL_Event& evnt) { if (evnt.type == SDL_QUIT) { #if defined MAEMO || defined __SYMBIAN32__ AppWarmux::EmergencyExit(); #else key_cancel(); #endif } else if (evnt.type == SDL_KEYDOWN) { // Drop key events that are purely modifiers if (Keyboard::IsModifier(evnt.key.keysym.sym)) return; // Allow widgets to interpret any key they want, // and do not reserve esc/return/delete/backspace bool used_by_widget = widgets.SendKey(evnt.key.keysym); if (!used_by_widget) { switch (evnt.key.keysym.sym) { case SDLK_ESCAPE: key_cancel(); break; case SDLK_RETURN: case SDLK_KP_ENTER: key_ok(); break; case SDLK_UP: key_up(); break; case SDLK_DOWN: key_down(); break; case SDLK_LEFT: key_left(); break; case SDLK_RIGHT: key_right(); break; case SDLK_TAB: key_tab(); break; default: // should have been handle upper! break; } } } else if (evnt.type == SDL_MOUSEBUTTONUP) { Point2i mousePosition(evnt.button.x, evnt.button.y); if (!BasicOnClickUp(mousePosition)) { OnClickUp(mousePosition, evnt.button.button); } } else if (evnt.type == SDL_MOUSEBUTTONDOWN) { Point2i mousePosition(evnt.button.x, evnt.button.y); OnClick(mousePosition, evnt.button.button); } }
bool InteractiveImageHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa, osg::Object*, osg::NodeVisitor* nv) { if (ea.getHandled()) return false; if (!_image) return false; switch(ea.getEventType()) { case(osgGA::GUIEventAdapter::MOVE): case(osgGA::GUIEventAdapter::DRAG): case(osgGA::GUIEventAdapter::PUSH): case(osgGA::GUIEventAdapter::RELEASE): { osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa); int x,y; if (mousePosition(view, nv, ea, x, y)) { return _image->sendPointerEvent(x, y, ea.getButtonMask()); } break; } case(osgGA::GUIEventAdapter::KEYDOWN): case(osgGA::GUIEventAdapter::KEYUP): { osgViewer::View* view = dynamic_cast<osgViewer::View*>(&aa); int x,y; bool sendKeyEvent = mousePosition(view, nv, ea, x, y); if (sendKeyEvent) { return _image->sendKeyEvent(ea.getKey(), ea.getEventType()==osgGA::GUIEventAdapter::KEYDOWN); } break; } case (osgGA::GUIEventAdapter::RESIZE): { if (_fullscreen && _camera.valid()) { _camera->setViewport(0, 0, ea.getWindowWidth(), ea.getWindowHeight()); resize(ea.getWindowWidth(), ea.getWindowHeight()); return true; } break; } default: return false; } return false; }
void Game::init(const char* sceneFile) { CSize backBufferSize = GraphicsInterface::backBufferSize(); ActorRegistry::registerActors(actorFactory_); renderer_.init(backBufferSize); ui_.init(&renderer_); Pad::init(); Mouse::init(); Point mousePosition((int)(backBufferSize.width / 2.0f), (int)(backBufferSize.height / 2.0f)); Mouse::setPosition(mousePosition); Keyboard::init(); clock_.init(); editor_.init(); //camera_.translateY(0.8f); camera_.translateZ(4.0f); camera_.setIsPlayerControlled(true); camera_.setProjection(45.0f, GraphicsInterface::aspectRatio(), 1.0f, 100.0f); editor_.setCamera(&camera_); if (sceneFile) { WorldLoader loader; loader.loadFromSceneFile(sceneFile, world_, sceneContext_, actorFactory_); } Keyboard::setKeydownListener(this); Mouse::setMouseListener(this); }
void ofApp::draw() { ofBackground(0); map.draw(); ofSetColor(255, 127, 255); cout << map.getGeoLocationCenter() << endl; ofDrawBitmapStringHighlight(ofToString(map.getGeoLocationCenter()), ofGetWidth() / 2, ofGetHeight() / 2); ofVec2d mousePosition(mouseX, mouseY); ofDrawBitmapStringHighlight(ofToString(map.pointToTileCoordinate(mousePosition)), mouseX + 16, mouseY); ofDrawBitmapStringHighlight(ofToString(map.pointToGeolocation(mousePosition)), mouseX + 16, mouseY + 14); }
void Application::update() { if (m_hasFocus) { // scrolling if (sf::Mouse::isButtonPressed(sf::Mouse::Left)) { sf::Vector2f mousePosition(m_window.mapPixelToCoords(sf::Mouse::getPosition(m_window))); sf::Vector2f difference = mousePosition - m_previousMousePos; m_spectrogram->move(difference.x, 0.f); updatePlayProgressBar(); } } // save the mouse coordinates m_previousMousePos = m_window.mapPixelToCoords(sf::Mouse::getPosition(m_window)); // do the FFT m_spectrogram->updateImage(); m_spectrogram->updateImage(); if (m_sound.getStatus() == sf::Sound::Playing) { updatePlayProgressBar(); } }
bool List::clickHandler(sf::Event& event) { sf::Vector2f mousePosition(event.mouseMove.x, event.mouseMove.y); int i = 5; for(std::map<int, GameListItem>::iterator it = _iterator; it != _list.end() && i > 0; it++) { i--; if ((*it).second.getName().getGlobalBounds().contains(mousePosition) || (*it).second.getPlayerNumber().getGlobalBounds().contains(mousePosition)) { if ((*it).second.getIsSelected() == false) { if (_selected != _list.end()) { _selected->second.setIsSelected(false); _selected->second.setColor(_color); } (*it).second.setIsSelected(true); (*it).second.setColor(sf::Color(255, 255, 102)); _selected = it; } else return true; } } return false; }
void GamePanel::UpdateDrag(){ sf::Vector2f mousePosition(sf::Mouse::getPosition(*Drawn::gameWindow).x,sf::Mouse::getPosition(*Drawn::gameWindow).y); if(dragOffset.x == -1 && dragOffset.y == -1) dragOffset = mousePosition - GetPosition(); //std::cout << "Offsets X: " << std::to_string(offset.x) << " Y: " << std::to_string(offset.y) << std::endl; sf::Vector2f newPosition(mousePosition.x - dragOffset.x - 8,mousePosition.y - dragOffset.y - 8); SetPosition(newPosition.x,newPosition.y); };
void List::scrollHandler(sf::Event& event) { sf::Vector2f mousePosition(event.mouseMove.x, event.mouseMove.y); if (_list.size() >= 6 && _scrollBtn[0].getClickableBtn().getGlobalBounds().contains(mousePosition)) this->slide(true); if (_list.size() >= 6 && _scrollBtn[1].getClickableBtn().getGlobalBounds().contains(mousePosition)) this->slide(false); }
void Menu::Run(bool skip_menu) { signal_begin_run(); if (skip_menu) { signal_ok(); return; } Mouse::pointer_t old_pointer = Mouse::GetInstance()->SetPointer(Mouse::POINTER_STANDARD); int x = 0; int y = 0; close_menu = false; // Display the background DrawBackground(); SDL_GetMouseState(&x, &y); Point2i mousePosition(x, y); Display(mousePosition); SDL_EnableKeyRepeat(SDL_DEFAULT_REPEAT_DELAY, SDL_DEFAULT_REPEAT_INTERVAL); do { // this is the current menu (here in case we had run a submenu) AppWarmux::GetInstance()->SetCurrentMenu(this); // Poll and treat events HandleEvents(); // Avoid to calculate redraw menu when comming back for closing. if (!close_menu) { SDL_GetMouseState( &x, &y ); Point2i mousePosition(x, y); Display(mousePosition); } } while (!close_menu); Mouse::GetInstance()->SetPointer(old_pointer); }
unmanaged_ptr<Node> selectNode() noexcept { if (graph.getNodeCount() == 0) return nullptr; auto mousePos = mousePosition(); auto nearest = graph.getNearestNode(mousePos); auto diff = std::abs(*nearest - mousePos); if (diff.x < 10 && diff.y < 10) { return nearest; } return nullptr; }
void FlyCamera::UpdateRotation(float deltaTime) { double mouseX; double mouseY; glfwGetCursorPos(window, &mouseX, &mouseY); glm::vec2 mousePosition(mouseX, mouseY); auto deltaMouse = mousePosition - prevMousePosition; SetRotation(glm::vec3(0, 1, 0), (float)(deltaMouse.x * 0.001f)); SetRotation(glm::vec3(1, 0, 0), (float)(deltaMouse.y * 0.001f)); prevMousePosition = mousePosition; }
void Slider::mouseMoveEvent(QMouseEvent *e) { if (maximum() > 0) { int pos = getMousePos(e->pos()); if (pos != lastMousePos) { lastMousePos = pos; if (pos < 0) pos = 0; emit mousePosition(pos); } } QSlider::mouseMoveEvent(e); }
void PixelWidget::mouseMoveEvent(QMouseEvent *e) { if (m_mouseDown) m_dragCurrent = e->pos(); int x = e->x() / zoomValue(); int y = e->y() / zoomValue(); if (x < m_surface.width() && y < m_surface.height() && x >= 0 && y >= 0) { m_currentColor = m_surface.pixel(x, y); } else m_currentColor = QColor(); emit mousePosition(x, y); update(); }
/*! * \brief Check event, if the mouse is over the button * \param e The pointer on the event * \return id NULL if not found */ std::string NButton::eventMouseMoved(sf::Event * e) { std::string id = "NULL"; if(m_hidden) return id; sf::FloatRect mousePosition(e->mouseMove.x, e->mouseMove.y, 1, 1); if(m_mainSprite.getGlobalBounds(). intersects(mousePosition)) { id = m_id; m_isOver = true; } else { m_isOver = false; } return id; }
void MVGManipulator::getMousePosition(M3dView& view, MPoint& point, MVGManipulator::Space space) { short x, y; mousePosition(x, y); switch(space) { case kWorld: point = MVGGeometryUtil::viewToWorldSpace(view, MPoint(x, y)); break; case kCamera: point = MVGGeometryUtil::viewToCameraSpace(view, MPoint(x, y)); break; case kView: point = MPoint(x, y); break; } }
/*! * \brief Check event * \param e The pointer on the event * \return id NULL if not found */ std::string NTextField::eventMousePressed(sf::Event * e) { std::string id = "NULL"; if(!m_isEnable) return id; sf::FloatRect mousePosition(e->mouseButton.x, e->mouseButton.y, 1, 1); if(m_mainSprite.getGlobalBounds(). intersects(mousePosition)) { id = m_id; m_isActive = true; } else { m_isActive = false; } return id; }
void World::render(Player* player) { assert(m_mainPlayer && !m_server); //Sky at bottom layer //TODO render tilemap.. //set our view so that the player will stay relative to the view, in the center. //HACK m_window->setView(*m_view); m_lightRenderer->renderToFBO(); m_tileRenderer->render(); //FIXME: incorporate entities into the pre-lit gamescene FBO, then render lighting as last pass m_lightRenderer->renderToBackbuffer(); //HACK m_window->setView(m_window->getDefaultView()); m_spriteSheetRenderer->renderEntities(); m_spriteSheetRenderer->renderCharacters(); // ================================================== glm::ivec2 mouse = mousePosition(); const float radius = 16.0f; const float halfRadius = radius * 0.5; const float halfBlockSize = Block::BLOCK_SIZE * 0.5; glm::vec2 topLeftLocalCoordinates = glm::vec2(m_mainPlayer->position().x - 1600 / 2, m_mainPlayer->position().y - 900 / 2); glm::vec2 transformedMouse = glm::vec2(topLeftLocalCoordinates.x + mouse.x, topLeftLocalCoordinates.y + mouse.y); //snap crosshair to the tile grid..the offset is already calculated for us (apparently), so even with per-pixel tilemap scrolling it snaps fine. glm::vec2 crosshairPosition(floor(transformedMouse.x / Block::BLOCK_SIZE) * Block::BLOCK_SIZE, floor(transformedMouse.y / Block::BLOCK_SIZE) * Block::BLOCK_SIZE); m_blockPickingCrosshair->setPosition(crosshairPosition); // ================================================== // ALLEGRO_COLOR color = al_map_rgb(255, 0, 0); // al_draw_rectangle(crosshairPosition.x(), crosshairPosition.y(), crosshairPosition.x() + radius, crosshairPosition.y() + radius, color, 1.0f); // m_sky->render(); }
/*! * \brief Check event * \param e The pointer on the event * \return id NULL if not found */ std::string NButton::eventMousePressed(sf::Event * e) { std::string id = "NULL"; if(m_hidden) return id; sf::FloatRect mousePosition(e->mouseButton.x, e->mouseButton.y, 1, 1); if(m_mainSprite.getGlobalBounds(). intersects(mousePosition)) { id = m_id; m_isActive = true; // Triggering if((int)m_actionId != -1 && m_ptr_trggObject != nullptr) { m_ptr_trggObject->trigger(m_actionId, m_textList); } } return id; }
void List::mouseMovedHandler(sf::RenderWindow & window, sf::Event& event) { int i = 5; sf::Vector2f mousePosition(event.mouseMove.x, event.mouseMove.y); for(std::map<int, GameListItem>::iterator it = _iterator; it != _list.end() && i > 0; it++) { i--; (*it).second.eventHandler(window, event); } if (_list.size() > 5) { if (_scrollBtn[0].getClickableBtn().getGlobalBounds().contains(mousePosition)) _scrollBtn[0].setColor(_highlightColor); else _scrollBtn[0].setColor(_color); if (_scrollBtn[1].getClickableBtn().getGlobalBounds().contains(mousePosition)) _scrollBtn[1].setColor(_highlightColor); else _scrollBtn[1].setColor(_color); } }
void WindowEventDispatcher::handleMouse(GLFWwindow* glfwWindow, int button, int action, int modifiers) { dispatchEvent(glfwWindow, new MouseEvent(mousePosition(glfwWindow), button, action, modifiers)); }
void WindowEventDispatcher::handleScroll(GLFWwindow* glfwWindow, double xOffset, double yOffset) { dispatchEvent(glfwWindow, new ScrollEvent(glm::vec2(xOffset, yOffset), mousePosition(glfwWindow))); }
void State::processInput() { ControllerState* mainController = engine()->hardware()->getControllerState(0); if(!mainController) { return; } #ifdef DEBUG_KEYS if(mainController->isButtonPressed(ControllerState::BTN_DBG_StateStep)) { if(frameCounter < 0) { syslog("State %p pause", (AOEObject*)this); frameCounter = 0; } else { syslog("State %p step", (AOEObject*)this); frameCounter += stepFrameCount; } } if(mainController->isButtonPressed(ControllerState::BTN_DBG_StatePlay)) { syslog("State %p play", (AOEObject*)this); frameCounter = -1; } if(mainController->isButtonPressed(ControllerState::BTN_DBG_IncreaseStateStep)) { if(stepFrameCount < 240) { stepFrameCount++; }syslog("Step by step : %d frames", stepFrameCount); } if(mainController->isButtonPressed(ControllerState::BTN_DBG_DecreaseStateStep)) { if(stepFrameCount > 1) { stepFrameCount--; }syslog("Step by step : %d frames", stepFrameCount); } if(mainController->isButtonPressed(ControllerState::BTN_DBG_ReloadGraphics)) { unloadGraphics(); } if(mainController->isButtonPressed(ControllerState::BTN_DBG_SwitchStateRendering)) { renderingEnabled = !renderingEnabled; } if(mainController->isButtonPressed(ControllerState::BTN_DBG_SwitchHardwareRendering)) { engine()->hardware()->switchRendering(); } #ifdef DISPLAY_COLLISIONS if(mainController->isButtonPressed(ControllerState::BTN_DBG_DisplayCollisions)) { displayCollisions = !displayCollisions; } #endif /* DISPLAY_COLLISIONS */ #endif /* DEBUG_KEYS */ if(controllerEnabled) { if(!controlledObjects.empty()) { controlledObjects[0]->processInput(mainController); for(unsigned int i=1; i<controlledObjects.size(); i++) { controlledObjects[i]->processInput(engine()->hardware()->getControllerState(i)); } } #ifdef MOUSE_SUPPORT if(mouseCursor) { if(mainController->getMouseMode() == MOUSE_RELATIVE) { mouseCursor->translate(mainController->getMouseX(), mainController->getMouseY()); } else { Point mousePosition(mainController->getMouseX(), mainController->getMouseY()); mouseCursor->setAbsolutePosition(mousePosition); } mouseCursor->setAbsoluteRotation(mainController->getMouseAngle()); } if(dragging) { pointerDeltaX = mainController->getMouseX(); pointerDeltaY = mainController->getMouseY(); drag(); } if(mainController->isMouseButtonReleased(0)) { sendMouseSignal(RELEASE_CLICK, 0); } if(mainController->isMouseButtonReleased(1) || mainController->isMouseButtonReleased(2)) { sendMouseSignal(RELEASE_CLICK, 1); } if(mainController->isMouseButtonPressed(0)) { sendMouseSignal(CLICK, 0); } if(mainController->isMouseButtonPressed(1) || mainController->isMouseButtonPressed(2)) { sendMouseSignal(CLICK, 1); } #endif } }
// virtual void CustomRuler::mouseMoveEvent(QMouseEvent * event) { event->setAccepted(true); int mappedXPos = (int)((event->x() + offset()) / m_factor); emit mousePosition(mappedXPos); if (event->buttons() == Qt::LeftButton) { int pos; if (m_moveCursor == RULER_START || m_moveCursor == RULER_END) { pos = m_view->getSnapPointForPos(mappedXPos); } else pos = mappedXPos; int zoneStart = m_zoneStart; int zoneEnd = m_zoneEnd; if (pos < 0) pos = 0; if (m_moveCursor == RULER_CURSOR) { QPoint diff = event->pos() - m_clickPoint; if (m_mouseMove == NO_MOVE) { if (qAbs(diff.x()) >= QApplication::startDragDistance()) { m_mouseMove = HORIZONTAL_MOVE; } else if (KdenliveSettings::verticalzoom() && qAbs(diff.y()) >= QApplication::startDragDistance()) { m_mouseMove = VERTICAL_MOVE; } else return; } if (m_mouseMove == HORIZONTAL_MOVE) { if (pos != m_headPosition && pos != m_view->cursorPos()) { int x = m_headPosition == SEEK_INACTIVE ? pos : m_headPosition; m_headPosition = pos; int min = qMin(x, m_headPosition); int max = qMax(x, m_headPosition); update(min * m_factor - offset() - 3, LABEL_SIZE, (max - min) * m_factor + 6, FULL_HEIGHT - LABEL_SIZE); emit seekCursorPos(pos); m_view->slotCheckPositionScrolling(); } } else { int verticalDiff = m_startRate - (diff.y()) / 7; if (verticalDiff != m_rate) emit adjustZoom(verticalDiff); } return; } else if (m_moveCursor == RULER_START) m_zoneStart = qMin(pos, m_zoneEnd); else if (m_moveCursor == RULER_END) m_zoneEnd = qMax(pos, m_zoneStart); else if (m_moveCursor == RULER_MIDDLE) { int move = pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2); if (move + m_zoneStart < 0) move = - m_zoneStart; m_zoneStart += move; m_zoneEnd += move; } int min = qMin(m_zoneStart, zoneStart); int max = qMax(m_zoneEnd, zoneEnd); update(min * m_factor - m_offset - 2, LABEL_SIZE, (max - min + 1) * m_factor + 4, FULL_HEIGHT - LABEL_SIZE); } else { int pos = (int)((event->x() + m_offset)); if (event->y() <= LABEL_SIZE) { setCursor(Qt::ArrowCursor); } else if (qAbs(pos - m_zoneStart * m_factor) < 4) { setCursor(QCursor(Qt::SizeHorCursor)); if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone start: %1", m_zoneStart)); else setToolTip(i18n("Zone start: %1", m_timecode.getTimecodeFromFrames(m_zoneStart))); } else if (qAbs(pos - (m_zoneEnd + 1) * m_factor) < 4) { setCursor(QCursor(Qt::SizeHorCursor)); if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone end: %1", m_zoneEnd)); else setToolTip(i18n("Zone end: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd))); } else if (qAbs(pos - (m_zoneStart + (m_zoneEnd - m_zoneStart) / 2.0) * m_factor) < 4) { setCursor(Qt::SizeHorCursor); if (KdenliveSettings::frametimecode()) setToolTip(i18n("Zone duration: %1", m_zoneEnd - m_zoneStart)); else setToolTip(i18n("Zone duration: %1", m_timecode.getTimecodeFromFrames(m_zoneEnd - m_zoneStart))); } else { setCursor(Qt::ArrowCursor); if (KdenliveSettings::frametimecode()) setToolTip(i18n("Position: %1", (int)(pos / m_factor))); else setToolTip(i18n("Position: %1", m_timecode.getTimecodeFromFrames(pos / m_factor))); } } }
void draw() noexcept override { for (auto& node:graph.getNodes()) { double val = betweenness.getValue(node); auto col = Gosu::interpolate(Gosu::Color::BLUE, Gosu::Color::RED, val); nodeImage.draw(node->x-10, node->y-10, zNodes, 1, 1, col); auto owner = nodeOwner.find(node); if (owner != nodeOwner.end()) { nodeFillImage.draw(node->x-10, node->y-10, zNodes, 1, 1, owner->second->getColor()); } for (auto& edge: node->getEdges()) { double val2 = betweenness.getValue(edge->getTarget()); auto col2 = Gosu::interpolate(Gosu::Color::BLUE, Gosu::Color::RED, val2); graphics().drawLine( node->x, node->y, col, edge->getTarget()->x, edge->getTarget()->y, col2, zEdges ); } } auto mousePos = mousePosition(); drawLine(graphics(), Gosu::Color::WHITE, zUI, mousePos, mousePos + Position(20, 5), mousePos + Position(5, 20), mousePos ); if (!connectingNode) { auto nearest = graph.getNearestNode(mousePos); graphics().drawLine( mousePos.x, mousePos.y, Gosu::Color::YELLOW, nearest->x, nearest->y, Gosu::Color::YELLOW, zUI ); } if (shortestDistSource) { // draw some sparkling green particles not signify a new edge that is being created Position targetPos; auto selected = selectNode(); // snap to cursor && not to self if (selected && (selected != shortestDistSource)) { targetPos = *selected; } else { targetPos = mousePos; } graphics().drawLine( targetPos.x, targetPos.y, Gosu::Color::AQUA, shortestDistSource->x, shortestDistSource->y, Gosu::Color::AQUA, zUI ); } if (connectingNode) { // draw some sparkling green particles not signify a new edge that is being created Position targetPos; auto selected = selectNode(); // snap to cursor && not to self && not to already connected nodes if (selected && (selected != connectingNode) && !selected->getEdge(connectingNode)) { targetPos = *selected; } else { targetPos = mousePos; } graphics().drawLine( targetPos.x, targetPos.y, Gosu::Color::GREEN, connectingNode->x, connectingNode->y, Gosu::Color::GREEN, zUI ); } if (!pathsToDraw.empty()) { for (auto pathToDraw : pathsToDraw) { for (auto it = pathToDraw.begin(); it != pathToDraw.end(); it++) { auto next = it; next++; if (next == pathToDraw.end()) break; graphics().drawLine( (*it)->x, (*it)->y, Gosu::Color::AQUA, (*next)->x, (*next)->y, Gosu::Color::AQUA, zUI ); } } } { std::wstringstream wss; wss << Gosu::fps() << L" fps"; font.draw(wss.str().c_str(), 0, 0, zUI); } double y = 20; auto currentPlayer = game.getCurrentPlayer(); for (auto player : game.getPlayers()) { auto name = player->getName(); auto wname = std::wstring(std::begin(name), std::end(name)); if (player == currentPlayer) { font.draw(wname, 0, y-2, zUI, 1.4, 1.4, player->getColor()); } else { font.draw(wname, 0, y, zUI, 1, 1, player->getColor()); } y += 20; } double x = graphics().width() - 50; for (auto player : game.getPlayers()) { auto col = player->getColor(); double score = player->getScore() * 30; graphics().drawQuad( x, 0, col, x+40, 0, col, x+40, score, col, x, score, col, zUI ); std::wstringstream wss; wss << score; font.draw(wss.str().c_str(), x, score, zUI); x -= 50; } }