mirror of
https://github.com/nicbarker/clay.git
synced 2025-09-18 12:36:17 +00:00
note about font sizes
This commit is contained in:
parent
6ea773d802
commit
749d1bb7de
|
@ -2,6 +2,9 @@
|
||||||
// The playdate screen is only 400x240 pixels and it can only display black and white, so some
|
// The playdate screen is only 400x240 pixels and it can only display black and white, so some
|
||||||
// fixed sizes and colours needed tweaking! The file menu was also removed as it does not really make
|
// fixed sizes and colours needed tweaking! The file menu was also removed as it does not really make
|
||||||
// sense when there is no pointer
|
// sense when there is no pointer
|
||||||
|
//
|
||||||
|
// The playdate console also does not support dynamic font sizes - fonts must be created at a specific size
|
||||||
|
// with the pdc tool. This example only uses the default system font.
|
||||||
#include "../../clay.h"
|
#include "../../clay.h"
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
@ -17,7 +20,6 @@ void RenderHeaderButton(Clay_String text) {
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(text, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 8,
|
|
||||||
.textColor = COLOR_WHITE
|
.textColor = COLOR_WHITE
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -97,7 +99,6 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(int selectedDocumentIndex) {
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(CLAY_STRING("File"), CLAY_TEXT_CONFIG({
|
CLAY_TEXT(CLAY_STRING("File"), CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 8,
|
|
||||||
.textColor = COLOR_WHITE
|
.textColor = COLOR_WHITE
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,6 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(int selectedDocumentIndex) {
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 10,
|
|
||||||
.textColor = COLOR_WHITE
|
.textColor = COLOR_WHITE
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -154,7 +154,6 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(int selectedDocumentIndex) {
|
||||||
}) {
|
}) {
|
||||||
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(document.title, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 10,
|
|
||||||
.textColor = COLOR_BLACK,
|
.textColor = COLOR_BLACK,
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
@ -176,12 +175,10 @@ Clay_RenderCommandArray ClayVideoDemo_CreateLayout(int selectedDocumentIndex) {
|
||||||
Document selectedDocument = documents.documents[selectedDocumentIndex];
|
Document selectedDocument = documents.documents[selectedDocumentIndex];
|
||||||
CLAY_TEXT(selectedDocument.title, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(selectedDocument.title, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 12,
|
|
||||||
.textColor = COLOR_BLACK
|
.textColor = COLOR_BLACK
|
||||||
}));
|
}));
|
||||||
CLAY_TEXT(selectedDocument.contents, CLAY_TEXT_CONFIG({
|
CLAY_TEXT(selectedDocument.contents, CLAY_TEXT_CONFIG({
|
||||||
.fontId = FONT_ID_BODY,
|
.fontId = FONT_ID_BODY,
|
||||||
.fontSize = 12,
|
|
||||||
.textColor = COLOR_BLACK
|
.textColor = COLOR_BLACK
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,7 +20,6 @@ struct TextUserData {
|
||||||
static struct TextUserData testUserData = {.font = NULL, .pd = NULL};
|
static struct TextUserData testUserData = {.font = NULL, .pd = NULL};
|
||||||
|
|
||||||
static Clay_Dimensions PlayDate_MeasureText(Clay_StringSlice text, Clay_TextElementConfig *config, void *userData) {
|
static Clay_Dimensions PlayDate_MeasureText(Clay_StringSlice text, Clay_TextElementConfig *config, void *userData) {
|
||||||
// TODO: playdate needs to load fonts at the given size, so need to do that before we can use different font sizes!
|
|
||||||
struct TextUserData *textUserData = userData;
|
struct TextUserData *textUserData = userData;
|
||||||
int width = textUserData->pd->graphics->getTextWidth(
|
int width = textUserData->pd->graphics->getTextWidth(
|
||||||
textUserData->font,
|
textUserData->font,
|
||||||
|
|
Loading…
Reference in a new issue