Add loading skin directly from png file
This commit is contained in:
parent
1220e2d70f
commit
d217b13c53
9 changed files with 83 additions and 10 deletions
|
@ -1,4 +1,5 @@
|
|||
#include <SFML/Graphics/Color.hpp>
|
||||
#include <SFML/Graphics/Image.hpp>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
@ -8,6 +9,7 @@
|
|||
namespace skin{
|
||||
|
||||
std::vector<sf::Color> loadSkin(std::string skinName);
|
||||
std::vector<sf::Color> loadShader(std::string skinName);
|
||||
|
||||
std::vector<std::string> removeComments(std::vector<std::string> linesVector);
|
||||
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
|
||||
|
||||
std::vector<sf::Color> skin::loadSkin(std::string skinName){
|
||||
std::vector<sf::Color> skin::loadShader(std::string skinName){
|
||||
|
||||
std::vector<sf::Color> skinLoaded;
|
||||
|
||||
|
@ -116,3 +116,52 @@ std::vector<int> skin::extractRGBA(std::string line){
|
|||
return rgba;
|
||||
|
||||
}
|
||||
std::vector<sf::Color> skin::loadSkin(std::string skinName){
|
||||
sf::Image game;
|
||||
game.loadFromFile("bin/skin/"+skinName+"/game.png");
|
||||
|
||||
std::vector<sf::Color> skin;
|
||||
|
||||
|
||||
|
||||
//Background
|
||||
skin.push_back(game.getPixel(0,0)); //Background MainWindow
|
||||
skin.push_back(game.getPixel(76,243)); //Background cells
|
||||
skin.push_back(game.getPixel(61,227)); //Background grid color
|
||||
skin.push_back(game.getPixel(326,58)); //Score bg
|
||||
skin.push_back(game.getPixel(441,58)); //Best score bg
|
||||
skin.push_back(sf::Color(143,122,102)); //Button bg
|
||||
skin.push_back(sf::Color(238,228,218,186)); //Game over color bg
|
||||
|
||||
//Font
|
||||
skin.push_back(game.getPixel(65,105)); //Title font color
|
||||
skin.push_back(game.getPixel(348,78)); //Score title fontcolor
|
||||
skin.push_back(game.getPixel(468,77)); //Best score title font color
|
||||
skin.push_back(game.getPixel(400,96)); //Score font color
|
||||
skin.push_back(game.getPixel(484,97)); //Best score font color
|
||||
skin.push_back(game.getPixel(128,660)); //2 and 4 font color
|
||||
skin.push_back(game.getPixel(359,661)); //other number font Color
|
||||
skin.push_back(sf::Color(143,122,102)); //game over font
|
||||
|
||||
//Skin 2 et le 4
|
||||
skin.push_back(game.getPixel(70,597)); //2
|
||||
skin.push_back(game.getPixel(190,597)); //4
|
||||
|
||||
//Skin 8 à 64
|
||||
skin.push_back(game.getPixel(311,597)); //8
|
||||
skin.push_back(game.getPixel(431,597)); //16
|
||||
skin.push_back(game.getPixel(71,477)); //32
|
||||
skin.push_back(game.getPixel(191,477)); //64
|
||||
|
||||
//Skin 128 à 2048
|
||||
skin.push_back(game.getPixel(312,477)); //128
|
||||
skin.push_back(game.getPixel(431,477)); //256
|
||||
skin.push_back(game.getPixel(71,358)); //512
|
||||
skin.push_back(game.getPixel(191,358)); //1024
|
||||
skin.push_back(game.getPixel(311,358)); //2048
|
||||
|
||||
//Skin for other number
|
||||
skin.push_back(game.getPixel(432,358)); //More than 2048
|
||||
|
||||
return skin;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue