Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font fix #69

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ void GameplayDynamicScene::drawScore(sf::RenderWindow &window, unsigned int valu
sf::Font font = TextureManager::getFont();
text.setFont(font);
text.setString("Score: " + std::to_string(value));
text.setCharacterSize(24);
text.setCharacterSize(20);
text.setFillColor(sf::Color::White);
text.setPosition(SCENE_WIDTH - 120, 0); // top right corner
text.setPosition(SCENE_WIDTH - 160, 0); // top right corner
window.draw(text);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ const sf::Texture* TextureManager::getTexture(GameTextureID id) const {

sf::Font TextureManager::getFont() {
sf::Font font;
if (!font.loadFromFile("resources/pixelLetters.ttf")) {
if (!font.loadFromFile("resources/JetBrainsMono-Light.ttf")) {
std::cerr << "Could not load font\n";
}
return font;
Expand Down
27 changes: 14 additions & 13 deletions include/constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ const float MAX_PLAYER_NAME_LENGTH = 16.0f;

const float MAX_LINES = 10.0f;

const unsigned int HEADER_FONT_SIZE = 40;
const float HEADER_X = 300.0f;
const unsigned int HEADER_FONT_SIZE = 36;
const float HEADER_X = 280.0f;
const float HEADER_Y = 40.0f;

const unsigned int LEADERBOARD_FONT_SIZE = 26;
const float POS_HEADER_X = 108.0f;
const float POS_HEADER_Y = HEADER_Y + 61.0f;
const float NAME_HEADER_X = 330.0f;
const float NAME_HEADER_Y = HEADER_Y + 61.0f;
const float SCORE_HEADER_X = 593.0f;
const float SCORE_HEADER_Y = HEADER_Y + 61.0f;
const unsigned int LEADERBOARD_FONT_SIZE = 22;
const float POS_HEADER_X = 106.0f;
const float POS_HEADER_Y = HEADER_Y + 65.0f;
const float NAME_HEADER_X = 320.0f;
const float NAME_HEADER_Y = HEADER_Y + 65.0f;
const float SCORE_HEADER_X = 592.0f;
const float SCORE_HEADER_Y = HEADER_Y + 65.0f;

const float PADDING = 8.0f;
const float PADDING = 8.5f;
const float LEADERBOARD_WIDTH = 600.0f;
const float ROW_HEIGHT = LEADERBOARD_FONT_SIZE + PADDING * 2.0f;
const float LEADERBOARD_X = SCENE_WIDTH / 2.0f - LEADERBOARD_WIDTH / 2.0f;
Expand All @@ -62,9 +62,10 @@ const float ONE_DIGIT_POS_OFFSET = 14.0f;
const float TWO_DIGIT_POS_OFFSET = 19.0f;
const float NAME_X_OFFSET = 60.0f;
const float ONE_DIGIT_SCORE_OFFSET = 520.0f;
const float FOUR_DIGIT_SCORE_OFFSET = 505.0f;
const float FIVE_DIGIT_SCORE_OFFSET = 500.0f;
const float SCORE_X_OFFSET_DIFF = 9.0f;
const float FOUR_DIGIT_SCORE_OFFSET = ONE_DIGIT_SCORE_OFFSET - SCORE_X_OFFSET_DIFF * 2;
const float FIVE_DIGIT_SCORE_OFFSET = ONE_DIGIT_SCORE_OFFSET - SCORE_X_OFFSET_DIFF * 3;

const float BORDER_OFFSET = 3.0f;
const float BORDER_OFFSET = 6.0f;

#endif // CPPBASICS_CONSTANTS_HPP
Binary file added resources/JetBrainsMono-Light.ttf
Binary file not shown.
Binary file removed resources/pixelLetters.ttf
Binary file not shown.