2016-02-13 17:29:56 +01:00
|
|
|
// Copyright 2013 Normmatt
|
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
|
|
|
#define BYTES_PER_PIXEL 3
|
|
|
|
#define SCREEN_HEIGHT 240
|
|
|
|
#define SCREEN_WIDTH_TOP 400
|
|
|
|
#define SCREEN_WIDTH_BOT 320
|
2016-07-18 03:15:04 +02:00
|
|
|
#ifdef FONT_6X10
|
|
|
|
#define FONT_WIDTH_EXT 6
|
|
|
|
#define FONT_HEIGHT_EXT 10
|
2016-10-31 14:12:08 +01:00
|
|
|
#elif defined FONT_GB // special font width
|
|
|
|
#define FONT_WIDTH_EXT 7
|
|
|
|
#define FONT_HEIGHT_EXT 6
|
2016-07-18 03:15:04 +02:00
|
|
|
#else
|
|
|
|
#define FONT_WIDTH_EXT 8
|
|
|
|
#define FONT_HEIGHT_EXT 8
|
|
|
|
#endif
|
2016-02-13 17:29:56 +01:00
|
|
|
|
2017-02-23 14:33:09 +01:00
|
|
|
#define RGB(r,g,b) ((r)<<24|(b)<<16|(g)<<8|(r))
|
2016-02-13 17:29:56 +01:00
|
|
|
|
|
|
|
#define COLOR_BLACK RGB(0x00, 0x00, 0x00)
|
|
|
|
#define COLOR_WHITE RGB(0xFF, 0xFF, 0xFF)
|
2016-02-27 19:58:41 +01:00
|
|
|
#define COLOR_GREY RGB(0x80, 0x80, 0x80)
|
|
|
|
|
|
|
|
#define COLOR_RED RGB(0xFF, 0x00, 0x00)
|
|
|
|
#define COLOR_GREEN RGB(0x00, 0xFF, 0x00)
|
2016-03-24 14:32:33 -04:00
|
|
|
#define COLOR_BLUE RGB(0x00, 0x00, 0xFF)
|
2016-02-27 19:58:41 +01:00
|
|
|
#define COLOR_YELLOW RGB(0xFF, 0xFF, 0x00)
|
|
|
|
#define COLOR_CYAN RGB(0xFF, 0x00, 0xFF)
|
2017-02-15 16:34:25 +01:00
|
|
|
#define COLOR_ORANGE RGB(0xFF, 0xA5, 0x00)
|
2016-02-27 19:58:41 +01:00
|
|
|
|
2016-03-01 02:00:48 +01:00
|
|
|
#define COLOR_BRIGHTRED RGB(0xFF, 0x30, 0x30)
|
2016-07-01 01:38:57 +02:00
|
|
|
#define COLOR_DARKRED RGB(0x80, 0x00, 0x00)
|
2016-03-01 02:00:48 +01:00
|
|
|
#define COLOR_BRIGHTYELLOW RGB(0xFF, 0xFF, 0x30)
|
|
|
|
#define COLOR_BRIGHTGREEN RGB(0x30, 0xFF, 0x30)
|
2016-05-29 14:45:12 +02:00
|
|
|
#define COLOR_BRIGHTBLUE RGB(0x30, 0x30, 0xFF)
|
2016-03-01 02:00:48 +01:00
|
|
|
|
2016-02-27 19:58:41 +01:00
|
|
|
#define COLOR_TINTEDBLUE RGB(0x60, 0x60, 0x80)
|
|
|
|
#define COLOR_TINTEDYELLOW RGB(0xD0, 0xD0, 0x60)
|
|
|
|
#define COLOR_TINTEDGREEN RGB(0x70, 0x80, 0x70)
|
2016-04-25 02:46:32 +02:00
|
|
|
#define COLOR_LIGHTGREY RGB(0xB0, 0xB0, 0xB0)
|
2016-02-29 02:09:31 +01:00
|
|
|
#define COLOR_DARKGREY RGB(0x50, 0x50, 0x50)
|
2016-04-08 21:03:40 +02:00
|
|
|
#define COLOR_DARKESTGREY RGB(0x20, 0x20, 0x20)
|
2016-02-27 19:58:41 +01:00
|
|
|
|
2016-02-13 17:29:56 +01:00
|
|
|
#define COLOR_TRANSPARENT RGB(0xFF, 0x00, 0xEF) // otherwise known as 'super fuchsia'
|
|
|
|
|
2016-02-27 19:58:41 +01:00
|
|
|
#define COLOR_STD_BG COLOR_BLACK
|
|
|
|
#define COLOR_STD_FONT COLOR_WHITE
|
|
|
|
|
2017-02-23 14:33:09 +01:00
|
|
|
#define TOP_SCREEN (u8*)(*(u32*)0x23FFFE00)
|
|
|
|
#define BOT_SCREEN (u8*)(*(u32*)0x23FFFE08)
|
2016-02-13 17:29:56 +01:00
|
|
|
|
2017-05-19 02:40:57 +02:00
|
|
|
#ifdef SWITCH_SCREENS
|
2017-04-24 21:48:21 +02:00
|
|
|
#define MAIN_SCREEN TOP_SCREEN
|
|
|
|
#define ALT_SCREEN BOT_SCREEN
|
|
|
|
#define SCREEN_WIDTH_MAIN SCREEN_WIDTH_TOP
|
|
|
|
#define SCREEN_WIDTH_ALT SCREEN_WIDTH_BOT
|
|
|
|
#else
|
|
|
|
#define MAIN_SCREEN BOT_SCREEN
|
|
|
|
#define ALT_SCREEN TOP_SCREEN
|
|
|
|
#define SCREEN_WIDTH_MAIN SCREEN_WIDTH_BOT
|
|
|
|
#define SCREEN_WIDTH_ALT SCREEN_WIDTH_TOP
|
|
|
|
#endif
|
|
|
|
|
2016-05-18 23:46:22 +02:00
|
|
|
void ClearScreen(unsigned char *screen, int color);
|
2017-04-24 21:48:21 +02:00
|
|
|
void ClearScreenF(bool clear_main, bool clear_alt, int color);
|
2016-02-27 19:58:41 +01:00
|
|
|
void DrawRectangle(u8* screen, int x, int y, int width, int height, int color);
|
2017-03-29 02:23:06 +02:00
|
|
|
void DrawBitmap(u8* screen, int x, int y, int w, int h, u8* bitmap);
|
2016-02-13 17:29:56 +01:00
|
|
|
|
|
|
|
void DrawCharacter(unsigned char *screen, int character, int x, int y, int color, int bgcolor);
|
|
|
|
void DrawString(unsigned char *screen, const char *str, int x, int y, int color, int bgcolor);
|
2016-05-18 23:46:22 +02:00
|
|
|
void DrawStringF(unsigned char *screen, int x, int y, int color, int bgcolor, const char *format, ...);
|
2016-02-13 17:29:56 +01:00
|
|
|
|
2016-02-27 19:58:41 +01:00
|
|
|
u32 GetDrawStringHeight(const char* str);
|
2017-03-09 14:35:36 +01:00
|
|
|
u32 GetDrawStringWidth(const char* str);
|
2016-02-27 19:58:41 +01:00
|
|
|
|
2017-03-29 02:23:06 +02:00
|
|
|
void WordWrapString(char* str, int llen);
|
2016-02-27 19:58:41 +01:00
|
|
|
void ResizeString(char* dest, const char* orig, int nsize, int tpos, bool align_right);
|
|
|
|
void TruncateString(char* dest, const char* orig, int nsize, int tpos);
|
2016-04-05 21:13:23 +02:00
|
|
|
void FormatNumber(char* str, u64 number);
|
2016-02-27 19:58:41 +01:00
|
|
|
void FormatBytes(char* str, u64 bytes);
|
|
|
|
|
2016-06-10 16:21:25 +02:00
|
|
|
void ShowString(const char *format, ...);
|
2017-03-29 02:23:06 +02:00
|
|
|
void ShowIconString(u8* icon, int w, int h, const char *format, ...);
|
2016-02-27 19:58:41 +01:00
|
|
|
bool ShowPrompt(bool ask, const char *format, ...);
|
2016-03-01 02:00:48 +01:00
|
|
|
bool ShowUnlockSequence(u32 seqlvl, const char *format, ...);
|
2016-04-25 02:46:32 +02:00
|
|
|
u32 ShowSelectPrompt(u32 n, const char** options, const char *format, ...);
|
2016-06-13 23:51:41 +02:00
|
|
|
bool ShowStringPrompt(char* inputstr, u32 max_size, const char *format, ...);
|
|
|
|
u64 ShowHexPrompt(u64 start_val, u32 n_digits, const char *format, ...);
|
2016-07-13 19:59:36 +02:00
|
|
|
u64 ShowNumberPrompt(u64 start_val, const char *format, ...);
|
2016-07-12 18:15:45 +02:00
|
|
|
bool ShowDataPrompt(u8* data, u32* size, const char *format, ...);
|
2016-03-02 17:22:44 +01:00
|
|
|
bool ShowProgress(u64 current, u64 total, const char* opstr);
|