package tsdl
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Thin bindings to SDL for OCaml
Install
dune-project
Dependency
Authors
Maintainers
Sources
tsdl-1.2.0.tbz
sha512=46f43f448b8c41b6ae0a3390a5a421974560a7cb7c75635cc6f21ba9b5a974b9fbeba88c6793cd3d9eced2e04f570079a9931945f047dc5efd00e1d4e3871044
doc/index.html
Tsdl v1.2.0
Tsdl is an OCaml library providing thin bindings to the cross-platform SDL library.
See the quick start.
Library tsdl
TsdlSDL thin bindings.
Quick start
Toplevel
To use Tsdl in the toplevel with just issue:
ocaml
# #use "topfind";;
# #thread;; (* Only needed if you are using ocaml and < 5.0.0 *)
# #require "tsdl.top";;This automatically loads the library and opens the Tsdl module.
OpenGL window
The following is the minimum you need to get a working OpenGL window with SDL.
open Tsdl
let main () = match Sdl.init Sdl.Init.(video + events) with
| Error (`Msg e) -> Sdl.log "Init error: %s" e; 1
| Ok () ->
match Sdl.create_window ~w:640 ~h:480 "SDL OpenGL" Sdl.Window.opengl with
| Error (`Msg e) -> Sdl.log "Create window error: %s" e; 1
| Ok w ->
Sdl.pump_events ();
Sdl.delay 3000l;
Sdl.destroy_window w;
Sdl.quit ();
0
let () = if !Sys.interactive then () else exit (main ())This can be compiled to byte and native code with:
ocamlfind ocamlc -package tsdl -thread -linkpkg -o min.byte min.ml
ocamlfind ocamlopt -package tsdl -thread -linkpkg -o min.native min.ml
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page