Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - gmestanley

Pages: [1]
1
SFML website / Link to the Ruby binding does not work
« on: July 10, 2020, 04:37:17 am »
On the Bindings page of the official website, the Ruby section links to this site, which is broken.
I managed to find a working version of the blog on the Wayback Machine, and grabbed a link for download of the Ruby binding that does work: https://github.com/Groogy/rbSFML

2
Oh...now I understand what I have to do.

3
I'd say it is more or less a serious question. Because to be honest, I have never heard about it. I had to google. Also, it is not bugged. From the errors, it seems you are not using a C++11 Compiler or you may have just forgotten to set up the C++11 flag. And from the readme, it is written that you must have a C++11 compiler. Did you forget that part?
Hmmm, that would be nearly impossible. Because the MinGW version I have here is the most recent.
Also, I've only saw now that there is a forum for Tiled, so when I discover why the C++11 error is appearing even though I have the most recent MinGW, please someone lock this topic.

4
And STP is...?
I wonder if you're actually questioning what it is or this question is ironic and you made it because the topic shows what is STP twice.

5
As I've described in my first topic, I'm making a game using the original SFML, and to create maps for my game I'm using Tiled (if you don't know what it is, it's a program where you can build maps and save then as files). And to pass these maps to a SFML window, I need a Tiled map parser. I was using STP, until the point I tried compiling my game and MinGW gave me this extensive error log:
In file included from c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\unordered_map:35:0,
                 from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:36,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
c:\mingw\lib\gcc\mingw32\5.3.0\include\c++\bits\c++0x_warning.h:32:2: error: #error This file requires compiler and library support for the ISO C++ 2011 standard. This support is currently experimental, and must be enabled with the -std=c++11 or -std=gnu++11 compiler options.
 #error This file requires compiler and library support for the \
  ^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:39:0,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Properties.hpp:73:10: error: 'unordered_map' in namespace 'std' does not name a template type
     std::unordered_map<std::string, std::string> properties_;
          ^
In file included from D:\Desktop\STP-master\include/STP/Core/TileSet.hpp:40:0,
                 from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:40,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Image.hpp:66:11: error: 'int32_t' has not been declared
           int32_t trans = -1, const std::string& format = std::string());
           ^
D:\Desktop\STP-master\include/STP/Core/Image.hpp:95:5: error: 'int32_t' does not name a type
     int32_t trans_;
     ^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:40:0,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/TileSet.hpp:77:69: warning: extended initializer lists only available with -std=c++11 or -std=gnu++11
             unsigned int margin = 0, sf::Vector2i tileoffset = {0, 0});
                                                                     ^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:41:0,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/Layer.hpp:131:80: error: 'nullptr' was not declared in this scope
  void AddTile(unsigned int gid, sf::IntRect tile_rect, tmx::TileSet* tileset = nullptr);
                                                                                ^
D:\Desktop\STP-master\include/STP/Core/Layer.hpp:161:31: error: 'nullptr' was not declared in this scope
       tmx::TileSet* tileset = nullptr);
                               ^
In file included from D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:42:0,
                 from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/ObjectGroup.hpp:76:46: error: 'int32_t' has not been declared
                 float opacity, bool visible, int32_t hexcolor = -1);
                                              ^
D:\Desktop\STP-master\include/STP/Core/ObjectGroup.hpp:141:39: error: 'nullptr' was not declared in this scope
            tmx::TileSet::Tile* tile = nullptr);
                                       ^
In file included from D:\Desktop\STP-master\include/STP/TMXLoader.hpp:30:0,
                 from game.cpp:4:
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:62:37: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
     TileMap(const TileMap& other) = delete;
                                     ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:63:43: warning: defaulted and deleted functions only available with -std=c++11 or -std=gnu++11
     TileMap& operator =(const TileMap&) = delete;
                                           ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:182:10: error: 'unordered_map' in namespace 'std' does not name a template type
     std::unordered_map<std::string, tmx::Layer*> layers_;
          ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:183:10: error: 'unordered_map' in namespace 'std' does not name a template type
     std::unordered_map<std::string, tmx::ObjectGroup*> object_groups_;
          ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:184:10: error: 'unordered_map' in namespace 'std' does not name a template type
     std::unordered_map<std::string, tmx::ImageLayer*> image_layers_;
          ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:17: error: 'unique_ptr' is not a member of 'std'
     std::vector<std::unique_ptr<tmx::MapObject>> map_objects_;
                 ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:17: error: 'unique_ptr' is not a member of 'std'
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: 'map_objects_' was not declared in this scope
     std::vector<std::unique_ptr<tmx::MapObject>> map_objects_;
                                                  ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: template argument 1 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:185:50: error: template argument 2 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:187:10: error: 'unordered_map' in namespace 'std' does not name a template type
     std::unordered_map<std::string, tmx::TileSet*> tilesets_hash_;
          ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:17: error: 'unique_ptr' is not a member of 'std'
     std::vector<std::unique_ptr<tmx::TileSet>> tilesets_;
                 ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:17: error: 'unique_ptr' is not a member of 'std'
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: 'tilesets_' was not declared in this scope
     std::vector<std::unique_ptr<tmx::TileSet>> tilesets_;
                                                ^
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: template argument 1 is invalid
D:\Desktop\STP-master\include/STP/Core/TileMap.hpp:188:48: error: template argument 2 is invalid

D:\Desktop\Elkiria>

My game's source code is the following:
// game.cpp - the main file
#include <Windows.h>
#include <SFML/Graphics.hpp>
#include <STP/TMXLoader.hpp>

int main()
{
    // Setting up window and resources
    sf::RenderWindow screen(sf::VideoMode(640, 480), "Elkiria");
    sf::Texture tex_titlebg;
    tex_titlebg.loadFromFile("bg_title.jpg");
    sf::Sprite spr_titlebg;
    spr_titlebg.setTexture(tex_titlebg);
    sf::Texture tex_tcursor;
    tex_tcursor.loadFromFile("spr_cursor.png");
    sf::Sprite spr_tcursor;
    spr_tcursor.setTexture(tex_tcursor);

    sf::Font fon_comicsans;
    fon_comicsans.loadFromFile("comic.ttf");
    sf::Text txt_tnewgame;
    txt_tnewgame.setFont(fon_comicsans);
    txt_tnewgame.setString("New Game");
    sf::Text txt_tcontinue;
    txt_tcontinue.setFont(fon_comicsans);
    txt_tcontinue.setString("Continue");
    sf::Text txt_texit;
    txt_texit.setFont(fon_comicsans);
    txt_texit.setString("Exit");

    int cursor = 0;
    int map;
    bool game_started = false;

    // While window is open, do stuff
    while (screen.isOpen())
    {
        // Operations with events
        sf::Event event;
        while (screen.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                screen.close();
            }
            if (event.type == sf::Event::KeyPressed) {
                if (event.key.code == sf::Keyboard::Up) {
                    if (cursor == 0) {
                        break;
                    }
                    else {
                        cursor -= 1;
                    }
                }
                if (event.key.code == sf::Keyboard::Down) {
                    if (cursor == 2) {
                        break;
                    }
                    else {
                        cursor += 1;
                    }
                }
                if (event.key.code == sf::Keyboard::Z || event.key.code == sf::Keyboard::Return) {
                    if (cursor == 0) {
                        game_started = true;
                        map = 1;
                    }
                    else if (cursor == 1) {

                    }
                    else if (cursor == 2) {
                        ExitProcess(0);
                    }
                }
            }
        }

        // Operations with the window
        screen.clear(sf::Color::Black);
        screen.draw(spr_titlebg);
        screen.draw(txt_tnewgame);
        txt_tnewgame.setPosition(240, 300);
        screen.draw(txt_tcontinue);
        txt_tcontinue.setPosition(240, 340);
        screen.draw(txt_texit);
        txt_texit.setPosition(240, 380);
        screen.draw(spr_tcursor);
        screen.display();

        // If the game has started, the first map is drawn.
        if (game_started == true) {
            if (map == 1) {
                screen.clear(sf::Color::Black);
                tmx::TileMap map1("map1.tmx");
                map1.ShowObjects();
                screen.draw(map1);
                screen.display();
            }
        }

        // If not, the title screen remains and the arrow keys move the cursor.
        else if (game_started == false) {
            switch (cursor) {
            case 0:
                spr_tcursor.setPosition(200, 300);
                break;
            case 1:
                spr_tcursor.setPosition(200, 340);
                break;
            case 2:
                spr_tcursor.setPosition(200, 380);
                break;
            }
        }
    }

    // Source code ends here.
    return 0;
}

I even have put the SFML include and lib folders into STP's extlibs folder:


What am I doing wrong? Please, someone help me.

6
Graphics / Re: Problem with the draw & display methods
« on: February 05, 2017, 01:47:20 am »
you only need call clear() and display() once with all your drawing in between (from back to front).

screen.clear();
screen.draw(sp_titlebg);
screen.draw(sp_sfml);
screen.display();
 
Actually, what I want to do is display only the sfml logo and after 3 seconds, display the background, not one behind another.
Don't know if this is any help. Or if it even matters. But you haven't declared anything for your sprite? Position, size, etc.
Well you can declare a sprite without properties, but it'll be on the top of the screen.

7
Graphics / Problem with the draw & display methods
« on: February 04, 2017, 07:04:54 pm »
I'm making a game on C++ using SFML 2.4.1 for GCC SJLJ (CodeBlocks with MinGW). When it starts, I want my game to draw the SFML logo (like a splash screen) and, after 3 seconds, draw the title screen's background. Sounds simple, but after displaying the background, after a time it displays the SFML logo again, thus making a loop rather than making the image static. Could you guys help me? This is my code:
#include <Windows.h>
#include <SFML/Graphics.hpp>

int main()
{
    // Setting up resources and the window
    sf::RenderWindow screen(sf::VideoMode(816, 624), "Elkiria");
    sf::Texture tx_sfml;
    tx_sfml.loadFromFile("sfml.png");
    sf::Sprite sp_sfml;
    sp_sfml.setTexture(tx_sfml);
    sf::Texture tx_titlebg;
    tx_titlebg.loadFromFile("skybg.png");
    sf::Sprite sp_titlebg;
    sp_titlebg.setTexture(tx_titlebg);

    // While the window is opened, do stuff.
    while (screen.isOpen())
    {
        // Create game's event and event's types
        sf::Event main_ev;
        while (screen.pollEvent(main_ev))
        {
            if (main_ev.type == sf::Event::Closed) {
                screen.close();
            }
        }

        // Operate with the window
        screen.clear();
        screen.draw(sp_sfml);
        screen.display();
        Sleep(3000);
        screen.draw(sp_titlebg);
        screen.display();
    }

    return 0;
}
 

Pages: [1]