Files
balatro-gba-chinese-jocker-…/include/selection_grid.h
T
Geralt bf66f96844 Add swapping order of Owned Jokers (#258)
* swap Jokers

* Hide score properly

* add key_released to inputs triggering selection_grid process input

* format code

* Add suggestions and bug fixes from @MeirGavish

* Add comment

* format selection_grid

* toto

* format

* format

* Turned clang-format off for selection grid rows

* revert reroll bug fix, already adressed

* format selection_grid.c

* Move conditions around in game.c

* typo

* Attempt at fixing braced initializer indent format

---------

Co-authored-by: MathisMartin31 <mathis.martin31@gmail.com>
Co-authored-by: MeirGavish <meir.gavish@gmail.com>
2025-12-07 02:58:50 -08:00

42 lines
1.4 KiB
C

#ifndef SELECTION_GRID_H
#define SELECTION_GRID_H
#include <tonc.h>
typedef POINT Selection;
struct SelectionGridRow;
struct SelectionGrid;
typedef struct SelectionGridRow SelectionGridRow;
typedef struct SelectionGrid SelectionGrid;
// Called whenever there is a change in the selection cursor
// row_idx is the index of the row whose function is invoked - can be used to identify whether it is the previous or new selection row.
typedef void (*RowOnSelectionChangedFunc)(SelectionGrid* selection_grid, int row_idx, const Selection* prev_selection, const Selection* new_selection);
typedef int (*RowGetSizeFunc)();
// Called for any non-directional key hit
// The key will not be passed, the function will have to check key_hit() etc. for the key it wants to check
typedef void (*RowOnKeyTransitFunc)(SelectionGrid* selection_grid, Selection* selection);
struct SelectionGridRow
{
int row_idx;
RowGetSizeFunc get_size;
RowOnSelectionChangedFunc on_selection_changed;
RowOnKeyTransitFunc on_key_transit;
};
struct SelectionGrid
{
const SelectionGridRow* rows;
const int num_rows;
Selection selection;
};
void selection_grid_process_input(SelectionGrid* selection_grid);
void selection_grid_move_selection_horz(SelectionGrid* selection_grid, int direction_tribool);
void selection_grid_move_selection_vert(SelectionGrid* selection_grid, int direction_tribool);
#endif