Commits

Paweł Wieczorek committed 12712a4 Draft

adding UI.ml and UI_Button.ml

Comments (0)

Files changed (4)

     camlp4/pa_recupd.cmo\
     camlp4/pa_recupd.annot\
 
-
-SOURCES =\
+BASIC_SOURCES=\
     src/Video.mli\
     src/Video.ml\
     src/Resource.mli\
     src/Resource.ml\
     src/World.mli\
     src/World.ml\
+
+UI_SOURCES=\
+    src/UI/UI.ml\
+    src/UI/UI_Button.ml\
+
+SCREENS_SOURCES=\
     src/View.mli\
     src/View.ml\
     src/View/MainView.mli\
     src/View/MainView.ml\
     src/View/GameView.mli\
     src/View/GameView.ml\
+
+SOURCES =\
+    ${BASIC_SOURCES}\
+    ${SCREENS_SOURCES}\
+    ${UI_SOURCES}\
     src/System.mli\
     src/System.ml\
     src/Main.ml\
+(*pp $PP *)
+(**************************************************************************
+ * PixLand
+ *   Copyrights 2012 by Pawel Wieczorek <wieczyk gmail com>
+ *)
+
+(**************************************************************************
+ * Helpers
+ *)
+
+let from_hex i = 
+    let (b, i) = (i mod 0x100, i / 0x100) in
+    let (g, i) = (i mod 0x100, i / 0x100) in
+    let (r, i) = (i mod 0x100, i / 0x100) in
+    let (_)    = i (* alpha, maybe later *) in
+    (r,g,b)
+
+(**************************************************************************
+ * Constants
+ *)
+
+let background_color = from_hex 0x3b444b
+

src/UI/UI_Button.ml

+(*pp $PP *)
+(**************************************************************************
+ * PixLand
+ *   Copyrights 2012 by Pawel Wieczorek <wieczyk gmail com>
+ *)
+
+(**************************************************************************
+ * Types
+ *)
+
+
+(**************************************************************************
+ * 
+ *)
+
+let draw_button text x y w h surface =
+    let rc = (x,y,w,h) in
+    ()

src/View/MainView.ml

 
 let bgcolor = (0,0,0)
 
-let menu_width  = 200
+let menu_width  = 300
 
 let menu_height = 400
-;;
 
 let _view_draw img state surface = 
   Video.put_image img surface (0,0);
   let padding_ver = (width - menu_width ) / 2 in
   let padding_hor = (height - menu_height ) / 2 in
   let rc          = (padding_ver, padding_hor, menu_width, menu_height) in
-  Video.draw_rect bgcolor rc surface in
+  Video.draw_rect bgcolor rc surface;
   Continue
-;;
-
 
 let _view_keydown state = function
   | Sdlkey.KEY_ESCAPE ->