Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
6
Task/Window-creation/OCaml/window-creation-1.ocaml
Normal file
6
Task/Window-creation/OCaml/window-creation-1.ocaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
let () =
|
||||
let top = Tk.openTk() in
|
||||
Wm.title_set top "An Empty Window";
|
||||
Wm.geometry_set top "240x180";
|
||||
Tk.mainLoop ();
|
||||
;;
|
||||
6
Task/Window-creation/OCaml/window-creation-2.ocaml
Normal file
6
Task/Window-creation/OCaml/window-creation-2.ocaml
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
open Graphics
|
||||
|
||||
let () =
|
||||
open_graph " 800x600";
|
||||
let _ = read_line() in
|
||||
close_graph ()
|
||||
11
Task/Window-creation/OCaml/window-creation-3.ocaml
Normal file
11
Task/Window-creation/OCaml/window-creation-3.ocaml
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
open GMain
|
||||
|
||||
let window = GWindow.window ~border_width:2 ()
|
||||
let button = GButton.button ~label:"Hello World" ~packing:window#add ()
|
||||
|
||||
let () =
|
||||
window#event#connect#delete ~callback:(fun _ -> true);
|
||||
window#connect#destroy ~callback:Main.quit;
|
||||
button#connect#clicked ~callback:window#destroy;
|
||||
window#show ();
|
||||
Main.main ()
|
||||
5
Task/Window-creation/OCaml/window-creation-4.ocaml
Normal file
5
Task/Window-creation/OCaml/window-creation-4.ocaml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
let () =
|
||||
Sdl.init [`VIDEO];
|
||||
let _ = Sdlvideo.set_video_mode 200 200 [] in
|
||||
Sdltimer.delay 2000;
|
||||
Sdl.quit ()
|
||||
16
Task/Window-creation/OCaml/window-creation-5.ocaml
Normal file
16
Task/Window-creation/OCaml/window-creation-5.ocaml
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
open Sdl
|
||||
|
||||
let () =
|
||||
let width, height = (640, 480) in
|
||||
Sdl.init [`VIDEO];
|
||||
let window, renderer =
|
||||
Render.create_window_and_renderer
|
||||
~width ~height ~flags:[]
|
||||
in
|
||||
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 ()
|
||||
14
Task/Window-creation/OCaml/window-creation-6.ocaml
Normal file
14
Task/Window-creation/OCaml/window-creation-6.ocaml
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
let () =
|
||||
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