Added selection rectangle.

This commit is contained in:
2021-09-02 10:30:25 -07:00
parent c2aea93766
commit cc79313183
7 changed files with 100 additions and 5 deletions

View File

@ -70,6 +70,7 @@
#include "ui/label.h"
#include "ui/menu.h"
#include "ui/menulist.h"
#include "ui/rectangle.h"
// Utility Objects
#include "util/array.h"

View File

@ -10,6 +10,10 @@
#include "frame.h"
#include "label.h"
#include "menu.h"
#include "rectangle.h"
/** Color of the menulist selection rectangle */
#define MENULIST_SELECTION_COLOR ((pixel_t){ .r=255, .g=255, .b=255, .a=150 })
/** Maximum number of items that the list supports */
#define MENULIST_ITEMS_MAX 32
@ -21,5 +25,6 @@ typedef struct {
label_t labels[MENULIST_ITEMS_MAX];
frame_t frame;
menu_t menu;
rectangle_t selection;
uint8_t count;
} menulist_t;

View File

@ -0,0 +1,17 @@
/**
* Copyright (c) 2021 Dominic Masters
*
* This software is released under the MIT License.
* https://opensource.org/licenses/MIT
*/
#pragma once
#include "../libs.h"
#include "../display/primitive.h"
typedef struct {
float x, y;
float width, height;
texture_t texture;
primitive_t quad;
} rectangle_t;