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 - BonBons

Pages: [1]
1
Hey there would just like to say that your book has really taught me how to program in C++ and I've recently made a littel portfolio which I used to apply to Universities. And I actually got accepted from the basis from what I've learned from your books so thank you so much for that!


2
Hello there! Thank you so much for this book it has been invaluable because I am teaching myself to program with C++and learning how to do it through a project like this has been great.

I must ask though how do you save a tiled map in the format that you do. Meaning this: http://imgur.com/YA9kw13

I can't seem to find any information on this at all. I am having some issues with trying to save a tile map in a certain way so that I can read it into my game.

Thank you!

3
Ah! Yeah it's fixed now. Not sure what happened to that project but it has been to the far corners of my computer and had to start another. Thanks all!

4
Hello there! I just wondering why I have to get the reference of a class when including certain SFML files within that class and not being able to directly copy it. For an example I have some code here:

#ifndef GAME_H
#define GAME_H

#include "Window.h"
class Game
{
public:
        Game();
        ~Game();

        void handleEvents();
        void update();
        void render();

        Window* getWindow() { return &m_window; }

private:
        bool m_isRunning;
        Window m_window;
};
#endif // !GAME_H

 


#ifndef WINDOW_H
#define WINDOW_H


#include <SFML\Graphics.hpp>
#include <string>
class Window
{
public:
        Window();
        ~Window();

        void activateFullScreen();
        void deactivateFullScreen();
        void setup(const std::string& title, sf::Vector2f& windowSize);
        void destroy() { m_window.close(); }

private:
        sf::RenderWindow m_window;
        sf::Vector2f m_windowSize;
        std::string m_title;
        bool m_fullScreen;

        void create(); //Create window

};
#endif // !WINDOW_H
 

My line of thinking was because the m_window is being stored in the Game class, in theory I should of just been able to get the Window without the need of referencing but it but when attempting that it says "Attempting to reference a deleted function."

Would love for some to explain why. Thank you!

5
Look at RenderWindow.h maybe somehow the sf::RenderWindow::create got renamed.

Not sure how to do that, sorry.

6
Can you post a complete and minimal code that reproduces the error ?

Hint: this could be a good starting point
#include <SFML/Graphics.hpp>

int main()
{
    sf::RenderWindow w;
    w.create({640, 480, 32}, "test");
    return 0;
}

I have the same issue as before. This is very odd.

7
Error   C2039   'create': is not a member of 'sf::RenderWindow'
This is the error after I have renamed the function name. This is so strange...

8
m_window.create({ m_windowSize.x, m_windowSize.y, 32 }, m_windowTitle, style);

Still not registering as a member of the class RenderWindow. Quite confused now..

9
Hello. I am just wondering why I cant access the create function of the RenderWindow class. I can access the Display and Clear functions so I am rather confused as to why this is.

#ifndef WINDOW_H
#define WINDOW_H

#include <string>
#include <SFML/Window.hpp>
#include <SFML/Graphics.hpp>
class Window
{
public:
        Window();
        Window(std::string& title, sf::Vector2u& windowSize);
        ~Window();

private:
        std::string m_title;
        sf::Vector2u m_windowSize;
        sf::RenderWindow m_window;
        bool m_fullScreen;
        bool m_isDone;

        void setup(const std::string& title, sf::Vector2u windowSize);
        void create();
};

#include "Window.h"


Window::Window()
{
        setup("My Window", sf::Vector2u(640, 480));
}

Window::Window(std::string & title, sf::Vector2u & windowSize)
{
        setup(title, windowSize);
}


Window::~Window()
{
}

void Window::setup(const std::string & title, sf::Vector2u windowSize)
{
        m_title = title;
        m_windowSize = windowSize;
        m_fullScreen = false;
        m_isDone = false;
        create();
}

void Window::create()
{
        auto style = (m_fullScreen ? sf::Style::Fullscreen : sf::Style::Default);
        m_window.create() //sf::RenderWindow has no member "create"
}

#endif // !WINDOW_H


 

Thank you in advance.

Pages: [1]
anything