September Morn Update
This commit is contained in:
parent
4e2d22a71d
commit
aac6731f2c
6856 changed files with 141342 additions and 21127 deletions
|
|
@ -1,14 +1,16 @@
|
|||
let () =
|
||||
let app = SFRenderWindow.make (640, 480) "OCaml-SFML Windowing" in
|
||||
open Sdl
|
||||
|
||||
let rec loop() =
|
||||
let continue =
|
||||
match SFRenderWindow.getEvent app with
|
||||
| Some SFEvent.Closed -> false
|
||||
| _ -> true
|
||||
in
|
||||
SFRenderWindow.clear app SFColor.black;
|
||||
SFRenderWindow.display app;
|
||||
if continue then loop()
|
||||
let () =
|
||||
let width, height = (640, 480) in
|
||||
Sdl.init [`VIDEO];
|
||||
let window, renderer =
|
||||
Render.create_window_and_renderer
|
||||
~width ~height ~flags:[]
|
||||
in
|
||||
loop()
|
||||
let rgb = (0, 255, 0) in
|
||||
let a = 255 in
|
||||
Render.set_draw_color renderer rgb a;
|
||||
Render.clear renderer;
|
||||
Render.render_present renderer;
|
||||
Timer.delay 3000;
|
||||
Sdl.quit ()
|
||||
|
|
|
|||
|
|
@ -1,12 +1,14 @@
|
|||
open Xlib
|
||||
|
||||
let () =
|
||||
let d = xOpenDisplay "" in
|
||||
let s = xDefaultScreen d in
|
||||
let w = xCreateSimpleWindow d (xRootWindow d s) 10 10 100 100 1
|
||||
(xBlackPixel d s) (xWhitePixel d s) in
|
||||
xSelectInput d w [KeyPressMask];
|
||||
xMapWindow d w;
|
||||
let _ = xNextEventFun d in (* waits any key-press event *)
|
||||
xCloseDisplay d;
|
||||
;;
|
||||
let app = SFRenderWindow.make (640, 480) "OCaml-SFML Windowing" in
|
||||
|
||||
let rec loop () =
|
||||
let continue =
|
||||
match SFRenderWindow.pollEvent app with
|
||||
| Some SFEvent.Closed -> false
|
||||
| _ -> true
|
||||
in
|
||||
SFRenderWindow.clear app SFColor.black;
|
||||
SFRenderWindow.display app;
|
||||
if continue then loop ()
|
||||
in
|
||||
loop ()
|
||||
|
|
|
|||
12
Task/Window-creation/OCaml/window-creation-7.ocaml
Normal file
12
Task/Window-creation/OCaml/window-creation-7.ocaml
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
open Xlib
|
||||
|
||||
let () =
|
||||
let d = xOpenDisplay "" in
|
||||
let s = xDefaultScreen d in
|
||||
let w = xCreateSimpleWindow d (xRootWindow d s) 10 10 100 100 1
|
||||
(xBlackPixel d s) (xWhitePixel d s) in
|
||||
xSelectInput d w [KeyPressMask];
|
||||
xMapWindow d w;
|
||||
let _ = xNextEventFun d in (* waits any key-press event *)
|
||||
xCloseDisplay d;
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue