Skip to content

Commit

Permalink
OCaml example to create window and renderer separately
Browse files Browse the repository at this point in the history
  • Loading branch information
bholten authored and xyproto committed Jun 5, 2023
1 parent 0a88cc7 commit 49eeb4c
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion ocaml-tsdl/main.ml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ open Tsdl
let run () =
let (let*) = Result.bind in
let* _ = Sdl.init Sdl.Init.everything in
let* (w, r) = Sdl.create_window_and_renderer ~w:620 ~h:387 Sdl.Window.shown in
let* w = Sdl.create_window "Hello World!"
~x:Sdl.Window.pos_centered
~y:Sdl.Window.pos_centered
~w:620
~h:387
Sdl.Window.shown in
let* r = Sdl.create_renderer w
~index:(-1)
~flags:Sdl.Renderer.software in
let* bmp = Sdl.load_bmp "../img/grumpy-cat.bmp" in
let* txt = Sdl.create_texture_from_surface r bmp in
Sdl.free_surface bmp;
Expand Down

0 comments on commit 49eeb4c

Please sign in to comment.