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

Pages: [1]
1
Yeah, I forgot how initialization lists really work  ;D

But now I got it.

My problem is solved, thank you, Mr. Exploiter.

2
OMG, eXpl0it3r, you're awesome. It  works.  ;D

I tried not to use pointers and heap, but it didn't work (?).

Could you please give me an example of how to do it better?

EDIT:
ah, now I got it. The only pointer I have now is currentState

3
Ok, this one is more minimal:
http://pastebin.com/0AhwCbqy

By the way: I tested the program on another PC (32-bit) and it didn't work.

4
No, it's exactly 800x600. But I'll try it.

EDIT: 8000x6000 doesn't work

5
the tar.lzma contains everything you need, incl. headers.

main.cpp:
#include "Game.hpp"
#include "IntroState.hpp"
#include <iostream>

using namespace std;

int main(int argc, char **argv)
{
        IntroState iSt;

        Game game(800, 600, "Test");
        game.changeState(&iSt);

        while(game.isOpen()){
                game.handleEvents();
                game.draw();
        }
}
 
Game.cpp:
#include "Game.hpp"
#include <SFML/Graphics.hpp>
#include <string>
#include <iostream>

using namespace std;

Game::Game(int x, int y, std::string label)
{
        window = new sf::RenderWindow(sf::VideoMode(x, y), label);
}


Game::~Game()
{
        delete window;
}

void Game::changeState(State *state)
{
        currentState = state;
}

void Game::handleEvents()
{
        currentState->handleEvents(window);
}

void Game::draw()
{
        window->clear();
        currentState->draw(window);
        window->display();
        cout << "displayed" << endl;
}

bool Game::isOpen()
{
        return window->isOpen();
}
IntroState.cpp:
#include "IntroState.hpp"
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace sf;
using namespace std;

IntroState::IntroState()
{
        splashTex = new Texture();
        splashTex->loadFromFile("splash.png");

        splash = new Sprite(*splashTex);
}

IntroState::~IntroState()
{
        delete splash;
        delete splashTex;
}

void IntroState::handleEvents(sf::RenderWindow *window)
{
        Event e;
        while(window->pollEvent(e))
        {
                if(e.type == Event::Closed)
                {
                        window->close();
                        cout << "closed" << endl;
                }
        }
}

void IntroState::draw(sf::RenderWindow *window)
{
        cout << "will now draw..." << endl;
        window->draw(*splash);
        cout << "drawn" << endl;

}[code]

[attachment deleted by admin]

6
General discussions / Re: SFML 2.0 RC
« on: September 05, 2012, 04:26:29 pm »
I already asked in the chat and it looks like there's something between sfml and the drivers that doesnt work well...

The whole thing is explained here: http://en.sfml-dev.org/forums/index.php?topic=9074.0

7
Sorry, but it looks like that's not the problem. It still doesn't work  :(

8
Graphics / radeon: The kernel rejected CS, see dmesg for more information.
« on: September 05, 2012, 04:00:53 pm »
Hi!

I have a problem with the latest build of SFML2RC.

When I try to run
#include "IntroState.hpp"
#include <SFML/Graphics.hpp>
#include <iostream>

using namespace sf;
using namespace std;

IntroState::IntroState()
{
        splashTex = new Texture();
        splashTex->loadFromFile("splash.png");

        splash = new Sprite(*splashTex);
}

IntroState::~IntroState()
{
        delete splash;
        delete splashTex;
}

void IntroState::handleEvents(sf::RenderWindow *window)
{
        Event e;
        while(window->pollEvent(e))
        {
                if(e.type == Event::Closed)
                {
                        window->close();
                        cout << "closed" << endl;
                }
        }
}

void IntroState::draw(sf::RenderWindow *window)
{
        cout << "will now draw..." << endl;
        window->draw(*splash);
        cout << "drawn" << endl;

}

the created window looks weird and I get:
Quote
radeon: The kernel rejected CS, see dmesg for more information.

dmesg says:
Quote
[  507.205263] radeon 0000:01:05.0: alignments 832 1 1 1
[  507.205269] [drm:radeon_cs_ioctl] *ERROR* Invalid command stream !
[  507.233217] radeon 0000:01:05.0: texture bo too small (800 600 26 0 -> 1920000 have 4096)

BUT:
When I put con- and destructor in draw(), like this:
void IntroState::draw(sf::RenderWindow *window)
{      
        splashTex = new Texture();
        splashTex->loadFromFile("splash.png");
        splash = new Sprite(*splashTex);
       
        cout << "will now draw..." << endl;
        window->draw(*splash);
        cout << "drawn" << endl;
       
        delete splash;
        delete splashTex;
}
it works!

I have no idea how to solve this problem. Maybe you have an idea?

If so, feel free to help.

greets, mobai

Pages: [1]