/sfml-helper

Helper library for SFML as a header-only library.

Primary LanguageC++MIT LicenseMIT

SFML-Helper

Helper functions for use in SFML applications.

all the functions are in sfml-helper.hpp as a single-header only format.

Quick Start

First put sfml libs inside lib (debug libs in lib/Debug and release in lib/Release), then put external sfml dependency libs inside lib (flac.lib, freetype.lib, openal32.lib, vorbis.lib, etc).

Then run this:

> premake5 vs2022
> msbuild -p:configuration=Debug build\sfml-helper.sln
> bin\Debug\sfml-helper.exe

Note: You can also open the VS solution file (.sln) directly and build with Visual Studio(If you want to wait eternally for it to open) and build it.

Example

#define SFML_HELPER_IMPLEMENTATION
#include <sfml-helper.hpp>

int main(int argc, char *argv[]) {
  //  global
  Data d;
  d.init(1280, 720, 2, "sfml-helper");

  // game loop
  while (d.win.isOpen()) {
    // calculate delta time
    float delta = d.calc_delta();

    // update window title
    d.update_title();

    // event loop
    sf::Event e;
    d.update_mouse();
    d.update_key();
    while (d.win.pollEvent(e)) {
      d.handle_close(e);
      d.update_mouse_event(e);
      d.update_key_event(e);
    }

    // clear
    d.clear();

    // update

    // draw

    // display
    d.display();
  }

  return 0;
}

Dependencies