android build

This commit is contained in:
Nikola Petrov 2025-02-10 13:31:54 +01:00
parent 65faf0230b
commit e020784f4f
11 changed files with 9 additions and 24 deletions

View File

@ -1,4 +1,4 @@
#include <stdio.h> #include <cstdio>
#include <unistd.h> #include <unistd.h>
#include "sys.hpp" #include "sys.hpp"
#include <raylib.h> #include <raylib.h>
@ -25,7 +25,7 @@ namespace sys
const char *saveFilePath = transformFilePath(filename); const char *saveFilePath = transformFilePath(filename);
FILE *file = fopen(saveFilePath, "wb"); FILE *file = fopen(saveFilePath, "wb");
if (file == NULL) if (file == nullptr)
return false; return false;
size_t ret = fwrite(data, 1, size, file); size_t ret = fwrite(data, 1, size, file);
@ -39,7 +39,7 @@ namespace sys
const char *saveFilePath = transformFilePath(filename); const char *saveFilePath = transformFilePath(filename);
FILE *file = fopen(saveFilePath, "rb"); FILE *file = fopen(saveFilePath, "rb");
if (file == NULL) if (file == nullptr)
return false; return false;
size_t ret = fread(data, 1, size, file); size_t ret = fread(data, 1, size, file);

View File

@ -2,8 +2,6 @@
#include <netinet/in.h> #include <netinet/in.h>
#include <cinttypes> #include <cinttypes>
#define AS_DEFAULT_BUFFER_SIZE 0x1000 /*4096 bytes*/
constexpr int64_t StartHeader = 1737720524UL; constexpr int64_t StartHeader = 1737720524UL;
constexpr uint16_t serverPort = 9000; constexpr uint16_t serverPort = 9000;
constexpr uint16_t keyPort = 9010; constexpr uint16_t keyPort = 9010;

View File

@ -28,7 +28,6 @@ private:
Dna *m_dna; Dna *m_dna;
uint128 branchSeed; uint128 branchSeed;
int canvasSize = 0;
Vector2 start = {0}; Vector2 start = {0};
std::list<DrawArgs> drawCalls; std::list<DrawArgs> drawCalls;

View File

@ -1,4 +1,4 @@
#include <inttypes.h> #include <cinttypes>
struct uint128 struct uint128
{ {

View File

@ -40,7 +40,7 @@ namespace TcpSocket
char ip[INET_ADDRSTRLEN]; char ip[INET_ADDRSTRLEN];
inet_ntop(AF_INET, &(address.sin_addr), ip, INET_ADDRSTRLEN); inet_ntop(AF_INET, &(address.sin_addr), ip, INET_ADDRSTRLEN);
return std::string(ip); return {ip};
} }
int remotePort(sockaddr_in &address) { return ntohs(address.sin_port); } int remotePort(sockaddr_in &address) { return ntohs(address.sin_port); }

View File

@ -14,12 +14,6 @@ constexpr static float moonXOffset = 0.1f;
constexpr static float minSizeOfMoon = 0.1f; constexpr static float minSizeOfMoon = 0.1f;
constexpr static float maxSizeOfMoon = 0.15f; constexpr static float maxSizeOfMoon = 0.15f;
constexpr static float maxYPosOfMoon = 0.80f; constexpr static float maxYPosOfMoon = 0.80f;
constexpr static float bigRingRatio = 0.5f;
constexpr static float smallRingRatio = 0.25f;
constexpr static float bigRingBlend = 0.02f;
constexpr static float smallRingBlend = 0.05f;
constexpr static float colorRatio1 = 0.3f;
constexpr static float colorRatio2 = 0.7f;
constexpr static float mounten1min = 0.65f; constexpr static float mounten1min = 0.65f;
constexpr static float mounten1max = 0.85f; constexpr static float mounten1max = 0.85f;
constexpr static float mounten2min = 0.80f; constexpr static float mounten2min = 0.80f;

View File

@ -16,9 +16,9 @@ int Circle::colorLoc;
void Circle::init() void Circle::init()
{ {
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB) #if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
shader = LoadShaderFromMemory(0, sun_shader_100); shader = LoadShaderFromMemory(nullptr, sun_shader_100);
#else #else
shader = LoadShaderFromMemory(0, (const char *)shaders_sun_330_fs); shader = LoadShaderFromMemory(nullptr, (const char *)shaders_sun_330_fs);
#endif #endif
target = LoadRenderTexture(sizeTexute, sizeTexute); target = LoadRenderTexture(sizeTexute, sizeTexute);

View File

@ -38,7 +38,6 @@ void calculateLevels(int canvasSize)
// Public // Public
void Tree::init(int size) void Tree::init(int size)
{ {
this->canvasSize = size;
start.x = size / 2; start.x = size / 2;
start.y = size; start.y = size;
calculateLevels(size); calculateLevels(size);

View File

@ -13,7 +13,6 @@ namespace DNA
{ {
array[i] = mrand::getValue(256, state); array[i] = mrand::getValue(256, state);
} }
return;
} }
void makeChild(Dna *p1, Dna *p2, Dna *c, uint128 *state) void makeChild(Dna *p1, Dna *p2, Dna *c, uint128 *state)
@ -38,8 +37,8 @@ namespace DNA
void clone(Dna *p1, Dna *c, uint128 *state) void clone(Dna *p1, Dna *c, uint128 *state)
{ {
uint8_t *p1a = (uint8_t *)p1; uint8_t *p1a = (uint8_t *)p1;
uint8_t *ca = (uint8_t *)c; uint8_t *ca = (uint8_t *)c;
for (size_t i = 0; i < sizeof(Dna); i++) for (size_t i = 0; i < sizeof(Dna); i++)
{ {
int val = mrand::getValue(2, state); int val = mrand::getValue(2, state);

View File

@ -56,7 +56,7 @@ void DnaManager::newGen(DnaManagerData *data)
data->queued = 0; data->queued = 0;
data->showed = 0; data->showed = 0;
data->generation += 1; data->generation += 1;
if (data->liked.size() == 0) if (data->liked.empty())
{ {
for (std::size_t i = 0; i < NUM_PER_GEN; i++) for (std::size_t i = 0; i < NUM_PER_GEN; i++)
{ {

View File

@ -1,10 +1,6 @@
#include "values/Similarity.hpp" #include "values/Similarity.hpp"
#include <cmath> #include <cmath>
#define MATCH 1
#define MISMATCH -1
#define GAP -2
namespace Similarity namespace Similarity
{ {
// todo: use int8_t insted of uint8_t and map data // todo: use int8_t insted of uint8_t and map data