Getting Started

fallahn edited this page Oct 9, 2017 · 11 revisions

Once you have compiled the library with the compiler of your choice, simply link it to your new project, along with the SFML libraries. xygine requires all only four components of SFML - system, windows, graphics, and audio, although networking can optionally be used if it is required.

To use the library create a new class which inherits xy::App and implement the virtual functions:

void handleEvent(const sf::Event&);
void handleMessage(const xy::Message&);

void registerStates();
void updateApp(float dt);
void draw();

and, optionally, override initialise() and finalise(). These are executed on startup and exit respectively, and should be used for any potentially non-exception safe code not suitable for the constructor or destructor. When using the state stack you'd want to clear it in finalise() for example.




pass on any window event and system messages respectively. See messages for more detail.


is needed when using the state stack implementation of xygine. When creating new game states (deriving from xy::State) they need to be registered with the StateStack instance of your game. See the Example directory for a demo project which shows how to create a basic state which using a xy::Scene to create a menu.


passes on the current elapsed game time, fixed at 1/60 second. This is used to update logic when xygine is running.


is the top level draw function, from which all drawing code should be called.

Once you have created your app class, instantiate it in your main() function and call run()

int main()
	MyApp game;;
	return 0;
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.