Commit 19b99d92 authored by Corentin Bocquillon's avatar Corentin Bocquillon
Browse files

Merge branch 'experimental'

parents 60af11fb caa30e11
FROM archlinux/base
RUN pacman --noconfirm -Syu
RUN pacman --noconfirm -S base-devel libxml2 protobuf guile jsoncpp libnoise sfml meson
pipeline
{
agent
{
dockerfile
{
filename 'Dockerfile.build'
}
}
stages
{
stage ('Build')
{
steps
{
sh './generate_protobuf.sh'
sh 'meson build'
sh 'ninja -C build'
}
}
}
}
File mode changed from 100644 to 100755
media/textures/pierre1.png

53 KB | W: | H:

media/textures/pierre1.png

3.11 KB | W: | H:

media/textures/pierre1.png
media/textures/pierre1.png
media/textures/pierre1.png
media/textures/pierre1.png
  • 2-up
  • Swipe
  • Onion skin
media/textures/pierre2.png

54.2 KB | W: | H:

media/textures/pierre2.png

3.68 KB | W: | H:

media/textures/pierre2.png
media/textures/pierre2.png
media/textures/pierre2.png
media/textures/pierre2.png
  • 2-up
  • Swipe
  • Onion skin
media/textures/pierre3.png

53.9 KB | W: | H:

media/textures/pierre3.png

4.12 KB | W: | H:

media/textures/pierre3.png
media/textures/pierre3.png
media/textures/pierre3.png
media/textures/pierre3.png
  • 2-up
  • Swipe
  • Onion skin
......@@ -2,21 +2,22 @@ project('Factorywars', 'cpp', license: 'GPLv3+', version: '0.1',
default_options : ['cpp_std=c++11'])
compilateur = meson.get_compiler('cpp')
en_tetes = [include_directories('src'), include_directories('src/sdl')]
en_tetes = [include_directories('src'), include_directories('src/sfml')]
sources = ['src/main.cpp', 'src/items.cpp', 'src/config.cpp',
'src/items.cpp', 'src/save.cpp', 'src/tile.pb.cc', 'src/player.cpp',
'src/player-data.pb.cc', 'src/utils.cpp', 'src/XMLParser.cpp',
'src/sdl/display_map.cpp', 'src/sdl/game.cpp',
'src/sdl/game_events.cpp', 'src/sdl/gui_utils.cpp',
'src/sdl/gui_utils.h', 'src/sdl/menu.cpp', 'src/sdl/keyboard.cpp',
'src/sdl/mouse.cpp', 'src/sdl/FPSCounter.cpp',
'src/sdl/Interface.cpp', 'src/sdl/ground.cpp',
'src/MapGenerator.cpp', 'src/sdl/map.cpp', 'src/structures.hpp']
'src/sfml/display_map.cpp', 'src/sfml/game.cpp',
'src/sfml/game_events.cpp', 'src/sfml/gui_utils.cpp',
'src/sfml/gui_utils.h', 'src/sfml/menu.cpp', 'src/sfml/keyboard.cpp',
'src/sfml/mouse.cpp', 'src/sfml/FPSCounter.cpp',
'src/sfml/Interface.cpp', 'src/sfml/ground.cpp',
'src/MapGenerator.cpp', 'src/sfml/map.cpp', 'src/structures.hpp',
'src/sfml/inventory_interface.cpp']
libxml2 = dependency('libxml-2.0')
protobuf = dependency('protobuf')
guile = dependency('guile-2.0')
guile = dependency('guile-2.2')
json = dependency('jsoncpp')
noise = compilateur.find_library('noise')
if compilateur.has_header('libnoise/noise.h')
......
#include <iostream>
#include <SFML/Graphics.hpp>
using namespace std;
using namespace sf;
int
main (void)
{
cout << "Génération de l’image de l’inventaire…" << flush;
const int taille_case = 32;
const int espace_entre_case = 2;
const int espace_haut = 48;
const int espace_bas = 48;
const int espace_lateral = 10;
const int nb_case_lateral = 10;
const int nb_case_hauteur = 10;
Image fond;
int width = taille_case * nb_case_lateral;
width += espace_entre_case * (nb_case_lateral - 1);
width += espace_lateral * 2;
int height = taille_case * nb_case_hauteur;
height += espace_entre_case * (nb_case_hauteur - 1);
height += espace_haut + espace_bas;
fond.create (width, height, Color (59, 59, 59));
Image casei;
casei.create (taille_case, taille_case, Color::White);
for (unsigned i = 0; i < nb_case_lateral; ++i)
{
for (unsigned j = 0; j < nb_case_hauteur; ++j)
{
const int x = espace_lateral + i * taille_case + i * espace_entre_case;
const int y = espace_haut + j * taille_case + j * espace_entre_case;
fond.copy (casei, x, y);
}
}
fond.saveToFile ("inventaire.png");
cout << " Terminé !" << endl;
}
......@@ -38,27 +38,27 @@ ItemsName::ItemsName ()
{
string m_items_name[13] = {"Player",
// Ores
"Iron ore",
"Copper ore",
"Coal ore",
"Stone ore",
// Plates
"Iron plate",
"Copper plate",
// Inserters
"Burner inserter",
"Inserter",
"Fast inserter",
// Assembling machines
"Assembling machine",
// Other
"Wood",
"Stone block"};
// Ores
"Iron ore",
"Copper ore",
"Coal ore",
"Stone ore",
// Plates
"Iron plate",
"Copper plate",
// Inserters
"Burner inserter",
"Inserter",
"Fast inserter",
// Assembling machines
"Assembling machine",
// Other
"Wood",
"Stone block"};
for (int i = 0; sizeof (m_items_name) / sizeof (m_items_name[0]); i++)
{
m_items_map[i] = m_items_name[i];
......@@ -71,54 +71,54 @@ ItemsName::getItemName(int id)
return m_items_map[id];
}
std::map<int, sf::Texture> ItemsTexture::m_items_textures_map;
ItemsTexture::ItemsTexture ()
{
if (m_items_textures_map.size () == 0)
load_textures ();
}
ItemsTexture::~ItemsTexture ()
{
}
sf::Texture&
ItemsTexture::get_item_texture (int item_id)
{
return m_items_textures_map[item_id];
}
void
ItemsTexture::load_textures ()
{
string prefix;
if (!RUN_IN_PLACE)
prefix = string (TEXTURESDIR) + "/";
else
prefix = "../media/textures/";
vector<string> m_items_textures_path;
m_items_textures_path.push_back (prefix + "arbre2.png");
m_items_textures_path.push_back (prefix + "cuivre1.png");
m_items_textures_path.push_back (prefix + "cuivre2.png");
m_items_textures_path.push_back (prefix + "cuivre3.png");
m_items_textures_path.push_back (prefix + "fer1.png");
m_items_textures_path.push_back (prefix + "fer2.png");
m_items_textures_path.push_back (prefix + "fer3.png");
m_items_textures_path.push_back (prefix + "charbon1.png");
m_items_textures_path.push_back (prefix + "charbon2.png");
m_items_textures_path.push_back (prefix + "charbon3.png");
for (unsigned i = 1; i < m_items_textures_path.size () + 1; ++i)
{
if (!m_items_textures_map[i].loadFromFile (m_items_textures_path[i-1]))
throw runtime_error (m_items_textures_path[i] + string (" ")
+ " does not exist");
}
}
// std::map<int, sf::Texture> ItemsTexture::m_items_textures_map;
// ItemsTexture::ItemsTexture ()
// {
// if (m_items_textures_map.size () == 0)
// load_textures ();
// }
// ItemsTexture::~ItemsTexture ()
// {
// }
// sf::Texture&
// ItemsTexture::get_item_texture (int item_id)
// {
// return m_items_textures_map[item_id];
// }
// void
// ItemsTexture::load_textures ()
// {
// string prefix;
// if (!RUN_IN_PLACE)
// prefix = string (TEXTURESDIR) + "/";
// else
// prefix = "../media/textures/";
// vector<string> m_items_textures_path;
// m_items_textures_path.push_back (prefix + "arbre2.png");
// m_items_textures_path.push_back (prefix + "cuivre1.png");
// m_items_textures_path.push_back (prefix + "cuivre2.png");
// m_items_textures_path.push_back (prefix + "cuivre3.png");
// m_items_textures_path.push_back (prefix + "fer1.png");
// m_items_textures_path.push_back (prefix + "fer2.png");
// m_items_textures_path.push_back (prefix + "fer3.png");
// m_items_textures_path.push_back (prefix + "charbon1.png");
// m_items_textures_path.push_back (prefix + "charbon2.png");
// m_items_textures_path.push_back (prefix + "charbon3.png");
// for (unsigned i = 1; i < m_items_textures_path.size () + 1; ++i)
// {
// if (!m_items_textures_map[i].loadFromFile (m_items_textures_path[i-1]))
// throw runtime_error (m_items_textures_path[i] + string (" ")
// + " does not exist");
// }
// }
Machines::Machines()
......
......@@ -6,7 +6,7 @@
*
* @section LICENSE
*
* Copyright (C) 2016 Corentin Bocquillon <0x539@nybble.fr>
* Copyright (C) 2016-2018 Corentin Bocquillon <0x539@nybble.fr>
* Copyright (C) 2016 Loup Fourment
* Copyright (C) 2016 Pierre Gillet <pierre.gillet+factorywars@linuxw.info>
*
......@@ -49,17 +49,27 @@ ItemsName
};
class ItemsTexture
// class ItemsTexture
// {
// public:
// ItemsTexture ();
// ~ItemsTexture ();
// sf::Texture& get_item_texture (int item_id);
// private:
// static std::map<int, sf::Texture> m_items_textures_map;
// void load_textures ();
// };
class Item
{
public:
ItemsTexture ();
~ItemsTexture ();
sf::Texture& get_item_texture (int item_id);
int get_id ();
private:
static std::map<int, sf::Texture> m_items_textures_map;
void load_textures ();
int m_id;
};
......
......@@ -33,7 +33,7 @@
#include <getopt.h>
#include <clocale>
#include "sdl/game.h"
#include "sfml/game.h"
#include "gettext.h"
#define _(string) gettext (string)
......@@ -76,11 +76,7 @@ main (int argc, char *argv[])
print_help ();
exit (EXIT_SUCCESS);
break;
// L’option pour spécifier l’IP du serveur auquel on veut se
// connecter.
// case 's':
// IP = optarg;
// break;
case 'v':
print_version ();
exit(EXIT_SUCCESS);
......@@ -98,12 +94,11 @@ main (int argc, char *argv[])
exit (EXIT_FAILURE);
}
if (run_gui () != 0)
{
return 1;
}
return 0;
int r = run_gui ();
if (r != 0)
return 1;
else
return 0;
}
static void
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment