Memory functions

This commit is contained in:
2024-10-17 09:30:36 -07:00
parent 5fb36aad35
commit a74f285cb2
22 changed files with 225 additions and 63 deletions

View File

@ -7,13 +7,14 @@
#include "drawshape.h"
#include "assert/assert.h"
#include "util/memory.h"
void drawClear(
const char_t c,
const uint8_t color
) {
memset(FRAME_BUFFER, c, FRAME_HEIGHT * FRAME_WIDTH);
memset(FRAME_COLOR, color, FRAME_HEIGHT * FRAME_WIDTH);
memorySet(FRAME_BUFFER, c, FRAME_HEIGHT * FRAME_WIDTH);
memorySet(FRAME_COLOR, color, FRAME_HEIGHT * FRAME_WIDTH);
}
void drawBox(
@ -31,13 +32,13 @@ void drawBox(
assertTrue(y + height <= FRAME_HEIGHT, "Box is too tall.");
if(width == FRAME_WIDTH) {
memset(&FRAME_BUFFER[y * FRAME_WIDTH + x], c, height * width);
memset(&FRAME_COLOR[y * FRAME_WIDTH + x], color, height * width);
memorySet(&FRAME_BUFFER[y * FRAME_WIDTH + x], c, height * width);
memorySet(&FRAME_COLOR[y * FRAME_WIDTH + x], color, height * width);
return;
}
for(uint16_t iy = 0; iy < height; iy++) {
memset(&FRAME_BUFFER[(y + iy) * FRAME_WIDTH + x], c, width);
memset(&FRAME_COLOR[(y + iy) * FRAME_WIDTH + x], color, width);
memorySet(&FRAME_BUFFER[(y + iy) * FRAME_WIDTH + x], c, width);
memorySet(&FRAME_COLOR[(y + iy) * FRAME_WIDTH + x], color, width);
}
}

View File

@ -13,6 +13,7 @@
#include "ui/textbox.h"
#include "ui/testmenu.h"
#include "util/math.h"
#include "util/memory.h"
void drawUIBox(
const uint16_t x,
@ -218,8 +219,8 @@ void drawUITextbox() {
);
// Blinking cursor
memset(&FRAME_BUFFER[DRAW_UI_TEXTBOX_CURSOR_POS], ' ', 3);
memset(&FRAME_COLOR[DRAW_UI_TEXTBOX_CURSOR_POS], COLOR_WHITE, 3);
memorySet(&FRAME_BUFFER[DRAW_UI_TEXTBOX_CURSOR_POS], ' ', 3);
memorySet(&FRAME_COLOR[DRAW_UI_TEXTBOX_CURSOR_POS], COLOR_WHITE, 3);
if(TEXTBOX.textIndex < TEXTBOX.textLength) return;
int32_t blink = (int32_t)(TIME.time * DRAW_UI_TEXTBOX_BLINKS_PER_SECOND) % 2;