Skip to content

Commit

Permalink
Fix documentation of list views in gui module
Browse files Browse the repository at this point in the history
  • Loading branch information
tjammer committed Dec 10, 2024
1 parent 24faadc commit 3063dda
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 9 deletions.
11 changes: 6 additions & 5 deletions examples/gui/controls_test_suite.ml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ type state = {
list_view_active : int;
list_view_ex_active : int;
mutable list_view_ex_focus : int;
mutable list_view_ex_index : int;
mutable list_view_ex_scroll_index : int;
toggle_group_active : int;
multi_text_box_text : string;
mutable multi_text_box_edit_mode : bool;
Expand Down Expand Up @@ -52,7 +52,7 @@ let setup () =
list_view_active = 0;
list_view_ex_active = 0;
list_view_ex_focus = 0;
list_view_ex_index = 0;
list_view_ex_scroll_index = 0;
toggle_group_active = 0;
multi_text_box_text = "Multi text box";
multi_text_box_edit_mode = false;
Expand Down Expand Up @@ -181,7 +181,7 @@ let rec loop s =
in

let rect = Rectangle.create 165.0 180.0 140.0 200.0 in
let list_view_ex_active, list_view_ex_focus, list_view_ex_index =
let list_view_ex_active, list_view_ex_focus, list_view_ex_scroll_index =
Raygui.(
list_view_ex rect
[
Expand All @@ -194,7 +194,8 @@ let rec loop s =
"elements";
"amazing!";
]
s.list_view_ex_focus s.list_view_ex_index s.list_view_ex_active)
s.list_view_ex_focus s.list_view_ex_scroll_index
s.list_view_ex_active)
in

let rect = Rectangle.create 165.5 400.0 140.0 25.0 in
Expand Down Expand Up @@ -278,7 +279,7 @@ let rec loop s =
list_view_active;
list_view_ex_active;
list_view_ex_focus;
list_view_ex_index;
list_view_ex_scroll_index;
toggle_group_active;
multi_text_box_text;
color_picker_val;
Expand Down
4 changes: 2 additions & 2 deletions src/raygui/functions.ml
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,8 @@ let grid rct b c = _grid (to_struct rct) b c |> Raylib.to_ctyp

let list_view rct label index active =
let vl_ptr = Raylib.ptr_of_int index in
let rt = _list_view (to_struct rct) label vl_ptr active in
(rt, Ctypes.(!@vl_ptr))
let active = _list_view (to_struct rct) label vl_ptr active in
(active, Ctypes.(!@vl_ptr))

let list_view_ex rct strings focus index active =
let open Ctypes in
Expand Down
6 changes: 4 additions & 2 deletions src/raygui/raygui.mli
Original file line number Diff line number Diff line change
Expand Up @@ -271,11 +271,13 @@ val grid : Raylib.Rectangle.t -> float -> int -> Raylib.Vector2.t
(** {1 Advance controls set } *)

val list_view : Raylib.Rectangle.t -> string -> int -> int -> int * int
(** [list_view bounds text scross_index active] List View control, returns selected list item index, active *)
(** [list_view bounds text scroll_index active] List View control, returns
selected list item index, scroll index *)

val list_view_ex :
Raylib.Rectangle.t -> string list -> int -> int -> int -> int * int * int
(** [list_view_ex bounds text_list focus scroll_index active] List View with extended parameters, returns selected list item index, focus, active *)
(** [list_view_ex bounds text_list focus scroll_index active] List View with
extended parameters, returns selected list item index, focus, scroll index *)

val message_box : Raylib.Rectangle.t -> string -> string -> string -> int
(** [message_box bounds title message buttons] Message Box control, displays a message *)
Expand Down

0 comments on commit 3063dda

Please sign in to comment.