From 3063dda4587be5538e8f2d54621de1ee3847b540 Mon Sep 17 00:00:00 2001 From: Tobias Mock Date: Tue, 10 Dec 2024 22:49:45 +0100 Subject: [PATCH] Fix documentation of list views in gui module --- examples/gui/controls_test_suite.ml | 11 ++++++----- src/raygui/functions.ml | 4 ++-- src/raygui/raygui.mli | 6 ++++-- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/examples/gui/controls_test_suite.ml b/examples/gui/controls_test_suite.ml index 98c3f8a..c3a88e8 100644 --- a/examples/gui/controls_test_suite.ml +++ b/examples/gui/controls_test_suite.ml @@ -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; @@ -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; @@ -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 [ @@ -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 @@ -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; diff --git a/src/raygui/functions.ml b/src/raygui/functions.ml index 37a094f..259df20 100644 --- a/src/raygui/functions.ml +++ b/src/raygui/functions.ml @@ -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 diff --git a/src/raygui/raygui.mli b/src/raygui/raygui.mli index e0adee9..f5fb61c 100644 --- a/src/raygui/raygui.mli +++ b/src/raygui/raygui.mli @@ -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 *)