game/main.c

109 lines
2.8 KiB
C
Raw Normal View History

2025-11-23 18:21:50 +03:00
#include "axl.h"
2025-12-05 22:46:27 +03:00
#include "axl_io.h"
#include "axl_memory.h"
#include "axl_string.h"
2025-12-07 21:46:26 +03:00
#include "axl_rle.h"
#include "axl_memory.h"
2025-12-08 00:01:39 +03:00
#include "axl_types.h"
2025-12-04 16:52:03 +03:00
#include <windows.h>
2025-11-23 18:21:50 +03:00
2025-12-07 21:46:26 +03:00
2025-11-23 20:57:09 +03:00
int _start(void)
2025-11-23 18:21:50 +03:00
{
2025-12-04 16:52:03 +03:00
SetConsoleOutputCP(CP_UTF8);
2025-11-23 18:21:50 +03:00
axl_init();
2025-12-04 16:52:03 +03:00
axl_puts("Привет, мир!");
axl_puts("Hello, world!");
axl_puts("Bonjour le monde!");
axl_puts("Hola mundo!");
axl_puts("こんにちは世界!");
axl_puts("你好世界!");
axl_puts("안녕하세요 세계!");
axl_puts("สวัสดีชาวโลก!");
axl_puts("नमस्ते दुनिया!");
axl_puts("مرحبا بالعالم!");
2025-12-02 21:30:20 +03:00
void* fds = axl_malloc(83);
2025-11-23 20:57:09 +03:00
int* f = axl_malloc(sizeof(int));
2025-11-23 18:21:50 +03:00
*f = 4;
2025-11-27 20:42:39 +03:00
*(int*)(fds) = 4;
(void)axl_memcmp(f, fds, 4);
axl_free(fds);
axl_free(f);
2025-11-23 20:57:09 +03:00
(void)fds;
2025-11-23 18:21:50 +03:00
(void)f;
2025-12-05 22:46:27 +03:00
for(int i = 64532; i < 64533; ++i)
2025-12-05 20:52:24 +03:00
{
2025-12-05 22:46:27 +03:00
axl_puts("{");
for(int base = 2; base < 17; ++base)
{
i8 buff[32] = {'\0'};
//axl_memset(buff, '\0', 32);
2025-12-05 22:46:27 +03:00
i8 text[256] = {'\0'};
//axl_memset(text, '\0', 256);
2025-12-05 20:52:24 +03:00
2025-12-05 22:46:27 +03:00
axl_strcat(text, axl_itoa(i, buff, 10));
axl_strcat(text, "\tof base\t");
axl_strcat(text, axl_itoa(base, buff, 10));
axl_strcat(text, "\tis\t");
axl_strcat(text, axl_itoa(i, buff, base));
axl_puts(text);
}
axl_puts("}");
}
2025-12-05 20:52:24 +03:00
2025-12-07 21:46:26 +03:00
i8 original[] = "00000000022222255555554444444443333339999435999923";
i8 encoded[2*sizeof(original)] = {'\0'};
i8 decoded[sizeof(original)];
axl_puts(original);
u32 encoded_len = axl_rle_encode((u8*)original, sizeof(original),
(u8*)encoded, sizeof(encoded));
axl_puts(encoded);
axl_rle_decode((u8*)encoded, encoded_len, (u8*)decoded, sizeof(original));
axl_puts(decoded);
i8 orig_size_str[10] = {'\0'};
i8 enc_size_str[10] = {'\0'};
axl_utoa(sizeof(original), orig_size_str, 10);
axl_utoa(encoded_len, enc_size_str, 10);
i8 text_buff[255] = {'\0'};
axl_strcat(text_buff, "Original length: ");
axl_strcat(text_buff, orig_size_str);
axl_strcat(text_buff, "\nEncoded length: ");
axl_strcat(text_buff, enc_size_str);
axl_puts(text_buff);
2025-12-05 20:52:24 +03:00
2025-12-08 00:01:39 +03:00
axl_memset(text_buff, '\0', sizeof(text_buff));
axl_ftoa(666.32456f, text_buff, 2);
axl_puts(text_buff);
2025-12-05 22:46:27 +03:00
/*u32 new_len = 0;*/
/*u8 src[] = "Bonjour le monde!";*/
/*u32 src_len = axl_strlen((i8*)src);*/
/*for(u32 i = 0; i < src_len; i += 4)*/
/*{*/
/* u8 buff[AXL_VLQ_MAX_LEN + 1];*/
/**/
/* u32 encoded_l = axl_vlq_encode(*((u32*)(src + i)), buff);*/
/* new_len += encoded_l;*/
/**/
/* buff[encoded_l] = '\0'; */
/**/
/* axl_puts((i8*)buff);*/
/*}*/
/*(void)new_len;*/
2025-12-05 20:52:39 +03:00
2025-12-05 20:52:24 +03:00
2025-11-23 18:21:50 +03:00
return 0;
}