Added image UI element.
This commit is contained in:
@ -66,8 +66,10 @@
|
||||
|
||||
// User Interface Objects
|
||||
#include "ui/frame.h"
|
||||
#include "ui/image.h"
|
||||
#include "ui/label.h"
|
||||
#include "ui/menu.h"
|
||||
#include "ui/menulist.h"
|
||||
|
||||
// Utility Objects
|
||||
#include "util/array.h"
|
||||
|
@ -25,19 +25,22 @@
|
||||
#define FONT_FILL_MODE 1
|
||||
|
||||
/** Passed to STBTT for scaling the font, essentially the font resolution */
|
||||
#define FONT_TEXTURE_SIZE 64
|
||||
#define FONT_TEXTURE_SIZE 64.0f
|
||||
|
||||
/** The global scale, just used to provide fine control of font sizes */
|
||||
#define FONT_GLOBAL_SCALE 0.5f;
|
||||
|
||||
/** Default Font Size (on which all font scales are based) */
|
||||
#define FONT_SIZE_DEFAULT (FONT_TEXTURE_SIZE / 2)
|
||||
#define FONT_SIZE_DEFAULT 16.0f
|
||||
|
||||
// Chars
|
||||
#define FONT_NEWLINE '\n'
|
||||
#define FONT_SPACE ' '
|
||||
|
||||
// Heights
|
||||
#define FONT_LINE_HEIGHT FONT_TEXTURE_SIZE*0.75f
|
||||
#define FONT_INITIAL_LINE FONT_LINE_HEIGHT*0.75f
|
||||
#define FONT_SPACE_SIZE FONT_TEXTURE_SIZE*0.45f
|
||||
#define FONT_LINE_HEIGHT FONT_TEXTURE_SIZE * 0.75f
|
||||
#define FONT_INITIAL_LINE FONT_LINE_HEIGHT * 0.75f
|
||||
#define FONT_SPACE_SIZE FONT_TEXTURE_SIZE * 0.45f
|
||||
|
||||
/** Maximum number of characters a font text info can hold. */
|
||||
#define FONT_TEXT_INFO_CHARS_MAX 1024
|
||||
|
18
include/dawn/ui/image.h
Normal file
18
include/dawn/ui/image.h
Normal file
@ -0,0 +1,18 @@
|
||||
/**
|
||||
* 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;
|
||||
texture_t *texture;
|
||||
primitive_t quad;
|
||||
float u0, v0;
|
||||
float u1, v1;
|
||||
} image_t;
|
@ -7,6 +7,7 @@
|
||||
|
||||
#pragma once
|
||||
#include "../libs.h"
|
||||
#include "frame.h"
|
||||
#include "label.h"
|
||||
#include "menu.h"
|
||||
|
||||
@ -18,7 +19,7 @@ typedef struct {
|
||||
float x, y;
|
||||
char *items[MENULIST_ITEMS_MAX];
|
||||
label_t labels[MENULIST_ITEMS_MAX];
|
||||
frame_t frame;
|
||||
menu_t menu;
|
||||
uint8_t count;
|
||||
uint8_t selected;
|
||||
} menulist_t;
|
@ -15,7 +15,7 @@
|
||||
/** Amount of characters scrolled, per second */
|
||||
#define VN_TEXTBOX_SCROLL_SPEED 60
|
||||
|
||||
#define VN_TEXTBOX_FONT_SIZE 16.0
|
||||
#define VN_TEXTBOX_FONT_SIZE FONT_SIZE_DEFAULT
|
||||
|
||||
#define VN_TEXTBOX_STATE_CLOSED flagDefine(0)
|
||||
|
||||
|
Reference in New Issue
Block a user