Created
February 5, 2023 23:21
-
-
Save bluszcz/664f134354e2bce5cba346aee4edecc9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/boardelem.cpp b/src/boardelem.cpp | |
index 59d9cbd..a86f11f 100644 | |
--- a/src/boardelem.cpp | |
+++ b/src/boardelem.cpp | |
@@ -9,7 +9,7 @@ sf::RectangleShape createNeighbour(int pos) { | |
rectangle.setFillColor(sf::Color(240, 240, 240,98)); | |
rectangle.setOutlineColor(sf::Color(24,24,24, 90)); | |
- rectangle.setPosition(cords.x*DP::TILE_SIZE, cords.y*DP::TILE_SIZE); | |
+ rectangle.setPosition((float)cords.x*DP::TILE_SIZE, (float)cords.y*DP::TILE_SIZE); | |
return rectangle; | |
@@ -23,7 +23,7 @@ DP::BoardElem::BoardElem(int pos, int type) | |
sf::Vector2i cords = DP::transPosition(pos); | |
int y_type = (int) type / DP::TILE_BOARD_SIZE; | |
int x_type = type % DP::TILE_BOARD_SIZE; | |
- setPosition(cords.x*DP::TILE_SIZE,cords.y*DP::TILE_SIZE); | |
+ setPosition((float)cords.x*DP::TILE_SIZE, (float)cords.y*DP::TILE_SIZE); | |
setTextureRect(sf::IntRect(x_type*DP::TILE_SIZE, y_type*DP::TILE_SIZE, DP::TILE_SIZE, DP::TILE_SIZE)); | |
textureTiles = nullptr; | |
} | |
diff --git a/src/cardsdeck.cpp b/src/cardsdeck.cpp | |
index e3ded5f..40bf0d8 100644 | |
--- a/src/cardsdeck.cpp | |
+++ b/src/cardsdeck.cpp | |
@@ -15,11 +15,11 @@ CardsDeck::CardsDeck(TextureHolder *textures, sf::Font *gameFont, Command *comma | |
for (int i=0;i<=3;i++) | |
{ | |
// spriteCardBases[i].setTexture(this->textures->textureCardBases[i]); | |
- spriteCardBases[i].setPosition(cardsPos[i][0],cardsPos[i][1]); | |
+ spriteCardBases[i].setPosition((float)cardsPos[i][0], (float)cardsPos[i][1]); | |
textPileTitle[i].setFont(*gameFont); | |
textPileTitle[i].setCharacterSize(16); | |
- textPileTitle[i].setPosition(cardsPos[i][0]+10,cardsPos[i][1]+100); | |
+ textPileTitle[i].setPosition((float)cardsPos[i][0]+10, (float)cardsPos[i][1]+100); | |
for (unsigned int j=0;j<DP::cardsDistribution.size();j++) | |
{ | |
diff --git a/src/cardslist.h b/src/cardslist.h | |
index f7ea38d..9061c8c 100644 | |
--- a/src/cardslist.h | |
+++ b/src/cardslist.h | |
@@ -19,7 +19,7 @@ namespace DP { | |
const static std::array<int,2> cardsDistributionDebug = {{ | |
2,3 | |
}}; | |
- const static int PILE_SIZE = DP::cardsDistribution.size(); | |
+ const static int PILE_SIZE = (int)DP::cardsDistribution.size(); | |
} | |
diff --git a/src/filetools.h b/src/filetools.h | |
index fccb9a3..866c70c 100644 | |
--- a/src/filetools.h | |
+++ b/src/filetools.h | |
@@ -1,13 +1,13 @@ | |
+#pragma warning( disable : 4996 ) | |
#ifndef FILETOOLS_H | |
#define FILETOOLS_H | |
#include <iostream> | |
#include <string> | |
- | |
static std::string get_full_path(std::string path) | |
{ | |
std::string new_path; | |
- if ( getenv ( "DP_DIR" ) != NULL ) | |
+ if ( getenv ( "DP_DIR" ) != NULL ) | |
{ | |
new_path = std::string(getenv("DP_DIR")) + path ; | |
return new_path; | |
diff --git a/src/game.cpp b/src/game.cpp | |
index 550dfef..ddff5f2 100644 | |
--- a/src/game.cpp | |
+++ b/src/game.cpp | |
@@ -261,8 +261,8 @@ void Game::loadAssets() | |
menuTxt.setFont(gameFont); | |
menuTxt.setCharacterSize(60); | |
menuTxt.setString(gameTitle); | |
- int width = menuTxt.getLocalBounds().width; | |
- int height = menuTxt.getLocalBounds().height; | |
+ int width = (int)menuTxt.getLocalBounds().width; | |
+ int height = (int)menuTxt.getLocalBounds().height; | |
menuTxt.setPosition(1050-(width/2),750-(height/2)-150); | |
menuTxt.setFillColor(sf::Color(255, 255, 255, 85)); | |
cardsDeck.setFonts(&gameFont); | |
@@ -406,13 +406,13 @@ void Game::handleLeftClick(sf::Vector2f pos,sf::Vector2f posFull, int mousePos) | |
for (int i=0;i<4;i++) | |
{ | |
sf::IntRect spriteHumanRect(players[i].spriteAI.getGlobalBounds()); | |
- if (spriteHumanRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1))) | |
+ if (spriteHumanRect.intersects(sf::IntRect((int)posFull.x, (int)posFull.y, 1, 1))) | |
{ | |
players[i].swapHuman(); | |
} | |
} | |
sf::IntRect startGameRect(580,640,180,80); | |
- if (startGameRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1))) | |
+ if (startGameRect.intersects(sf::IntRect((int)posFull.x, (int)posFull.y, 1, 1))) | |
{ | |
bigDiamondActive = true; | |
banner.setText("start game"); | |
@@ -425,7 +425,7 @@ void Game::handleLeftClick(sf::Vector2f pos,sf::Vector2f posFull, int mousePos) | |
{ | |
if (players[turn].human){ | |
sf::IntRect diceRect(roundDice.spriteDice.getGlobalBounds()); | |
- if (diceRect.intersects(sf::IntRect(posFull.x, posFull.y, 1, 1))) | |
+ if (diceRect.intersects(sf::IntRect((int)posFull.x, (int)posFull.y, 1, 1))) | |
{ | |
throwDiceMove(); | |
} | |
@@ -475,8 +475,8 @@ void Game::handleLeftClick(sf::Vector2f pos,sf::Vector2f posFull, int mousePos) | |
Game::Game(bool newTestMode): | |
screenSize(DP::initScreenX,DP::initScreenY), | |
- viewFull(sf::FloatRect(00, 00, screenSize.x, screenSize.y)), | |
- viewGui(sf::FloatRect(00, 00, screenSize.x, screenSize.y)), | |
+ viewFull(sf::FloatRect(00.f, 00.f, (float)screenSize.x, (float)screenSize.y)), | |
+ viewGui(sf::FloatRect(00.f, 00.f, (float)screenSize.x, (float)screenSize.y)), | |
viewTiles(sf::FloatRect(0, 0, 1360, 768)), | |
selector(DP::TILE_SIZE), | |
character(&textures, 3), | |
@@ -538,7 +538,7 @@ Game::Game(bool newTestMode): | |
showPlayerBoardElems = false; | |
//window.setVerticalSyncEnabled(true); | |
- std::srand (time(NULL)); | |
+ std::srand ((int)time(NULL)); | |
window.clear(sf::Color(55,55,55)); | |
renderTexture.draw(textLoading); | |
// window.display(); | |
@@ -555,7 +555,8 @@ Game::Game(bool newTestMode): | |
renderTexture.draw(textLoading); | |
window.display(); | |
- gameVersion.setString("version: " + std::string(DEERPORTAL_VERSION)+"-"+std::string(BASE_PATH)); | |
+ gameVersion.setString("version: " + std::string(DEERPORTAL_VERSION)+"-"+std::string(BASE_PATH)+" SFML version: " + | |
+ std::to_string(SFML_VERSION_MAJOR) + "." + std::to_string(SFML_VERSION_MINOR)+ "." + std::to_string(SFML_VERSION_PATCH) ); | |
gameVersion.setFont(gameFont); | |
gameVersion.setPosition(10,10); | |
gameVersion.setFillColor(sf::Color::White); | |
@@ -647,7 +648,7 @@ Game::Game(bool newTestMode): | |
if ((localPosition.x>=0) && (localPosition.y>=0) && (localPosition.x<=DP::BOARD_SIZE*DP::TILE_SIZE) && (localPosition.y<=DP::BOARD_SIZE*DP::TILE_SIZE)) | |
{ | |
- selector.setPosition((int) (localPosition.x / DP::TILE_SIZE)*DP::TILE_SIZE, ((int) localPosition.y / DP::TILE_SIZE)*DP::TILE_SIZE); | |
+ selector.setPosition((float) (localPosition.x / DP::TILE_SIZE)*(float)DP::TILE_SIZE, ((int) localPosition.y / DP::TILE_SIZE)*DP::TILE_SIZE); | |
} | |
/*! | |
diff --git a/src/game.h b/src/game.h | |
index c6cf892..4eaf915 100644 | |
--- a/src/game.h | |
+++ b/src/game.h | |
@@ -1,3 +1,7 @@ | |
+#define _CRT_SECURE_NO_WARNINGS 1 | |
+#pragma once | |
+#define _WINSOCK_DEPRECATED_NO_WARNINGS 1 | |
+ | |
#ifndef GAME_H | |
#define GAME_H | |
#include <stdlib.h> | |
diff --git a/src/main.cpp b/src/main.cpp | |
index 2d3bdca..72c91ba 100644 | |
--- a/src/main.cpp | |
+++ b/src/main.cpp | |
@@ -1,6 +1,7 @@ | |
#include <iostream> | |
#include "game.h" | |
+#define _CRT_SECURE_NO_WARNINGS | |
using namespace std; | |
diff --git a/src/particle.h b/src/particle.h | |
index 1b8f3fc..8fe8573 100644 | |
--- a/src/particle.h | |
+++ b/src/particle.h | |
@@ -55,7 +55,7 @@ public: | |
void setDissolutionRate( unsigned char rate ) { m_dissolutionRate = rate; } | |
void setShape( unsigned char shape ) { m_shape = shape; } | |
- int getNumberOfParticles() { return m_particles.size(); } | |
+ int getNumberOfParticles() { return (int)m_particles.size(); } | |
std::string getNumberOfParticlesString(); | |
sf::Sprite& getSprite() { return m_sprite; } | |
diff --git a/src/playerhud.cpp b/src/playerhud.cpp | |
index b98dfa1..81ced36 100644 | |
--- a/src/playerhud.cpp | |
+++ b/src/playerhud.cpp | |
@@ -123,7 +123,7 @@ Player::Player(TextureHolder *textures, sf::Font *gameFont, int playerNumber): | |
{posX1,posY1}}, {{posX2,posY1}},{{posX1,posY2}}, {{posX2, posY2} | |
}}}; | |
- txtCash.setPosition(textPos[playerNumber][0],textPos[playerNumber][1] ); | |
+ txtCash.setPosition((float)textPos[playerNumber][0], (float)textPos[playerNumber][1] ); | |
buttons.insert({"end_turn",rectangle}); | |
setSpriteAI(); | |
@@ -236,7 +236,7 @@ void Player::setSpriteAI() | |
} | |
}; | |
- sf::Vector2f spriteHumanPosNew(spriteHumanPos[number][0],spriteHumanPos[number][1]); | |
+ sf::Vector2f spriteHumanPosNew((float)spriteHumanPos[number][0], (float)spriteHumanPos[number][1]); | |
spriteAI.setPosition(spriteHumanPosNew); | |
} | |
diff --git a/src/selector.cpp b/src/selector.cpp | |
index 78ece82..0b94a21 100644 | |
--- a/src/selector.cpp | |
+++ b/src/selector.cpp | |
@@ -1,7 +1,7 @@ | |
#include "selector.h" | |
Selector::Selector(int squareSize) | |
- :rectangle(sf::Vector2f(squareSize-1, squareSize-1)) | |
+ :rectangle(sf::Vector2f((float)squareSize-1, (float)squareSize-1)) | |
{ | |
this->squareSize = squareSize; | |
rectangle.setFillColor(sf::Color(150, 250, 150,168)); | |
diff --git a/src/tilemap.cpp b/src/tilemap.cpp | |
index a20c391..93f0b88 100644 | |
--- a/src/tilemap.cpp | |
+++ b/src/tilemap.cpp | |
@@ -25,8 +25,8 @@ sf::Vector2i transTilePosition(int pos) { | |
* as the input. | |
*/ | |
sf::Vector2i getCords(sf::Vector2f position){ | |
- int x = position.x/DP::TILE_BOARD_SIZE; | |
- int y = position.y/DP::TILE_BOARD_SIZE; | |
+ int x = (int)position.x/DP::TILE_BOARD_SIZE; | |
+ int y = (int)position.y/DP::TILE_BOARD_SIZE; | |
return sf::Vector2i(x, y); | |
} | |
@@ -35,8 +35,8 @@ sf::Vector2i getCords(sf::Vector2f position){ | |
* as the input. | |
*/ | |
sf::Vector2f getScreenPos(sf::Vector2i cords){ | |
- float x = cords.x * DP::TILE_SIZE; | |
- float y = cords.y * DP::TILE_SIZE; | |
+ float x = (float)cords.x * DP::TILE_SIZE; | |
+ float y = (float)cords.y * DP::TILE_SIZE; | |
return sf::Vector2f(x, y); | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment