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

Pages: [1]
1
General / Re: 'Window' in struct Shared_Context does not name a type
« on: January 13, 2021, 05:15:33 pm »
The code looks ok. Maybe a loop in includes? What headers do EnventManager.h and StateManager.h include?

The EventManager.h include this
#include <unordered_map>
#include <functional>
#include <SFML/Graphics.hpp>
#include "CustomHash.h"
#include <fstream>
#include <sstream>

The StateManager.h include this
#include <SFML/Graphics.hpp>
#include <SFML/Window.hpp>
#include <unordered_map>
#include <functional>
#include "Window.h"
#include "EventManager.h"
#include "CustomHash.h"
#include "SharedContext.h"


2
General / 'Window' in struct Shared_Context does not name a type
« on: January 13, 2021, 02:01:19 pm »
I was following the code in SFML Game Development by example, written by Order Nexus. I got hit by an errors in Shared Context. The code is as follows...
#include "Window.h"
#include "EventManager.h"

struct Shared_Context{
    Shared_Context():m_wind(nullptr),m_eventManager(nullptr) {}
    Window* m_wind;
    EventManager* m_eventManager;
};

The error appears is
include\SharedContext.h|8|error: 'Window' does not name a type|

My code for Window.h is as follows...
#ifndef WINDOW_H
#define WINDOW_H
#include <SFML/Window.hpp>
#include "EventManager.h"
#include "StateManager.h"


class Window
{
    public:
        Window();
        Window(const std::string& l_title,const sf::Vector2u& l_size);
        ~Window();

        void            BeginDraw(); // Clear the window.
        void            EndDraw(); // Display the changes.
        void            Update();
        bool            IsDone();
        bool            IsFullscreen();
        sf::Vector2u    GetWindowSize();
        //void ToggleFullscreen();
        void            Draw(sf::Drawable& l_drawable);
        bool            IsFocused();
        EventManager*   GetEventManager();
        void            Close(/*EventDetails* l_details = nullptr*/);

    protected:

    private:
        void                Setup(const std::string l_title, const sf::Vector2u& l_size);
        void                Destroy();
        void                Create();
        sf::RenderWindow    m_window;
        sf::Vector2u        m_windowSize;
        std::string         m_windowTitle;
        bool                m_isDone;
        bool                m_isFullscreen;
        EventManager        m_eventManager;
};

#endif // WINDOW_H
 

I hope someone can help me and explains why do I get this error  :(

Pages: [1]
anything