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

Pages: [1]
1
I tried again, and I think it's working, but does anyone have any suggestions as to what I could do to clean up my code a little?

class Output : public Module
{
public:
        struct WindowPanel
        {
                WindowPanel(sf::RenderWindow &a_window) : m_window(&a_window)
                {
                }

                WindowPanel(const WindowPanel& a_window) : m_window(a_window.m_window)
                {
                }

                WindowPanel& operator= (const WindowPanel& a_window)
                {
                }

                sf::RenderWindow *m_window;
        };
       
        Output();

        void CreatePanel();

        std::vector<WindowPanel> m_screen;

};

void Output::CreatePanel()
{
        sf::RenderWindow* f_win;
        f_win = new sf::RenderWindow;
        WindowPanel f_wpan(*f_win);
        m_screen.push_back(f_wpan);
}

void Application::Run()
{
        m_output->CreatePanel();
        m_output->m_screen[Module::MAINSCREEN].m_window->create(sf::VideoMode(640, 480), "A.C.E. System Control", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        m_output->m_screen[Module::MAINSCREEN].m_window->setPosition(sf::Vector2i(m_core->GetDisplaySize().x - (m_output->m_screen[Module::MAINSCREEN].m_window->getSize().x + 15), 0));
        while (m_output->m_screen[Module::MAINSCREEN].m_window->isOpen())
        {
                while (m_output->m_screen[Module::MAINSCREEN].m_window->pollEvent(m_input->m_event))
                {
                        switch (m_input->m_event.type)
                        {
                        case sf::Event::Closed:
                                m_output->m_screen[Module::MAINSCREEN].m_window->close();
                                break;
                        case sf::Event::KeyPressed:
                                if (m_input->m_event.key.code == sf::Keyboard::Escape)
                                {
                                        m_output->m_screen[Module::MAINSCREEN].m_window->close();
                                }
                        }//switch
                }//pollEvent

                m_output->m_screen[Module::MAINSCREEN].m_window->clear();


                m_output->m_screen[Module::MAINSCREEN].m_window->display();

        }//mainWindow.isOpen
}

Thanks.

2
At the moment, I am just allocating more than I need in an array.
Quote
That sounds like you're not familiar with STL containers. I strongly recommend to have a look at them, they simplify dynamic management of multiple elements tremendously.

...and yes... I'm still new to programming.


I tried with Vectors... but it's a pain in the backside... was wondering if there are better options than this:



#include <SFML/Graphics.hpp>
#include <vector>

class WindowPanels {
public:
        WindowPanels(sf::RenderWindow &a_window) : m_window(a_window)
        {
        };
        WindowPanels(const WindowPanels& a_window) : m_window(a_window.m_window)
        {
        };
        WindowPanels& operator= (const WindowPanels& game_object)
        {
        };

        sf::RenderWindow& m_window;
};

int main()
{
        std::vector<WindowPanels> wp_test;
        sf::RenderWindow *t_win;
       
        for (int i = 0; i < 10; i++)
        {
                t_win = new sf::RenderWindow;
                WindowPanels p_win(*t_win);
                wp_test.push_back(p_win);
        }
       
        wp_test[0].m_window.create(sf::VideoMode(640, 480), "A.C.E. System Control", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[1].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 01", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[2].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 02", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[3].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 03", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[4].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 04", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[5].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 05", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[6].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 06", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[7].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 07", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        wp_test[8].m_window.create(sf::VideoMode(320, 240), "A.C.E. Panel 08", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));


        sf::Event mE;

        while (wp_test[0].m_window.isOpen())
        {
                while (wp_test[0].m_window.pollEvent(mE))
                {
                        switch (mE.type)
                        {
                        case sf::Event::Closed:
                                wp_test[0].m_window.close();
                                break;
                        case sf::Event::KeyPressed:
                                if (mE.key.code == sf::Keyboard::Escape)
                                {
                                        wp_test[0].m_window.close();
                                }
                                break;
                        }
                }
                //clear/update/display
        }
}


I'm trying to make render manager to output to different windows depending on what state my application is in, and what objects need to be drawn.

this was my first attempt at it:
        m_output->Run();
        m_output->m_window[0].create(sf::VideoMode(640, 480), "A.C.E. System Control", sf::Style::Titlebar | sf::Style::Close, sf::ContextSettings(0U, 0U, 8));
        //m_output->m_window[0].setPosition(sf::Vector2i(0, 0));
        m_output->m_window[0].setPosition(sf::Vector2i(m_core->m_displayWidth - (m_output->m_window[0].getSize().x + 15), 0));
        while (m_output->m_window[0].isOpen())
        {
                while (m_output->m_window[0].pollEvent(m_input->m_event))
                {
                        switch (m_input->m_event.type)
                        {
                        case sf::Event::Closed:
                                m_output->m_window[0].close();
                                break;
                        case sf::Event::KeyPressed:
                                if (m_input->m_event.key.code == sf::Keyboard::Escape)
                                {
                                        m_output->m_window[0].close();
                                }
                        }//switch
                }//pollEvent

                m_output->m_window[0].clear();


                m_output->m_window[0].display();

        }//mainWindow.isOpen

3
Hello,

Is it possible for dynamic RenderWindow creation at runtime?

At the moment, I am just allocating more than I need in an array.

        sf::RenderWindow* m_window;
        m_window = new sf::RenderWindow[100];

Thanks.

4
General / Re: Error - Graphics/Window - Static Lib
« on: June 04, 2015, 05:05:05 pm »
The CMake Github build and the 2.3 Zip file didn't contain the opengl32.lib

5
General / Re: Error - Graphics/Window - Static Lib
« on: June 04, 2015, 04:40:28 pm »
here's a cropped and highlighted version of the screenshot above. i've linked the -s-d.lib files.




i'll try and play around with it again and maybe go back down a version if i can't get 2.3 working

6
General / Error - Graphics/Window - Static Lib
« on: June 04, 2015, 09:55:31 am »
Hello
I am new to programming, but I have gotten SFML working on a few other projects before.

When I tried updating via GitHub and making a CMake Project, I received errors during my build. So I decided to download the Zip from http://www.sfml-dev.org/download/sfml/2.3/

32Bit - VS2013.

I have linked the libraries exactly how I had done before, and included the SFML_STATIC macro.

However I get this error. As you can see, it's not even building anything other than a window, but there are some referrences to the Texture.cpp.obj in the error list.



here's a screenshot of my program window working before I started the update.



Thanks in advance. Hopefully I didn't screw anything up. I've only been programming for about 3 months.

Pages: [1]
anything