many things, cosmo build!
This commit is contained in:
+10
-10
@@ -2,30 +2,30 @@
|
||||
#include "../Common/cfg.h"
|
||||
#include "../Common/def.h"
|
||||
#include "../Common/gem.h"
|
||||
#include "../Common/std.h"
|
||||
#include "../Common/time.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#if COM_DEF_TARGET == COM_DEF_TARGET_WASM
|
||||
uint8_t plr_draw_buffer[COM_CFG_WIDTH * COM_CFG_HEIGHT * 4];
|
||||
static _Alignas(16) uint8_t plr_draw_buffer[COM_CFG_FBSIZE];
|
||||
|
||||
com_def_export_sym(
|
||||
"plr_draw_get_pixel_buffer") uint8_t *plr_draw_get_pixel_buffer(void) {
|
||||
return plr_draw_buffer;
|
||||
}
|
||||
#endif
|
||||
|
||||
com_def_export_sym("plr_draw_screen") void plr_draw_screen(
|
||||
uint8_t *pixel_buffer) {
|
||||
uint8_t *pixel_buffer_aligned = __builtin_assume_aligned(pixel_buffer, 16);
|
||||
for (int y = 0; y < COM_CFG_HEIGHT; y++) {
|
||||
for (int x = 0; x < COM_CFG_WIDTH; x++) {
|
||||
int pixel_index = (y * COM_CFG_WIDTH + x) * 4;
|
||||
int pixel_index = (y * COM_CFG_WIDTH + x) * COM_CFG_COLORS;
|
||||
|
||||
// Assuming standard Little-Endian 32-bit BGRA format
|
||||
pixel_buffer[pixel_index + 0] = (x) % 256; // Blue
|
||||
pixel_buffer[pixel_index + 1] = (y) % 256; // Green
|
||||
pixel_buffer[pixel_index + 2] = (x + y) % 256; // Red
|
||||
pixel_buffer[pixel_index + 3] = 255; // Alpha/Padding
|
||||
pixel_buffer_aligned[pixel_index + 0] = (x) % 256; // Blue
|
||||
pixel_buffer_aligned[pixel_index + 1] = (y) % 256; // Green
|
||||
pixel_buffer_aligned[pixel_index + 2] = (x + y) % 256; // Red
|
||||
#if COM_CFG_COLORS == 4
|
||||
pixel_buffer_aligned[pixel_index + 3] = 255; // Alpha/Padding
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ com_def_export_sym("plr_draw_screen") void plr_draw_screen(
|
||||
// com_std_printf("%i, %i\n", p2.a[0], p2.a[1]);
|
||||
// com_std_printf("%i, %i\n", p3.a[0], p3.a[1]);
|
||||
|
||||
uint8_t tex[32 * 32 * 3] = {0};
|
||||
uint8_t _Alignas(16) tex[32 * 32 * 3] = {0};
|
||||
for (int y = 0; y < 32; ++y) {
|
||||
for (int x = 0; x < 32; ++x) {
|
||||
// uint32_t idx = com_zord_order(x, y);
|
||||
|
||||
Reference in New Issue
Block a user