commit 4efb424ed9ca97a3beae79b0de6d509f46e91d9f
Author: Jon Bell <jondbell@protonmail.com>
AuthorDate: Wed Apr 8 07:46:25 2020 -0600
Commit: Jon Bell <jondbell@protonmail.com>
CommitDate: Wed Apr 8 07:46:25 2020 -0600
use memset to clear screen
---
source/graphics.c | 20 ++++----------------
source/main.c | 7 +++----
2 files changed, 7 insertions(+), 20 deletions(-)
diff --git a/source/graphics.c b/source/graphics.c
index 6c94325..d0c1ff2 100644
--- a/source/graphics.c
+++ b/source/graphics.c
@@ -2,6 +2,7 @@
#include <3ds.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include "graphics.h"
@@ -43,22 +44,9 @@ const Color PaletteColors[] = {
uint16_t _pico8_fb[128*128];
void clearscreen(u8* fb, int time) {
- int x, y;
- for(x = 0; x < 400; x++) {
- for(y = 0; y < 240; y++) {
- if (x < 128 && y < 128) {
- fb[((x*240)+ (239 - y))*3+0] = 0;
- fb[((x*240)+ (239 - y))*3+1] = 0;
- fb[((x*240)+ (239 - y))*3+2] = 0;
- }
- else {
- //gray
- fb[((x*240)+ (239 - y))*3+0] = BgGray.Red;
- fb[((x*240)+ (239 - y))*3+1] = BgGray.Green;
- fb[((x*240)+ (239 - y))*3+2] = BgGray.Blue;
- }
- }
- }
+
+ memset(fb, BgGray.Red, 240*400*3);
+
}
void rect(char x, char y, char x1, char y1, uint16_t col) {
diff --git a/source/main.c b/source/main.c
index 5f3e264..d428c92 100644
--- a/source/main.c
+++ b/source/main.c
@@ -34,14 +34,13 @@ int main(int argc, char **argv)
gfxFlushBuffers();
gfxSwapBuffers();
+ _update();
+
u8* fb = gfxGetFramebuffer(GFX_TOP, GFX_LEFT, NULL, NULL);
- //clear framebuffer
- memset(fb, 0, 240*400*3);
-
clearscreen(fb, frames);
- draw();
+ _draw();
flipBuffer(fb);