Commit 4e937fd9 authored by Adrien Plazas's avatar Adrien Plazas

README.md: Add a simple Vala application example

parent 8451f4b5
Pipeline #27968 passed with stages
in 9 minutes and 43 seconds
......@@ -14,6 +14,45 @@ namely the `libretro` subdirectory of your `lib` directory — and it recommends
them to come with [Libretro core descriptors]
(https://wiki.gnome.org/Apps/Games/Documentation/LibretroDescriptorSpec).
## Example
Writing a Libretro frontend with retro-gtk can be as simple as the following
Vala code:
```vala
int main (string[] args) {
Gtk.init (ref args);
var core = new Retro.Core ("/path/to/your/core_libretro.so");
core.set_medias ({ "file:///uri/of/you/game.file" });
try {
core.boot();
}
catch (Error e) {
critical (e.message);
return 1;
}
var view = new Retro.CoreView ();
view.set_as_default_controller (core);
view.set_core (core);
view.show ();
var loop = new Retro.MainLoop (core);
loop.start ();
var win = new Gtk.Window ();
win.destroy.connect (Gtk.main_quit);
win.add (view);
win.present ();
Gtk.main ();
return 0;
}
```
## Dependencies
retro-gtk depends on the following libraries at compile time and at run time:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment