mirror of
https://github.com/overte-org/overte.git
synced 2025-04-29 23:02:40 +02:00
Stats tweaks: fonts adjustments
This commit is contained in:
parent
5fe59acb87
commit
e545c2ac65
3 changed files with 49 additions and 24 deletions
|
@ -591,7 +591,13 @@ void Application::resizeGL(int width, int height) {
|
||||||
updateProjectionMatrix();
|
updateProjectionMatrix();
|
||||||
glLoadIdentity();
|
glLoadIdentity();
|
||||||
|
|
||||||
Stats::getInstance()->resetWidthOnResizeGL(width);
|
// update Stats width
|
||||||
|
int horizontalOffset = 0;
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::Mirror)) {
|
||||||
|
// mirror is enabled, let's set horizontal offset to give stats some margin
|
||||||
|
horizontalOffset += MIRROR_VIEW_WIDTH + MIRROR_VIEW_LEFT_PADDING * 2;
|
||||||
|
}
|
||||||
|
Stats::getInstance()->resetWidth(width, horizontalOffset);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::updateProjectionMatrix() {
|
void Application::updateProjectionMatrix() {
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Stats.cpp
|
// Stats.cpp
|
||||||
// interface
|
// interface
|
||||||
//
|
//
|
||||||
|
// Created by Lucas Crisman on 22/03/14.
|
||||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -38,9 +39,11 @@ Stats::Stats():
|
||||||
_generalStatsWidth(STATS_GENERAL_MIN_WIDTH),
|
_generalStatsWidth(STATS_GENERAL_MIN_WIDTH),
|
||||||
_pingStatsWidth(STATS_PING_MIN_WIDTH),
|
_pingStatsWidth(STATS_PING_MIN_WIDTH),
|
||||||
_geoStatsWidth(STATS_GEO_MIN_WIDTH),
|
_geoStatsWidth(STATS_GEO_MIN_WIDTH),
|
||||||
_voxelStatsWidth(STATS_VOXEL_MIN_WIDTH)
|
_voxelStatsWidth(STATS_VOXEL_MIN_WIDTH),
|
||||||
|
_lastHorizontalOffset(0)
|
||||||
{
|
{
|
||||||
// no constructor behavior yet, only members initialization
|
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
|
||||||
|
resetWidth(glWidget->width(), 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stats::toggleExpanded() {
|
void Stats::toggleExpanded() {
|
||||||
|
@ -75,6 +78,7 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
||||||
statsX += _generalStatsWidth;
|
statsX += _generalStatsWidth;
|
||||||
|
|
||||||
// ping stats click
|
// ping stats click
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
lines = _expanded ? 4 : 3;
|
lines = _expanded ? 4 : 3;
|
||||||
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
||||||
if (mouseX > statsX && mouseX < statsX + _pingStatsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
if (mouseX > statsX && mouseX < statsX + _pingStatsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
||||||
|
@ -82,8 +86,9 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
statsX += _pingStatsWidth;
|
statsX += _pingStatsWidth;
|
||||||
|
}
|
||||||
|
|
||||||
// top-center stats panel click
|
// geo stats panel click
|
||||||
lines = _expanded ? 4 : 3;
|
lines = _expanded ? 4 : 3;
|
||||||
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
statsHeight = lines * STATS_PELS_PER_LINE + 10;
|
||||||
if (mouseX > statsX && mouseX < statsX + _geoStatsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
if (mouseX > statsX && mouseX < statsX + _geoStatsWidth && mouseY > statsY && mouseY < statsY + statsHeight) {
|
||||||
|
@ -102,24 +107,32 @@ void Stats::checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseD
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Stats::resetWidthOnResizeGL(int width) {
|
void Stats::resetWidth(int width, int horizontalOffset) {
|
||||||
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
|
QGLWidget* glWidget = Application::getInstance()->getGLWidget();
|
||||||
int extraSpace = glWidget->width()
|
int extraSpace = glWidget->width() - horizontalOffset -2
|
||||||
- STATS_GENERAL_MIN_WIDTH
|
- STATS_GENERAL_MIN_WIDTH
|
||||||
- STATS_PING_MIN_WIDTH
|
- (Menu::getInstance()->isOptionChecked(MenuOption::TestPing) ? STATS_PING_MIN_WIDTH -1 : 0)
|
||||||
- STATS_GEO_MIN_WIDTH
|
- STATS_GEO_MIN_WIDTH
|
||||||
- STATS_VOXEL_MIN_WIDTH
|
- STATS_VOXEL_MIN_WIDTH;
|
||||||
- 3;
|
|
||||||
|
int panels = 4;
|
||||||
|
|
||||||
_generalStatsWidth = STATS_GENERAL_MIN_WIDTH;
|
_generalStatsWidth = STATS_GENERAL_MIN_WIDTH;
|
||||||
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
_pingStatsWidth = STATS_PING_MIN_WIDTH;
|
_pingStatsWidth = STATS_PING_MIN_WIDTH;
|
||||||
|
} else {
|
||||||
|
_pingStatsWidth = 0;
|
||||||
|
panels = 3;
|
||||||
|
}
|
||||||
_geoStatsWidth = STATS_GEO_MIN_WIDTH;
|
_geoStatsWidth = STATS_GEO_MIN_WIDTH;
|
||||||
_voxelStatsWidth = STATS_VOXEL_MIN_WIDTH;
|
_voxelStatsWidth = STATS_VOXEL_MIN_WIDTH;
|
||||||
|
|
||||||
if (extraSpace > 4) {
|
if (extraSpace > panels) {
|
||||||
_generalStatsWidth += (int) extraSpace / 4;
|
_generalStatsWidth += (int) extraSpace / panels;
|
||||||
_pingStatsWidth += (int) extraSpace / 4;
|
if (Menu::getInstance()->isOptionChecked(MenuOption::TestPing)) {
|
||||||
_geoStatsWidth += (int) extraSpace / 4;
|
_pingStatsWidth += (int) extraSpace / panels;
|
||||||
|
}
|
||||||
|
_geoStatsWidth += (int) extraSpace / panels;
|
||||||
_voxelStatsWidth += glWidget->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
_voxelStatsWidth += glWidget->width() - (_generalStatsWidth + _pingStatsWidth + _geoStatsWidth + 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,6 +170,11 @@ void Stats::display(
|
||||||
QLocale locale(QLocale::English);
|
QLocale locale(QLocale::English);
|
||||||
std::stringstream voxelStats;
|
std::stringstream voxelStats;
|
||||||
|
|
||||||
|
if (_lastHorizontalOffset != horizontalOffset) {
|
||||||
|
resetWidth(glWidget->width(), horizontalOffset);
|
||||||
|
_lastHorizontalOffset = horizontalOffset;
|
||||||
|
}
|
||||||
|
|
||||||
glPointSize(1.0f);
|
glPointSize(1.0f);
|
||||||
|
|
||||||
// we need to take one avatar out so we don't include ourselves
|
// we need to take one avatar out so we don't include ourselves
|
||||||
|
@ -307,7 +325,7 @@ void Stats::display(
|
||||||
|
|
||||||
VoxelSystem* voxels = Application::getInstance()->getVoxels();
|
VoxelSystem* voxels = Application::getInstance()->getVoxels();
|
||||||
|
|
||||||
lines = _expanded ? 11 : 3;
|
lines = _expanded ? 12 : 3;
|
||||||
drawBackground(backgroundColor, horizontalOffset, 0, glWidget->width() - horizontalOffset, lines * STATS_PELS_PER_LINE + 10);
|
drawBackground(backgroundColor, horizontalOffset, 0, glWidget->width() - horizontalOffset, lines * STATS_PELS_PER_LINE + 10);
|
||||||
horizontalOffset += 5;
|
horizontalOffset += 5;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
// Stats.h
|
// Stats.h
|
||||||
// interface
|
// interface
|
||||||
//
|
//
|
||||||
|
// Created by Lucas Crisman on 22/03/14.
|
||||||
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
// Copyright (c) 2013 High Fidelity, Inc. All rights reserved.
|
||||||
//
|
//
|
||||||
|
|
||||||
|
@ -9,8 +10,6 @@
|
||||||
|
|
||||||
#include <NodeList.h>
|
#include <NodeList.h>
|
||||||
|
|
||||||
//#include "Menu.h"
|
|
||||||
|
|
||||||
class Stats: public QObject {
|
class Stats: public QObject {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
|
@ -23,7 +22,7 @@ public:
|
||||||
|
|
||||||
void toggleExpanded();
|
void toggleExpanded();
|
||||||
void checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset);
|
void checkClick(int mouseX, int mouseY, int mouseDragStartedX, int mouseDragStartedY, int horizontalOffset);
|
||||||
void resetWidthOnResizeGL(int width);
|
void resetWidth(int width, int horizontalOffset);
|
||||||
void display(const float* color, int horizontalOffset, float fps, int packetsPerSecond, int bytesPerSecond, int voxelPacketsToProcess);
|
void display(const float* color, int horizontalOffset, float fps, int packetsPerSecond, int bytesPerSecond, int voxelPacketsToProcess);
|
||||||
private:
|
private:
|
||||||
static Stats* _sharedInstance;
|
static Stats* _sharedInstance;
|
||||||
|
@ -37,4 +36,6 @@ private:
|
||||||
int _pingStatsWidth;
|
int _pingStatsWidth;
|
||||||
int _geoStatsWidth;
|
int _geoStatsWidth;
|
||||||
int _voxelStatsWidth;
|
int _voxelStatsWidth;
|
||||||
|
|
||||||
|
int _lastHorizontalOffset;
|
||||||
};
|
};
|
Loading…
Reference in a new issue