2018-11-13 15:03:30 +01:00
|
|
|
/*
|
2019-04-08 04:00:49 +02:00
|
|
|
* Copyright (c) 2018-2019 Atmosphère-NX
|
2018-11-13 15:03:30 +01:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify it
|
|
|
|
* under the terms and conditions of the GNU General Public License,
|
|
|
|
* version 2, as published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope it will be useful, but WITHOUT
|
|
|
|
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
|
|
* more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
2019-06-18 01:41:03 +02:00
|
|
|
|
2018-11-13 15:03:30 +01:00
|
|
|
#pragma once
|
|
|
|
#include <cstdarg>
|
|
|
|
#include <switch.h>
|
|
|
|
#include <stratosphere.hpp>
|
|
|
|
|
|
|
|
#define RGB888_TO_RGB565(r, g, b) ((((r >> 3) << 11) & 0xF800) | (((g >> 2) << 5) & 0x7E0) | ((b >> 3) & 0x1F))
|
2018-11-13 22:28:05 +01:00
|
|
|
#define RGB565_GET_R8(c) ((((c >> 11) & 0x1F) << 3) | ((c >> 13) & 7))
|
|
|
|
#define RGB565_GET_G8(c) ((((c >> 5) & 0x3F) << 2) | ((c >> 9) & 3))
|
|
|
|
#define RGB565_GET_B8(c) ((((c >> 0) & 0x1F) << 3) | ((c >> 2) & 7))
|
2018-11-13 15:03:30 +01:00
|
|
|
|
2019-06-18 01:41:03 +02:00
|
|
|
class FontManager {
|
2018-11-13 15:03:30 +01:00
|
|
|
public:
|
|
|
|
static Result InitializeSharedFont();
|
|
|
|
static void ConfigureFontFramebuffer(u16 *fb, u32 (*unswizzle_func)(u32, u32));
|
|
|
|
|
|
|
|
static void SetFontColor(u16 color);
|
2018-11-13 22:11:41 +01:00
|
|
|
static void SetPosition(u32 x, u32 y);
|
2018-11-14 02:53:26 +01:00
|
|
|
static u32 GetX();
|
|
|
|
static u32 GetY();
|
2018-11-13 23:32:50 +01:00
|
|
|
static void SetFontSize(float fsz);
|
2018-11-13 22:28:05 +01:00
|
|
|
static void AddSpacingLines(float num_lines);
|
2018-11-13 22:11:41 +01:00
|
|
|
static void PrintLine(const char *str);
|
|
|
|
static void PrintFormatLine(const char *format, ...);
|
2018-11-14 02:53:26 +01:00
|
|
|
static void Print(const char *str);
|
|
|
|
static void PrintFormat(const char *format, ...);
|
2018-11-14 04:30:40 +01:00
|
|
|
static void PrintMonospaceU64(u64 x);
|
|
|
|
static void PrintMonospaceU32(u32 x);
|
2018-11-14 12:23:28 +01:00
|
|
|
static void PrintMonospaceBlank(u32 width);
|
2018-11-13 15:03:30 +01:00
|
|
|
};
|