mlx3ds/include/utilsconsole.hpp
Zy 13b93106ee part: implement some functions (windows & display)
part:
- remove mlx3ds_3dskey.h, instead use hid.h
- add definitions of:
  - mlx_init()
  - mlx_new_window()
  - mlx_clear_window()
  - mlx_destroy_window()
  - mlx_pixel_put()
  - mlx_new_image()
  - mlx_get_data_addr()
  - mlx_put_image_to_window()
  - mlx_destroy_image()

dev:
- Makefile: add rule check_headers
- Makefile: add variable FLAGS
    (call 'make rule FLAGS=flags'
	to add flags to compilation)
- add /dev/norm.sh: nicer norminette
- add tester in main(), and related utilsconsole.*

docs:
- make clear mlx_get_data_addr() docs
2024-10-06 16:53:59 +02:00

52 lines
1.6 KiB
C++

/**
* utilsconsole.hpp
* by Zy
*/
/**
* utilsconsole.hpp (uc_*() functions)
* Utility functions for the 3DS console.
*/
#pragma once
#include <string>
#include <vector>
using namespace std;
/// @brief To use with uc_menu(): Represent an element of the menu.
typedef struct {
/// @brief Displayed name.
string name;
/// @brief true if this button can be used to change the value of a number.
bool is_number_prompt;
/// @brief Only if is_number_prompt is true: the number to change.
int *value;
/// @brief Only if is_number_prompt is true: the minimum value possible for
/// value.
int min;
/// @brief Only if is_number_prompt is true: the maximum value possible for
/// value.
int max;
} s_uc_menu_element;
/// @brief Display a menu with several items in the console.
/// @details
/// Non-blocking function, must be called in loop.
/// Only one menu can work at the same time. 'elements' must not change in
/// address.
/// @param elements A pointer to a vector of all the elements of the menu.
/// @return The index of the confirmed element. If none, return -1.
int uc_menu(vector<s_uc_menu_element> &elements);
/// @brief Display a menu quickly using only confirm buttons.
/// @details
/// Blocking function. Will return -1 if aptMainLoop() becomes false.
/// @param str Text representing each element. The last parameter must be NULL.
/// @return The index of the confirmed element.
int uc_menu_quick(const char *str, ...);
/// @brief Blocks the program until the user presses A.
/// @details Will also return if aptMainLoop() becomes false.
void uc_pause(void);