1
SFML projects / SF Video Player
« on: September 08, 2010, 03:25:44 pm »
You should also post this to the wiki! http://www.sfml-dev.org/wiki/en/sources
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.
class Application
{
public:
SpriteManager Spr_Mgr(); //Create Sprite Manager for Application
};
Application::Application()
{
Spr_Mgr.LoadPictures(); //Load Pictures with Sprite Manager - ERROR, Spr_Mgr not recognized!!
}
void Application::DrawStuff()
{
Window.Draw(Image_1); //Display the Picture
}
#include <SFML/Graphics.hpp>
class Application
{
private:
sf::RenderWindow Window;
sf::String Hello;
void DrawStuff();
public:
Application();
void Run();
};
Application::Application()
{
Window.Create(sf::VideoMode(326, 600), "Title");
Hello.SetText("Hello!");
Hello.SetColor(sf::Color(0, 128, 128));
Hello.SetPosition(100.f, 100.f);
Hello.SetSize(30.f);
}
void Application::DrawStuff()
{
Window.Draw(Hello);
}
void Application::Run()
{
while (Window.IsOpened())
{
sf::Event Event;
while (Window.GetEvent(Event))
{
if (Event.Type == sf::Event::Closed)
Window.Close();
}
DrawStuff();
Window.Display();
}
}
int main()
{
Application Game;
Game.Run();
return 0;
}
c_str(): Generates a null-terminated sequence of characters (c-string) with the same content as the string object and returns it as a pointer to an array of characters.
A terminating null character is automatically appended.
http://www.cplusplus.com/reference/string/string/c_str/
data(): Returns a pointer to an array of characters with the same content as the string.
Notice that no terminating null character is appended
http://www.cplusplus.com/reference/string/string/data/
mainSocket.Send(buffer.c_str(),sizeof(char) * (buffer.size() + 1));
mainSocket.Send(buffer.data(), buffer.length());