2023-08-03 17:18:55 +02:00
|
|
|
/**
|
|
|
|
* @file components.h
|
2024-11-06 00:34:14 +01:00
|
|
|
* @brief Menu Graphical User Interface Components
|
2023-08-03 17:18:55 +02:00
|
|
|
* @ingroup menu
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef COMPONENTS_H__
|
|
|
|
#define COMPONENTS_H__
|
|
|
|
|
|
|
|
#include <libdragon.h>
|
|
|
|
#include "menu_state.h"
|
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @addtogroup menu_ui_components
|
|
|
|
* @{
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief File image Enumeration.
|
|
|
|
*
|
|
|
|
* Enumeration for different types of file images used in the GUI.
|
|
|
|
*/
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
typedef enum {
|
2024-11-06 00:34:14 +01:00
|
|
|
IMAGE_BOXART_FRONT, /**< Boxart image from the front */
|
|
|
|
IMAGE_BOXART_BACK, /**< Boxart image from the back */
|
|
|
|
IMAGE_BOXART_TOP, /**< Boxart image from the top */
|
|
|
|
IMAGE_BOXART_BOTTOM, /**< Boxart image from the bottom */
|
|
|
|
IMAGE_BOXART_LEFT, /**< Boxart image from the left side */
|
|
|
|
IMAGE_BOXART_RIGHT, /**< Boxart image from the right side */
|
|
|
|
IMAGE_GAMEPAK_FRONT, /**< GamePak image from the front */
|
|
|
|
IMAGE_GAMEPAK_BACK, /**< GamePak image from the back */
|
|
|
|
IMAGE_THUMBNAIL, /**< File image thumbnail */
|
|
|
|
IMAGE_TYPE_END /**< List end marker */
|
|
|
|
} file_image_type_t;
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a box component.
|
|
|
|
*
|
|
|
|
* @param x0 Starting x-coordinate.
|
|
|
|
* @param y0 Starting y-coordinate.
|
|
|
|
* @param x1 Ending x-coordinate.
|
|
|
|
* @param y1 Ending y-coordinate.
|
|
|
|
* @param color Color of the box.
|
|
|
|
*/
|
|
|
|
void component_box_draw(int x0, int y0, int x1, int y1, color_t color);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a border component.
|
|
|
|
*
|
|
|
|
* @param x0 Starting x-coordinate.
|
|
|
|
* @param y0 Starting y-coordinate.
|
|
|
|
* @param x1 Ending x-coordinate.
|
|
|
|
* @param y1 Ending y-coordinate.
|
|
|
|
*/
|
|
|
|
void component_border_draw(int x0, int y0, int x1, int y1);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw the layout component.
|
|
|
|
*/
|
|
|
|
void component_layout_draw(void);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a progress bar component.
|
|
|
|
*
|
|
|
|
* @param x0 Starting x-coordinate.
|
|
|
|
* @param y0 Starting y-coordinate.
|
|
|
|
* @param x1 Ending x-coordinate.
|
|
|
|
* @param y1 Ending y-coordinate.
|
|
|
|
* @param progress Progress value (0.0 to 1.0).
|
|
|
|
*/
|
|
|
|
void component_progressbar_draw(int x0, int y0, int x1, int y1, float progress);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a seek bar component.
|
|
|
|
*
|
|
|
|
* @param progress Progress value (0.0 to 1.0).
|
|
|
|
*/
|
|
|
|
void component_seekbar_draw(float progress);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a loader component.
|
|
|
|
*
|
|
|
|
* @param position Position value (0.0 to 1.0).
|
|
|
|
*/
|
|
|
|
void component_loader_draw(float position);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a scrollbar component.
|
|
|
|
*
|
|
|
|
* @param x Starting x-coordinate.
|
|
|
|
* @param y Starting y-coordinate.
|
|
|
|
* @param width Width of the scrollbar.
|
|
|
|
* @param height Height of the scrollbar.
|
|
|
|
* @param position Current position.
|
|
|
|
* @param items Total number of items.
|
|
|
|
* @param visible_items Number of visible items.
|
|
|
|
*/
|
|
|
|
void component_scrollbar_draw(int x, int y, int width, int height, int position, int items, int visible_items);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a list scrollbar component.
|
|
|
|
*
|
|
|
|
* @param position Current position.
|
|
|
|
* @param items Total number of items.
|
|
|
|
* @param visible_items Number of visible items.
|
|
|
|
*/
|
|
|
|
void component_list_scrollbar_draw(int position, int items, int visible_items);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a dialog component.
|
|
|
|
*
|
|
|
|
* @param width Width of the dialog.
|
|
|
|
* @param height Height of the dialog.
|
|
|
|
*/
|
|
|
|
void component_dialog_draw(int width, int height);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw a message box component.
|
|
|
|
*
|
|
|
|
* @param fmt Format string for the message.
|
|
|
|
* @param ... Additional arguments for the format string.
|
|
|
|
*/
|
|
|
|
void component_messagebox_draw(char *fmt, ...);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw the main text component.
|
|
|
|
*
|
|
|
|
* @param align Horizontal alignment.
|
|
|
|
* @param valign Vertical alignment.
|
|
|
|
* @param fmt Format string for the text.
|
|
|
|
* @param ... Additional arguments for the format string.
|
|
|
|
*/
|
|
|
|
void component_main_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Draw the actions bar text component.
|
|
|
|
*
|
|
|
|
* @param align Horizontal alignment.
|
|
|
|
* @param valign Vertical alignment.
|
|
|
|
* @param fmt Format string for the text.
|
|
|
|
* @param ... Additional arguments for the format string.
|
|
|
|
*/
|
|
|
|
void component_actions_bar_text_draw(rdpq_align_t align, rdpq_valign_t valign, char *fmt, ...);
|
Optimize boxart image load (#130)
<!--- Provide a general summary of your changes in the Title above -->
## Description
<!--- Describe your changes in detail -->
Improves boxart image loading by using directory file paths.
It also adds matching by full game ID's (for compatibility), but notes
in the readme that it is slow.
## Motivation and Context
<!--- What does this sample do? What problem does it solve? -->
<!--- If it fixes/closes/resolves an open issue, please link to the
issue here -->
Loading boxart was slow in certain circumstances.
## How Has This Been Tested?
<!-- (if applicable) -->
<!--- Please describe in detail how you tested your sample/changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
Locally on an SC64.
## Screenshots
<!-- (if appropriate): -->
## Types of changes
<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->
- [x] Improvement (non-breaking change that adds a new feature)
- [ ] Bug fix (fixes an issue)
- [ ] Breaking change (breaking change)
- [ ] Documentation Improvement
- [ ] Config and build (change in the configuration and build system,
has no impact on code or features)
## Checklist:
<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->
- [ ] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [ ] All new and existing tests passed.
<!--- It would be nice if you could sign off your contribution by
replacing the name with your GitHub user name and GitHub email contact.
-->
Signed-off-by: GITHUB_USER <GITHUB_USER_EMAIL>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
- **New Features**
- Introduced a new image type enumeration for boxart components,
enhancing image management.
- Updated boxart initialization to allow for specific image views,
improving flexibility in image retrieval.
- Enhanced instructions for setting up boxart images with clearer
directory structures and simplified naming conventions.
- **Bug Fixes**
- Improved the logic for loading boxart images, enabling better fallback
options in case of missing files.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2024-09-28 21:47:53 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Initialize the background component.
|
|
|
|
*
|
|
|
|
* @param cache_location Location of the cache.
|
|
|
|
*/
|
|
|
|
void component_background_init(char *cache_location);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
|
|
|
/**
|
2024-11-06 00:34:14 +01:00
|
|
|
* @brief Free the background component resources.
|
2023-08-03 17:18:55 +02:00
|
|
|
*/
|
2024-11-06 00:34:14 +01:00
|
|
|
void component_background_free(void);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Replace the background image.
|
|
|
|
*
|
|
|
|
* @param image New background image.
|
|
|
|
*/
|
|
|
|
void component_background_replace_image(surface_t *image);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw the background component.
|
|
|
|
*/
|
|
|
|
void component_background_draw(void);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Draw the file list component.
|
|
|
|
*
|
|
|
|
* @param list List of entries.
|
|
|
|
* @param entries Number of entries.
|
|
|
|
* @param selected Index of the selected entry.
|
|
|
|
*/
|
|
|
|
void component_file_list_draw(entry_t *list, int entries, int selected);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Context menu structure.
|
|
|
|
*/
|
2023-12-21 19:58:30 +01:00
|
|
|
typedef struct component_context_menu {
|
2024-11-06 00:34:14 +01:00
|
|
|
int row_count; /**< Number of rows in the context menu */
|
|
|
|
int row_selected; /**< Index of the selected row */
|
|
|
|
bool hide_pending; /**< Flag to indicate if hiding is pending */
|
|
|
|
struct component_context_menu *parent; /**< Pointer to the parent context menu */
|
|
|
|
struct component_context_menu *submenu; /**< Pointer to the submenu */
|
2023-08-20 14:11:17 +02:00
|
|
|
struct {
|
2024-11-06 00:34:14 +01:00
|
|
|
const char *text; /**< Text of the menu item */
|
|
|
|
void (*action)(menu_t *menu, void *arg); /**< Action function for the menu item */
|
|
|
|
void *arg; /**< Argument for the action function */
|
|
|
|
struct component_context_menu *submenu; /**< Pointer to the submenu */
|
|
|
|
} list[]; /**< List of menu items */
|
2023-08-20 14:11:17 +02:00
|
|
|
} component_context_menu_t;
|
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
#define COMPONENT_CONTEXT_MENU_LIST_END { .text = NULL } /**< End marker for the context menu list */
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Initialize the context menu component.
|
|
|
|
*
|
|
|
|
* @param cm Pointer to the context menu structure.
|
|
|
|
*/
|
|
|
|
void component_context_menu_init(component_context_menu_t *cm);
|
2023-08-20 14:11:17 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Show the context menu component.
|
|
|
|
*
|
|
|
|
* @param cm Pointer to the context menu structure.
|
|
|
|
*/
|
|
|
|
void component_context_menu_show(component_context_menu_t *cm);
|
2023-08-20 14:11:17 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Process the context menu component.
|
|
|
|
*
|
|
|
|
* @param menu Pointer to the menu structure.
|
|
|
|
* @param cm Pointer to the context menu structure.
|
|
|
|
* @return True if the context menu was processed, false otherwise.
|
|
|
|
*/
|
|
|
|
bool component_context_menu_process(menu_t *menu, component_context_menu_t *cm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Draw the context menu component.
|
|
|
|
*
|
|
|
|
* @param cm Pointer to the context menu structure.
|
|
|
|
*/
|
|
|
|
void component_context_menu_draw(component_context_menu_t *cm);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Box Art Structure.
|
|
|
|
*/
|
2023-08-03 17:18:55 +02:00
|
|
|
typedef struct {
|
2024-11-06 00:34:14 +01:00
|
|
|
bool loading; /**< Flag to indicate if the box art is loading */
|
|
|
|
surface_t *image; /**< Pointer to the box art image */
|
2023-08-03 17:18:55 +02:00
|
|
|
} component_boxart_t;
|
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Initialize the box art component.
|
|
|
|
*
|
|
|
|
* @param storage_prefix Prefix for the storage location.
|
|
|
|
* @param game_code Game code for the box art.
|
|
|
|
* @param current_image_view Current image view type.
|
|
|
|
* @return Pointer to the initialized box art component.
|
|
|
|
*/
|
|
|
|
component_boxart_t *component_boxart_init(const char *storage_prefix, char *game_code, file_image_type_t current_image_view);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/**
|
|
|
|
* @brief Free the box art component resources.
|
|
|
|
*
|
|
|
|
* @param b Pointer to the box art component.
|
|
|
|
*/
|
|
|
|
void component_boxart_free(component_boxart_t *b);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @brief Draw the box art component.
|
|
|
|
*
|
|
|
|
* @param b Pointer to the box art component.
|
|
|
|
*/
|
|
|
|
void component_boxart_draw(component_boxart_t *b);
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
/** @} */ /* menu_ui_components */
|
2023-08-03 17:18:55 +02:00
|
|
|
|
2024-11-06 00:34:14 +01:00
|
|
|
#endif /* COMPONENTS_H__ */
|