1
Graphics / Visual C++ 2008: sf::Image as static attribute
« on: December 12, 2010, 02:45:01 am »
Now I get it. Also I've linked the wrong graphics lib :oops:.
Thanks for your help !
Thanks for your help !
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.
// Main.cpp: Hauptprojektdatei.
#include "stdafx.h"
#include "Missile.h"
using namespace System;
int main(array<System::String ^> ^args)
{
Missile missile;
return 0;
}
#pragma once
#include <SFML/Graphics.hpp>
class Missile
{
public :
static bool Init(const std::string& ImageFile)
{
return Image.LoadFromFile(ImageFile);
}
Missile()
{
Sprite.SetImage(Image); // every sprite uses the same unique image
}
private :
static sf::Image Image; // shared by every instance
sf::Sprite Sprite; // one per instance
};
#include "StdAfx.h"
#include "Missile.h"