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

Pages: [1]
1
Graphics / Re: Is there a Sprite "Node" equivilant
« on: April 04, 2012, 08:13:10 pm »
I think the first thing...

I would like to be able to draw multiple sprites to a "container sprite" and then also be able to transform that, which would also transform it's children... how many engines seem to work, flixel, starling, jMonkey all seem to adopt this concept of a parent group drawing children idea

an example would be to draw a character and a sword... two sprites.

draw the character to the "node" with the usual information.
draw the sword to the "node", move it's position to 100,100 at a rotation of 45 degrees.

draw the "node" to the screen, rotate it by 180 degrees.

The result would be like drawing character and sword to node... then rotating the whole thing 180 degrees together.

2
Graphics / Is there a Sprite "Node" equivilant
« on: April 04, 2012, 07:33:27 pm »
In a lot of engines, there something called a "Node" (or similar) class... which is basically an object that can draw sprites, but can also is drawable.. basically it should be a sprite, which contains a number of sprites.  Is there any equivilant to that in SFML? if not would it be possible to make something like it?

3
General / Creating an ImageManager class
« on: January 26, 2012, 08:43:34 pm »
Hi, I'm very new to c++ and c, and i'm attempting to make an image manager, preferably something that has static functions to retrieve the objects saved in it from any class...

(ie, you can call ImageManager::loadAsset() from the main function, and also ImageManager::getImage() from a sprite class to load the image instance...)

I understand that to make a "Static Class" you can place the constructor as private, but I'm having trouble retrieving the sf::Image to get an instance of the image loaded... here is a very simple example i'm trying.

Code: [Select]

#include <SFML/Graphics.hpp>

class ImageManager {
public:
   
    static const sf::Image& getImage();
protected:
   
private:
    ImageManager();
    virtual ~ImageManager();
    static sf::Image image;
};


and

Code: [Select]

#include "ImageManager.h"

ImageManager::ImageManager() {
}

ImageManager::~ImageManager() {
}

const sf::Image& ImageManager::getImage()
{
    sf::Image img;
    img.LoadFromFile("zeldatest.png");
   
    ImageManager::image = img;
   
    return ImageManager::image;
}


this gets the error

"ImageManager.cpp:21: undefined reference to `ImageManager::image'" but i have no idea how o fix it..  any insight in how to deal with static classes and properties etc would be greatly appreciated!

Pages: [1]
anything