Skip to content

Commit 79f2f8d

Browse files
committed
Glorious 720p
1 parent 8844ea3 commit 79f2f8d

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

resources/graphics.conf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ font.path=resources/ComicNeue-Bold.ttf
33
font.size=50
44

55
# General window settings
6-
screen.width=900
7-
screen.height=800
6+
screen.width=1280
7+
screen.height=720
88

99
# Trading view screen coordinates
1010
screen.tradingView.bottomLeft=(0.1,0.1)

src/Renderer.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,10 +145,11 @@ pair<float, float> coordToScreen(const Coordinate& coord) {
145145
using std::sin;
146146
using std::cos;
147147
// TODO not magic numbers
148-
static const float scale = 0.1f;
148+
static const float xscale = 9.f / 16.f / 7.f;
149+
static const float yscale = 0.1f;
149150
static const float angle = M_PI / 3.f;
150-
float x = .25f + (scale * coord.first) + ((scale * coord.second) * cos(angle));
151-
float y = .1f + (scale * coord.second) * sin(angle);
151+
float x = .25f + (xscale * coord.first) + ((yscale * coord.second) * cos(angle));
152+
float y = .1f + (yscale * coord.second) * sin(angle);
152153
return std::make_pair(x, y);
153154
}
154155

@@ -158,12 +159,13 @@ pair<float, float> coordToScreen(const Coordinate& coord) {
158159
* @return The game coordinate.
159160
*/
160161
Coordinate screenToCoord(const pair<float, float>& screen) {
161-
static const float scale = 0.1;
162+
static const float xscale = 9.f / 16.f / 7.f;
163+
static const float yscale = 0.1f;
162164
static const float angle = M_PI / 3.f;
163165
Coordinate ret;
164-
float y_approx = (screen.second - 0.1f) / std::sin(angle) / scale;
166+
float y_approx = (screen.second - 0.1f) / std::sin(angle) / yscale;
165167
ret.second = std::round(y_approx);
166-
ret.first = std::round((screen.first - 0.2f) / scale - y_approx * std::cos(angle) - 0.5);
168+
ret.first = std::round((screen.first - 0.25f - y_approx * yscale * std::cos(angle)) / xscale);
167169
return ret;
168170
}
169171

0 commit comments

Comments
 (0)