Skip to content

ArthurSonzogni/smk

Repository files navigation

SMK (Simple multimedia kit)

travis issues license contributors

header

Features:

  • Compatible with WebAssembly. One build for every platforms!
  • Fast & simple.
  • No dependencies: everything is fetched using cmake FetchContent.

Ready to start?

Open a new Window:

  auto window = smk::Window(640, 480, "Title");

The main loop:

  window.ExecuteMainLoop([&] {
    window.Clear(smk::Color::Black);

    [...] // Draw stuff

    window.Display();
  });

Images

Load textures:

  auto ball_texture = smk::Texture("./ball.png");

Display images:

  auto ball_sprite = smk::Sprite(ball_texture);
  ball_sprite.SetPosition({200,200});
  window.Draw(ball_sprite);

Text

Load font:

  auto font_arial = smk::Font("./arial.ttf", 32);

Display text:

  auto text = smk::Text(font_arial, "hello world");
  text.SetPosition({200,200});
  window.Draw(text);

Sound

Load sound:

  auto sound_buffer = smk:SoundBuffer("./boing.ogg");

Play sound:

  auto sound = smk::Sound(sound_buffer);
  sound.Play();

Transform the view

  auto view = smk::View();
  view.SetCenter({200, 200});
  view.SetSize(320,240);
  window.SetView(view);

Library made using SMK

  • smkflow => A node editor library.

Games made using SMK

Please add yours.

Story

I needed to port several games made using the SFML to WebAssembly. SFML isn't supporting WebAssembly (yet), so I had to reimplement it myself. If you know the SFML, then SMK must be very familiar to you.

Minimal packages to install for building/executing:

They should already be installed. If they aren't you need to execute:

sudo apt install xorg-dev libgl1-mesa-dev libpulse-dev

Thanks

SMK depends directly on many great projects listed below:

SMK is also made possible thanks to: