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.


Topics - Plazmotech

Pages: [1]
1
General / Keeping RenderWindow in a class?
« on: May 10, 2013, 03:58:53 am »
How can I keep render window in a class? I have this

//simController.h
class simController {
private:
        sf::RenderWindow game;
public:
    void execute();
    void init();
    void event();
    void exit();
};

and this

//simController.cpp
void simController::init(){
    game = sf::RenderWindow(sf::VideoMode(1280, 920), "Sim");
    game.setFramerateLimit(0);
};

However, RenderWindows are uncopyable, so I cannot do this. I also cannot declare the window directly inside the class. So how can I store a RenderWindow in a class? it seems impossible.

Thanks

2
Hello everybody! I'm in the process of making a game. I was using SFML 1.6, and was recently informed to upgrade to SFML 2.0. I did, and fixed everything I had to, hoping that it would fix the texture. But it did not. My texture now looks like this: http://videobam.com/vdtJR

It's horrible. Normally it would looks like the lights were normally blinking. This is my actual texture: http://i.imgur.com/oKl4VBO.png

and this is the code I'm using to set the sub rect
playerSprite.setTextureRect(sf::IntRect(imageLoop % 4 * 32, floor(imageLoop / 4) * 32, imageLoop % 4 * 32 + 32, floor(imageLoop / 4) * 32 + 32));

It was working perfectly before I upgraded from SFML 1.6 to 2.0. Please help! This is really annoying.


Also, it made the sprite extremely off center. Normally, these bullets are centered: http://i.imgur.com/jYDaOqY.jpg

3
Hi! I have a class, within that class contains a Sprite and an Image and a ton of other irrelevant stuff. Anyway, I have an init function. This function is called to initiate all the good stuffs including setting the image for the sprite. I also have a function that is called to draw this sprite. The function takes a pointer to the Render Window and then uses it to draw the sprite (held within the class). Although, when I draw like this, it shows as a white box. In order to draw correctly, before I draw I must set the image once again. This is very very odd as I have yet another class that doesn't do this (I only have to set the image once) and another class that does ALSO do this. I have done lots of problem testing and found out its not an obvious fault in my code (as in it is indeed being called and indeed being drawn correctly).

Anyway, please help me with this, bros.

P.S. the classes dynamically change coordinates. But the class that doesn't do the resetting thing also changes coords. So that's also odd.

P.P.S. if it helps, the classes that do this are stored within a std::vector<--class-->.

4
Hi. I'm making a game that involves pixels. When I display a sprite, it becomes antialiased (all fuzzy). How can I make it aliased (sharp) like the actual .png is? Thanks!

Pages: [1]
anything