Compare commits
13 Commits
e020784f4f
...
main
Author | SHA1 | Date | |
---|---|---|---|
5f6305a2f2 | |||
dddf8ca632 | |||
0dedb2d6b9 | |||
d41f11a333 | |||
53c333d46d | |||
30980423eb | |||
31e8f302ac | |||
1516ad63cb | |||
4fa74d0cfb | |||
64364bfefd | |||
2cd8ef5558 | |||
266d250881 | |||
1994e7ccb1 |
@@ -26,7 +26,6 @@ add_executable(app
|
||||
shared/src/canvas/BackGround.cpp
|
||||
shared/src/canvas/BackGroundColors.cpp
|
||||
shared/src/canvas/Canvas.cpp
|
||||
shared/src/canvas/Circle.cpp
|
||||
shared/src/canvas/Tree.cpp
|
||||
shared/src/values/Dna.cpp
|
||||
shared/src/values/DnaManager.cpp
|
||||
@@ -56,7 +55,6 @@ add_executable(view
|
||||
shared/src/canvas/BackGround.cpp
|
||||
shared/src/canvas/BackGroundColors.cpp
|
||||
shared/src/canvas/Canvas.cpp
|
||||
shared/src/canvas/Circle.cpp
|
||||
shared/src/canvas/Tree.cpp
|
||||
shared/src/values/Dna.cpp
|
||||
shared/src/values/DnaManager.cpp
|
||||
|
14
Readme.md
14
Readme.md
@@ -1,10 +1,3 @@
|
||||
# how to build
|
||||
```
|
||||
g++ build.cpp -o build
|
||||
./build
|
||||
or
|
||||
./build run
|
||||
```
|
||||
|
||||
# Code style
|
||||
|
||||
@@ -31,10 +24,3 @@ or
|
||||
- Std
|
||||
- local ( form inc dir )
|
||||
- external raylib
|
||||
|
||||
|
||||
## Generate shader .h files
|
||||
```
|
||||
xxd -i shaders/sun_100.fs > inc/sunShader.hpp
|
||||
xxd -i shaders/sun_330.fs >> inc/sunShader.hpp
|
||||
```
|
@@ -42,4 +42,6 @@ private:
|
||||
Rectangle genTextBox;
|
||||
Rectangle simTextBox;
|
||||
float simil = 100.0f;
|
||||
|
||||
Color appColor = BLUE;
|
||||
};
|
||||
|
@@ -7,4 +7,5 @@ namespace DnaStore
|
||||
void saveVec(DnaManagerData *data);
|
||||
void saveGen(DnaManagerData *data);
|
||||
void sync();
|
||||
bool ping();
|
||||
} // namespace DnaStore
|
||||
|
@@ -74,7 +74,7 @@ void App::init(int screenWidth, int screenHeight)
|
||||
}
|
||||
|
||||
DnaStore::load(&manager);
|
||||
simil = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
simil = Similarity::calc_similarity(manager.vector);
|
||||
upTex(Liked::tbd);
|
||||
while (!canvas.tick(canvasTexure[TOP]))
|
||||
{
|
||||
@@ -114,6 +114,10 @@ void App::init(int screenWidth, int screenHeight)
|
||||
float recPosX = screenWidth * 0.3f;
|
||||
disLikeBox = {0, posY, (float)recPosX, (float)screenWidth};
|
||||
likeBox = {screenWidth - recPosX, posY, (float)recPosX, (float)screenWidth};
|
||||
|
||||
if(!DnaStore::ping()){
|
||||
appColor = RED;
|
||||
}
|
||||
}
|
||||
|
||||
void App::upTex(Liked liked)
|
||||
@@ -128,7 +132,7 @@ void App::upTex(Liked liked)
|
||||
DnaStore::saveGen(&manager);
|
||||
DnaManager::newGen(&manager);
|
||||
DnaStore::saveVec(&manager);
|
||||
simil = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
simil = Similarity::calc_similarity(manager.vector);
|
||||
}
|
||||
DnaStore::saveData(&manager);
|
||||
}
|
||||
@@ -141,7 +145,7 @@ void App::upTex(Liked liked)
|
||||
|
||||
BeginTextureMode(canvasTexure[TOP]);
|
||||
ClearBackground(BLACK);
|
||||
DrawText("NEXT GEN", 10, 10, 20, WHITE);
|
||||
DrawText("NEXT GEN", 10, 10, screenWidth/10, WHITE);
|
||||
EndTextureMode();
|
||||
}
|
||||
|
||||
@@ -202,7 +206,7 @@ void App::update()
|
||||
|
||||
void App::draw()
|
||||
{
|
||||
ClearBackground(BLUE);
|
||||
ClearBackground(appColor);
|
||||
|
||||
Rectangle source = {0, 0, (float)screenWidth, (float)-screenWidth};
|
||||
Vector2 origin = {0.0f, 0.0f};
|
||||
|
@@ -16,6 +16,7 @@
|
||||
#define DATA_FILE_NAME "DATA.bin"
|
||||
#define VECTOR_FILE_NAME "VECTOR.bin"
|
||||
#define GEN_FILE_PATTRN "gen/%04d.bin"
|
||||
#define HOST_NAME "petrovv.com"
|
||||
|
||||
void DnaStore::load(DnaManagerData *data)
|
||||
{
|
||||
@@ -149,24 +150,38 @@ void DnaStore::saveGen(DnaManagerData *data)
|
||||
sync();
|
||||
}
|
||||
|
||||
void client(std::string prefix);
|
||||
void client(std::string_view prefix);
|
||||
|
||||
void DnaStore::sync()
|
||||
{
|
||||
const char *prefix = sys::transformFilePath("");
|
||||
std::string prefixs = prefix;
|
||||
std::string_view prefixs = prefix;
|
||||
|
||||
std::thread t(client, prefixs);
|
||||
t.detach();
|
||||
}
|
||||
|
||||
void client(std::string prefix)
|
||||
bool DnaStore::ping(){
|
||||
int sock = TcpSocket::connectt(HOST_NAME, keyPort);
|
||||
if (sock < 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
int64_t header = 0;
|
||||
TcpSocket::recvt(sock, &header, sizeof(header));
|
||||
TcpSocket::closet(sock);
|
||||
|
||||
return header == StartHeader;
|
||||
}
|
||||
|
||||
void client(std::string_view prefix)
|
||||
{
|
||||
constexpr int extra_buff = 22; // len of 2**31 -> 2147483648 plus the pattern size
|
||||
std::string buffer;
|
||||
buffer.resize(prefix.size() + extra_buff);
|
||||
|
||||
int sock = TcpSocket::connectt("petrovv.com", keyPort);
|
||||
int sock = TcpSocket::connectt(HOST_NAME, keyPort);
|
||||
if (sock < 0)
|
||||
{
|
||||
return;
|
||||
@@ -177,7 +192,7 @@ void client(std::string prefix)
|
||||
|
||||
TcpSocket::closet(sock);
|
||||
|
||||
sock = TcpSocket::connectt("petrovv.com", serverPort);
|
||||
sock = TcpSocket::connectt(HOST_NAME, serverPort);
|
||||
|
||||
if (sock < 0)
|
||||
{
|
||||
@@ -185,7 +200,7 @@ void client(std::string prefix)
|
||||
}
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
int ret = sprintf(buffer.data(), "%s/" ID_FILE_NAME, prefix.c_str());
|
||||
int ret = sprintf(buffer.data(), "%s/" ID_FILE_NAME, prefix.data());
|
||||
#else
|
||||
int ret = sprintf(buffer.data(), ID_FILE_NAME);
|
||||
#endif
|
||||
@@ -220,7 +235,7 @@ void client(std::string prefix)
|
||||
needed_gen = message.data;
|
||||
|
||||
#if defined(PLATFORM_ANDROID)
|
||||
int ret = sprintf(buffer.data(), "%s/" GEN_FILE_PATTRN, prefix.c_str(), needed_gen);
|
||||
int ret = sprintf(buffer.data(), "%s/" GEN_FILE_PATTRN, prefix.data(), needed_gen);
|
||||
#else
|
||||
int ret = sprintf(buffer.data(), GEN_FILE_PATTRN, needed_gen);
|
||||
#endif
|
||||
|
77
random/build_sytem/build.cpp
Normal file
77
random/build_sytem/build.cpp
Normal file
@@ -0,0 +1,77 @@
|
||||
|
||||
#define EXT_LINK
|
||||
#define EXT_INC
|
||||
#include "build.hpp"
|
||||
#include <unordered_set>
|
||||
|
||||
std::vector<std::string> LINK = {"raylib/lib/libraylib.a"};
|
||||
|
||||
std::vector<std::string> RAYINCLUDE = {"-Iraylib/include"};
|
||||
std::filesystem::path RAYLIB_DIR = "raylib";
|
||||
|
||||
bool build = false;
|
||||
bool clear = false;
|
||||
bool run = false;
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
if (rebuild_my_self(__FILE__, argc, argv))
|
||||
return 0;
|
||||
|
||||
for (int i = 1; i < argc; ++i)
|
||||
{
|
||||
if (!std::strcmp(argv[i], "opt"))
|
||||
opt_flags = "-O3";
|
||||
|
||||
if (!std::strcmp(argv[i], "build"))
|
||||
build = true;
|
||||
|
||||
if (!std::strcmp(argv[i], "run"))
|
||||
run = true;
|
||||
|
||||
if (!std::strcmp(argv[i], "clear"))
|
||||
{
|
||||
clear_all_build();
|
||||
clear = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (clear && !build)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!std::filesystem::is_directory(RAYLIB_DIR))
|
||||
{
|
||||
command = {"wget", "https://github.com/raysan5/raylib/releases/download/5.5/raylib-5.5_linux_amd64.tar.gz"};
|
||||
run_command(command);
|
||||
command = {"tar", "-xzvf", "raylib-5.5_linux_amd64.tar.gz"};
|
||||
run_command(command);
|
||||
std::filesystem::rename("raylib-5.5_linux_amd64", "raylib");
|
||||
std::filesystem::remove_all("raylib-5.5_linux_amd64.tar.gz");
|
||||
}
|
||||
|
||||
if (!std::filesystem::is_directory(RAYLIB_DIR))
|
||||
return 0;
|
||||
|
||||
std::filesystem::create_directory(OBJ_DIR);
|
||||
|
||||
int res = compile_src_dir(RAYINCLUDE);
|
||||
switch (res)
|
||||
{
|
||||
case 1:
|
||||
compile_obj_dir(LINK);
|
||||
break;
|
||||
case -1:
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!std::filesystem::exists(BUILD_FILE))
|
||||
compile_obj_dir(LINK);
|
||||
|
||||
if (run)
|
||||
{
|
||||
run_main();
|
||||
}
|
||||
return 0;
|
||||
}
|
408
random/build_sytem/build.hpp
Normal file
408
random/build_sytem/build.hpp
Normal file
@@ -0,0 +1,408 @@
|
||||
#include <cstdio>
|
||||
#include <cstring>
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <filesystem>
|
||||
#include <fstream>
|
||||
#include <unordered_set>
|
||||
|
||||
// #define EXT_ARGS
|
||||
// #define EXT_LINK
|
||||
// #define EXT_INC
|
||||
// #define EXT_OBJ
|
||||
// #define Werror
|
||||
// #define Wextra
|
||||
|
||||
std::filesystem::path OBJ_DIR = "obj";
|
||||
std::filesystem::path INC_DIR = "inc";
|
||||
std::filesystem::path SRC_DIR = "src";
|
||||
|
||||
#ifdef _WIN32
|
||||
std::filesystem::path BUILD_FILE = "main.exe";
|
||||
std::string cpp_compiler = "zig c++";
|
||||
std::string c_compiler = "zig cc";
|
||||
#else
|
||||
std::filesystem::path BUILD_FILE = "main";
|
||||
std::string cpp_compiler = "g++";
|
||||
std::string c_compiler = "gcc";
|
||||
#endif
|
||||
|
||||
std::string opt_flags = "-ggdb";
|
||||
std::vector<std::string> command;
|
||||
|
||||
enum class Color
|
||||
{
|
||||
black,
|
||||
red,
|
||||
green,
|
||||
yellow,
|
||||
blue,
|
||||
purple,
|
||||
cyan,
|
||||
white,
|
||||
reset,
|
||||
};
|
||||
|
||||
void pick_color(Color color)
|
||||
{
|
||||
switch (color)
|
||||
{
|
||||
case Color::black:
|
||||
printf("\033[0;30m");
|
||||
break;
|
||||
case Color::red:
|
||||
printf("\033[0;31m");
|
||||
break;
|
||||
case Color::green:
|
||||
printf("\033[0;32m");
|
||||
break;
|
||||
case Color::yellow:
|
||||
printf("\033[0;33m");
|
||||
break;
|
||||
case Color::blue:
|
||||
printf("\033[0;34m");
|
||||
break;
|
||||
case Color::purple:
|
||||
printf("\033[0;35m");
|
||||
break;
|
||||
case Color::cyan:
|
||||
printf("\033[0;36m");
|
||||
break;
|
||||
case Color::white:
|
||||
printf("\033[0;37m");
|
||||
break;
|
||||
case Color::reset:
|
||||
printf("\033[0m");
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void print_command(std::vector<std::string> &arguments)
|
||||
{
|
||||
pick_color(Color::cyan);
|
||||
for (auto &&i : arguments)
|
||||
{
|
||||
printf("%s ", i.c_str());
|
||||
}
|
||||
pick_color(Color::white);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
bool run_command(std::vector<std::string> &arguments)
|
||||
{
|
||||
print_command(arguments);
|
||||
std::string command = "";
|
||||
|
||||
for (auto &&i : arguments)
|
||||
{
|
||||
command += " " + i;
|
||||
}
|
||||
|
||||
return std::system(command.c_str()) == 0;
|
||||
}
|
||||
|
||||
bool check_if_rebuild(const std::filesystem::path &org_path, const std::filesystem::path &new_path)
|
||||
{
|
||||
if (!std::filesystem::exists(org_path))
|
||||
return false;
|
||||
|
||||
if (!std::filesystem::exists(new_path))
|
||||
return true;
|
||||
|
||||
auto file_time_one = std::filesystem::last_write_time(org_path);
|
||||
auto file_time_two = std::filesystem::last_write_time(new_path);
|
||||
return file_time_one > file_time_two;
|
||||
}
|
||||
|
||||
bool try_remove(std::filesystem::path path)
|
||||
{
|
||||
try
|
||||
{
|
||||
std::filesystem::remove(path);
|
||||
return true;
|
||||
}
|
||||
catch (const std::exception &e)
|
||||
{
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool rebuild_my_self(std::filesystem::path src_path, int argc, const char **exec_path)
|
||||
{
|
||||
std::filesystem::path exec = exec_path[0];
|
||||
|
||||
try_remove("old_build");
|
||||
|
||||
if (!check_if_rebuild(src_path, exec) && !check_if_rebuild(__FILE__, exec))
|
||||
return false;
|
||||
|
||||
std::filesystem::rename(exec, "old_build");
|
||||
|
||||
std::vector<std::string> input;
|
||||
|
||||
for (int i = 0; i < argc; ++i)
|
||||
input.push_back(exec_path[i]);
|
||||
|
||||
std::vector<std::string> comand = {cpp_compiler, src_path.string(), "-o", exec_path[0], "-ggdb"};
|
||||
if (!run_command(comand))
|
||||
return false;
|
||||
|
||||
printf("rebuild\n");
|
||||
|
||||
if (!run_command(input))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
struct all_in_directory
|
||||
{
|
||||
std::vector<std::filesystem::path> files;
|
||||
std::vector<std::filesystem::path> dirs;
|
||||
};
|
||||
|
||||
all_in_directory get_all_files_in_dir(std::filesystem::path directory_path)
|
||||
{
|
||||
namespace fs = std::filesystem;
|
||||
|
||||
all_in_directory dir;
|
||||
if (!fs::is_directory(directory_path))
|
||||
return dir;
|
||||
|
||||
std::list<fs::path> dirs;
|
||||
dirs.push_back(directory_path);
|
||||
dir.dirs.push_back(directory_path);
|
||||
|
||||
while (!dirs.empty())
|
||||
{
|
||||
for (const auto &entry : fs::directory_iterator(dirs.front()))
|
||||
{
|
||||
// Check if the entry is a regular file
|
||||
if (fs::is_regular_file(entry))
|
||||
{
|
||||
dir.files.push_back(entry.path());
|
||||
}
|
||||
// Check if the entry is a directory
|
||||
else if (fs::is_directory(entry))
|
||||
{
|
||||
dirs.push_back(entry.path());
|
||||
dir.dirs.push_back(entry.path());
|
||||
}
|
||||
}
|
||||
dirs.pop_front();
|
||||
}
|
||||
|
||||
return dir;
|
||||
}
|
||||
|
||||
std::vector<std::string> get_includes(const std::filesystem::path &path)
|
||||
{
|
||||
std::vector<std::string> ret;
|
||||
|
||||
std::ifstream ifs(path);
|
||||
std::string line;
|
||||
|
||||
while (std::getline(ifs, line))
|
||||
{
|
||||
if (line.empty())
|
||||
continue;
|
||||
|
||||
if (line[0] != '#')
|
||||
break;
|
||||
|
||||
// if include ends with " its my .h
|
||||
if (line[line.size() - 1] == '\"')
|
||||
{
|
||||
// magic num 10 is lenOf(#include ") so start at 10 until end of
|
||||
// line witch is len of line - 10 - 1 of cahar "
|
||||
ret.push_back(line.substr(10, line.length() - 10 - 1));
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void clear_all_build()
|
||||
{
|
||||
std::filesystem::remove_all(OBJ_DIR);
|
||||
std::filesystem::remove_all(BUILD_FILE);
|
||||
}
|
||||
|
||||
#ifdef EXT_INC
|
||||
int compile_src_dir(std::vector<std::string> ext_inc)
|
||||
#else
|
||||
int compile_src_dir()
|
||||
#endif
|
||||
{
|
||||
all_in_directory src_dir = get_all_files_in_dir(SRC_DIR);
|
||||
all_in_directory obj_dir;
|
||||
|
||||
for (auto &&i : src_dir.dirs)
|
||||
{
|
||||
std::filesystem::create_directory(OBJ_DIR / i);
|
||||
}
|
||||
|
||||
std::unordered_set<std::string> modified_heders;
|
||||
all_in_directory inc_dir = get_all_files_in_dir(INC_DIR);
|
||||
|
||||
for (size_t i = 0; i < inc_dir.files.size(); i++)
|
||||
{
|
||||
if (check_if_rebuild(inc_dir.files[i], BUILD_FILE))
|
||||
{
|
||||
std::string heder = inc_dir.files[i].string().substr(4);
|
||||
modified_heders.insert(heder);
|
||||
}
|
||||
}
|
||||
|
||||
command.clear();
|
||||
command.push_back(cpp_compiler);
|
||||
command.push_back("-c");
|
||||
int src_loc = command.size();
|
||||
command.push_back("");
|
||||
command.push_back("-o");
|
||||
int obj_loc = command.size();
|
||||
command.push_back("");
|
||||
command.push_back(opt_flags);
|
||||
|
||||
#ifdef EXT_INC
|
||||
command.insert(command.end(), ext_inc.begin(), ext_inc.end());
|
||||
#endif
|
||||
|
||||
command.push_back("-I" + INC_DIR.string());
|
||||
command.push_back("-std=c++20");
|
||||
command.push_back("-Wall");
|
||||
#ifdef Wextra
|
||||
command.push_back("-Wextra");
|
||||
#endif
|
||||
#ifdef Werror
|
||||
command.push_back("-Werror");
|
||||
#endif
|
||||
|
||||
int build = 0;
|
||||
for (auto &&i : src_dir.files)
|
||||
{
|
||||
std::filesystem::path tmp = i;
|
||||
std::filesystem::path out = OBJ_DIR / tmp.replace_extension(".o");
|
||||
bool reb = false;
|
||||
// check if .cpp changed
|
||||
if (check_if_rebuild(i, out))
|
||||
reb = true;
|
||||
|
||||
// if .cpp didnt change check include files changed
|
||||
if (!reb)
|
||||
{
|
||||
std::vector<std::string> incudes = get_includes(i);
|
||||
for (auto &&j : incudes)
|
||||
{
|
||||
if (modified_heders.find(j) != modified_heders.end())
|
||||
{
|
||||
reb = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (reb)
|
||||
{
|
||||
command[src_loc] = i.string();
|
||||
command[obj_loc] = out.string();
|
||||
if (!run_command(command))
|
||||
return -1;
|
||||
|
||||
build = 1;
|
||||
}
|
||||
}
|
||||
return build;
|
||||
}
|
||||
|
||||
#if defined(EXT_LINK)
|
||||
bool compile_obj_dir(std::vector<std::string> ext_link)
|
||||
#else
|
||||
bool compile_obj_dir()
|
||||
#endif
|
||||
{
|
||||
all_in_directory obj_dir = get_all_files_in_dir(OBJ_DIR);
|
||||
|
||||
command.clear();
|
||||
command.push_back(cpp_compiler);
|
||||
|
||||
for (auto &&i : obj_dir.files)
|
||||
{
|
||||
command.push_back(i.string());
|
||||
}
|
||||
|
||||
command.push_back(opt_flags);
|
||||
command.push_back("-o");
|
||||
command.push_back(BUILD_FILE.string());
|
||||
|
||||
#if defined(EXT_LINK)
|
||||
command.insert(command.end(), ext_link.begin(), ext_link.end());
|
||||
#endif
|
||||
|
||||
return run_command(command);
|
||||
}
|
||||
|
||||
#if defined(EXT_OBJ) && defined(EXT_INC)
|
||||
void build_as_one(std::vector<std::string> ext_obj, std::vector<std::string> ext_inc)
|
||||
#elif defined(EXT_OBJ)
|
||||
void build_as_one(std::vector<std::string> ext_obj)
|
||||
#elif defined(EXT_INC)
|
||||
void build_as_one(std::vector<std::string> ext_inc)
|
||||
#else
|
||||
void build_as_one()
|
||||
#endif
|
||||
{
|
||||
all_in_directory src_dir = get_all_files_in_dir(SRC_DIR);
|
||||
|
||||
command.clear();
|
||||
command.push_back(cpp_compiler);
|
||||
command.push_back("-o");
|
||||
command.push_back(BUILD_FILE.string());
|
||||
command.push_back(opt_flags);
|
||||
|
||||
#ifdef EXT_INC
|
||||
command.insert(command.end(), ext_inc.begin(), ext_inc.end());
|
||||
#endif
|
||||
|
||||
command.push_back("-I" + INC_DIR.string());
|
||||
command.push_back("-std=c++20");
|
||||
command.push_back("-Wall");
|
||||
#ifdef Wextra
|
||||
command.push_back("-Wextra");
|
||||
#endif
|
||||
#ifdef Werror
|
||||
command.push_back("-Werror");
|
||||
#endif
|
||||
for (auto &&i : src_dir.files)
|
||||
{
|
||||
command.push_back(i.string());
|
||||
}
|
||||
|
||||
#ifdef EXT_OBJ
|
||||
command.insert(command.end(), ext_obj.begin(), ext_obj.end());
|
||||
#endif
|
||||
run_command(command);
|
||||
}
|
||||
|
||||
#ifdef EXT_ARGS
|
||||
bool run_main(std::vector<std::string> ext_args)
|
||||
#else
|
||||
bool run_main()
|
||||
#endif
|
||||
{
|
||||
command.clear();
|
||||
#ifndef _WIN32
|
||||
command.push_back("./" + BUILD_FILE.string());
|
||||
#else
|
||||
command.push_back(BUILD_FILE.string());
|
||||
#endif
|
||||
|
||||
#ifdef EXT_ARGS
|
||||
command.insert(command.end(), ext_args.begin(), ext_args.end());
|
||||
#endif
|
||||
|
||||
return run_command(command);
|
||||
}
|
68
random/rotation_in_just_math.cpp
Normal file
68
random/rotation_in_just_math.cpp
Normal file
@@ -0,0 +1,68 @@
|
||||
|
||||
#include <raymath.h>
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
std::printf("\n\n\n");
|
||||
|
||||
Vector2 mousePosition = {.x = 15, .y = 10};
|
||||
Vector2 mouseStart;
|
||||
Vector2 orgPosition = {.x = 0, .y = 10};
|
||||
float screenWidth = 30;
|
||||
|
||||
mouseStart = mousePosition;
|
||||
|
||||
std::printf("MouseStart x:%f, y:%f\n", mouseStart.x, mouseStart.y);
|
||||
std::printf("orgPosition x:%f, y:%f\n", orgPosition.x, orgPosition.y);
|
||||
|
||||
// distance betwen corner of image and mouse startPoint
|
||||
float len = Vector2Distance(mouseStart, orgPosition);
|
||||
std::printf("len %f\n", len);
|
||||
// angle in rad betwen mouse and image corner
|
||||
|
||||
float atan2x = orgPosition.x - mouseStart.x;
|
||||
float atan2y = orgPosition.y - mouseStart.y;
|
||||
std::printf("atan2 x:%f, y:%f\n", atan2x, atan2y);
|
||||
|
||||
float angleOfset = std::atan2( orgPosition.y - mouseStart.y, orgPosition.x - mouseStart.x);
|
||||
std::printf("angleOffset %f\n", angleOfset);
|
||||
|
||||
|
||||
mousePosition = {.x = 20, .y = 10};
|
||||
|
||||
// get distance that mouse has moved from original press location
|
||||
// can be positive or negative if mouse start on right side and
|
||||
// end on left it will be 0 - 100 so -100 dist
|
||||
float dist = mousePosition.x - mouseStart.x;
|
||||
printf("dist: %f\n", dist);
|
||||
// this value can get from -1 to 1 based on if we swipe left or right
|
||||
float l = dist / screenWidth;
|
||||
printf("l: %f\n", l);
|
||||
// first convert range of -1 to 1 to 0 to 1
|
||||
// then change to degres from 45 to -45
|
||||
float rotation = Lerp(45.0f, -45.0f, (l + 1) / 2);
|
||||
printf("rotation: %f\n", rotation);
|
||||
// convert to radians
|
||||
float angle = ((rotation)*PI) / 180.0f;
|
||||
printf("angle: %f\n", angle);
|
||||
angle += angleOfset;
|
||||
|
||||
printf("angle + angleOfser: %f\n", angle);
|
||||
|
||||
// vector betwen image corrner and mouse
|
||||
Vector2 newCornerVec = {.x = len * std::cos(angle), .y = len * std::sin(angle)};
|
||||
|
||||
printf("newCornerVec x: %f, y:%f \n", newCornerVec.x, newCornerVec.y);
|
||||
|
||||
// get global vector where to draw image
|
||||
|
||||
Vector2 newPosition;
|
||||
newPosition.x = newCornerVec.x + mousePosition.x;
|
||||
newPosition.y = newCornerVec.y + mousePosition.y;
|
||||
printf("New position x: %f, y:%f \n", newPosition.x, newPosition.y);
|
||||
printf("Draw image at this angle %f\n", rotation + 90);
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
@@ -6,14 +6,91 @@
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
#include <thread>
|
||||
#include <unordered_map>
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
|
||||
// use pthread rw_lock to lock db so you can safy clone .db file
|
||||
|
||||
class BlockedList
|
||||
{
|
||||
private:
|
||||
std::mutex m;
|
||||
|
||||
sqlite3 *db;
|
||||
sqlite3_stmt *sel_stmt;
|
||||
sqlite3_stmt *ins_stmt;
|
||||
sqlite3_stmt *upd_stmt;
|
||||
|
||||
public:
|
||||
void init()
|
||||
{
|
||||
int rc = sql::open(DB_NAME, &db);
|
||||
if (rc)
|
||||
{
|
||||
fprintf(stderr, "Can't open database: %s\n", sql::errmsg(db));
|
||||
return;
|
||||
}
|
||||
|
||||
sql::prepare_v2(db, get_warnings, -1, &sel_stmt, NULL);
|
||||
sql::prepare_v2(db, insert_warnings, -1, &ins_stmt, NULL);
|
||||
sql::prepare_v2(db, set_warnings, -1, &upd_stmt, NULL);
|
||||
}
|
||||
|
||||
bool isBlocked(uint32_t id)
|
||||
{
|
||||
std::scoped_lock lock(m);
|
||||
sql::bind_int64(sel_stmt, 1, id);
|
||||
int64_t found = 0;
|
||||
if (sql::step(sel_stmt) == SQLITE_ROW)
|
||||
{
|
||||
int type = sql::column_type(sel_stmt, 0);
|
||||
if (type != SQL_NULL)
|
||||
found = sql::column_int64(sel_stmt, 0);
|
||||
}
|
||||
sql::reset(sel_stmt);
|
||||
|
||||
return found >= 3;
|
||||
}
|
||||
|
||||
void addWarning(uint32_t id)
|
||||
{
|
||||
std::scoped_lock lock(m);
|
||||
sql::bind_int64(sel_stmt, 1, id);
|
||||
int64_t found = 0;
|
||||
int res = sql::step(sel_stmt);
|
||||
if (res == SQLITE_ROW)
|
||||
{
|
||||
int type = sql::column_type(sel_stmt, 0);
|
||||
if (type != SQL_NULL)
|
||||
{
|
||||
found = sql::column_int64(sel_stmt, 0);
|
||||
}
|
||||
sql::reset(sel_stmt);
|
||||
}
|
||||
else if (res == SQL_DONE)
|
||||
{
|
||||
sql::bind_int64(ins_stmt, 1, id);
|
||||
sql::step(ins_stmt);
|
||||
sql::reset(ins_stmt);
|
||||
sql::reset(sel_stmt);
|
||||
return;
|
||||
}
|
||||
|
||||
sql::bind_int64(upd_stmt, 1, found + 1);
|
||||
sql::bind_int64(upd_stmt, 2, id);
|
||||
sql::step(upd_stmt);
|
||||
sql::reset(upd_stmt);
|
||||
}
|
||||
};
|
||||
|
||||
BlockedList blockedList;
|
||||
|
||||
// When a new client connected:
|
||||
void call(int sock, sockaddr_in newSocketInfo)
|
||||
{
|
||||
std::string add = TcpSocket::remoteAddress(newSocketInfo);
|
||||
printf("new: %s\n", add.c_str());
|
||||
//printf("new: %s\n", add.c_str());
|
||||
int64_t conf, id;
|
||||
Message message;
|
||||
|
||||
@@ -22,15 +99,17 @@ void call(int sock, sockaddr_in newSocketInfo)
|
||||
|
||||
if (conf != StartHeader)
|
||||
{
|
||||
printf("StartHeader ERROR\n");
|
||||
//printf("StartHeader ERROR\n");
|
||||
TcpSocket::closet(sock);
|
||||
//blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (id == 0)
|
||||
{
|
||||
printf("ID ERROR\n");
|
||||
//printf("ID ERROR\n");
|
||||
TcpSocket::closet(sock);
|
||||
//blockedList.addWarning(newSocketInfo.sin_addr.s_addr);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -51,8 +130,6 @@ void call(int sock, sockaddr_in newSocketInfo)
|
||||
int64_t gen = 0;
|
||||
while (sql::step(max_gen_stmt) != SQL_DONE)
|
||||
{
|
||||
int num_cols = sql::column_count(max_gen_stmt);
|
||||
|
||||
int type = sql::column_type(max_gen_stmt, 0);
|
||||
|
||||
if (type == SQL_NULL)
|
||||
@@ -67,12 +144,12 @@ void call(int sock, sockaddr_in newSocketInfo)
|
||||
|
||||
sqlite3_stmt *insert_user_stmt;
|
||||
sql::prepare_v2(db, insert_user_data, -1, &insert_user_stmt, NULL);
|
||||
|
||||
// limit how many gen they can send so some cant just come to here and start sendding random data.
|
||||
while (ok)
|
||||
{
|
||||
message.mess = Mess::REQ_SEND_GEN;
|
||||
message.data = gen;
|
||||
printf("requesting gen %ld\n", gen);
|
||||
//printf("requesting gen %ld\n", gen);
|
||||
TcpSocket::sendt(sock, &message, sizeof(Message));
|
||||
TcpSocket::recvt(sock, &message, sizeof(Message));
|
||||
|
||||
@@ -110,7 +187,7 @@ void call(int sock, sockaddr_in newSocketInfo)
|
||||
sql::finalize(insert_liked_stmt);
|
||||
|
||||
sql::close(db);
|
||||
printf("del\n");
|
||||
//printf("del\n");
|
||||
TcpSocket::closet(sock);
|
||||
}
|
||||
|
||||
@@ -133,7 +210,8 @@ int main()
|
||||
{
|
||||
sql::init();
|
||||
sql::create_tables();
|
||||
std::thread t(checker);
|
||||
blockedList.init();
|
||||
//std::thread t(checker);
|
||||
std::thread l(listen_key);
|
||||
// Bind the server to a port.
|
||||
int err = TcpSocket::listent("0.0.0.0", serverPort, call);
|
||||
|
@@ -1,36 +0,0 @@
|
||||
#version 100
|
||||
|
||||
precision mediump float;
|
||||
|
||||
varying vec2 fragTexCoord;
|
||||
varying vec4 fragColor;
|
||||
|
||||
|
||||
uniform vec3 color;
|
||||
uniform float sun_radius;
|
||||
uniform float start_transperency;
|
||||
|
||||
vec2 offset = vec2(1.0, 1.0);
|
||||
float sun_end = 1.0;
|
||||
|
||||
void main()
|
||||
{
|
||||
offset.x -= fragTexCoord.x * 2.0;
|
||||
offset.y -= fragTexCoord.y * 2.0;
|
||||
float radius = length(offset);
|
||||
|
||||
if(radius < sun_radius){
|
||||
|
||||
gl_FragColor = vec4(color, 1.0);
|
||||
|
||||
}else if(radius < sun_end){
|
||||
|
||||
float gradient = radius;
|
||||
gradient -= sun_radius;
|
||||
gradient = gradient / (sun_end - sun_radius) * start_transperency;
|
||||
gl_FragColor = vec4(color, start_transperency - gradient);
|
||||
|
||||
}else{
|
||||
gl_FragColor = vec4(color, 0.0);
|
||||
}
|
||||
}
|
@@ -1,28 +0,0 @@
|
||||
#version 330
|
||||
|
||||
in vec2 fragTexCoord;
|
||||
in vec4 fragColor;
|
||||
out vec4 finalColor;
|
||||
|
||||
uniform vec3 color;
|
||||
uniform float sun_radius;
|
||||
uniform float start_transperency;
|
||||
vec2 offset = vec2(1.0f, 1.0f);
|
||||
float sun_end = 1.0f;
|
||||
|
||||
void main()
|
||||
{
|
||||
offset.x -= fragTexCoord.x * 2;
|
||||
offset.y -= fragTexCoord.y * 2;
|
||||
float radius = length(offset);
|
||||
if(radius < sun_radius){
|
||||
finalColor = vec4(color, 1.0f);
|
||||
}else if(radius < sun_end){
|
||||
float gradient = radius;
|
||||
gradient -= sun_radius;
|
||||
gradient = gradient / (sun_end - sun_radius) * start_transperency;
|
||||
finalColor = vec4(color, start_transperency - gradient);
|
||||
}else{
|
||||
finalColor = vec4(color, 0.0f);
|
||||
}
|
||||
}
|
@@ -1,26 +0,0 @@
|
||||
#include <raylib.h>
|
||||
|
||||
class Circle
|
||||
{
|
||||
public:
|
||||
static void init();
|
||||
static void deinit();
|
||||
static void setColor(Color color);
|
||||
static void setSoftEdge(bool soft);
|
||||
static void draw(float x, float y, float size);
|
||||
|
||||
Circle() = delete;
|
||||
|
||||
private:
|
||||
static const int sizeTexute = 250;
|
||||
static RenderTexture2D target;
|
||||
static Shader shader;
|
||||
|
||||
static float radius;
|
||||
static float start_transperency;
|
||||
static float c[3];
|
||||
|
||||
static int radius_loc;
|
||||
static int start_transperency_loc;
|
||||
static int colorLoc;
|
||||
};
|
@@ -27,6 +27,7 @@ public:
|
||||
private:
|
||||
Dna *m_dna;
|
||||
uint128 branchSeed;
|
||||
//Texture2D texBunny;
|
||||
|
||||
Vector2 start = {0};
|
||||
std::list<DrawArgs> drawCalls;
|
||||
|
@@ -1,88 +0,0 @@
|
||||
const char *sun_shader_100 = "#version 100\n\
|
||||
precision mediump float;\
|
||||
varying vec2 fragTexCoord;\
|
||||
varying vec4 fragColor;\
|
||||
uniform vec3 color;\
|
||||
uniform float sun_radius;\
|
||||
uniform float start_transperency;\
|
||||
vec2 offset = vec2(1.0, 1.0);\
|
||||
float sun_end = 1.0;\
|
||||
void main()\
|
||||
{\
|
||||
offset.x -= fragTexCoord.x * 2.0;\
|
||||
offset.y -= fragTexCoord.y * 2.0;\
|
||||
float radius = length(offset);\
|
||||
if (radius < sun_radius) {\
|
||||
gl_FragColor = vec4(color, 1.0);\
|
||||
}\
|
||||
else if (radius < sun_end) {\
|
||||
float gradient = radius;\
|
||||
gradient -= sun_radius;\
|
||||
gradient = gradient / (sun_end - sun_radius) * start_transperency;\
|
||||
gl_FragColor = vec4(color, start_transperency - gradient);\
|
||||
}\
|
||||
else {\
|
||||
gl_FragColor = vec4(color, 0.0);\
|
||||
}\
|
||||
}";
|
||||
|
||||
unsigned char shaders_sun_330_fs[] = {
|
||||
0x23, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x33, 0x33, 0x30,
|
||||
0x0a, 0x0a, 0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x32, 0x20, 0x66, 0x72,
|
||||
0x61, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f, 0x72, 0x64, 0x3b, 0x0a,
|
||||
0x69, 0x6e, 0x20, 0x76, 0x65, 0x63, 0x34, 0x20, 0x66, 0x72, 0x61, 0x67,
|
||||
0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x3b, 0x0a, 0x6f, 0x75, 0x74, 0x20, 0x76,
|
||||
0x65, 0x63, 0x34, 0x20, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6c,
|
||||
0x6f, 0x72, 0x3b, 0x0a, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d,
|
||||
0x20, 0x76, 0x65, 0x63, 0x33, 0x20, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x3b,
|
||||
0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x66, 0x6c, 0x6f,
|
||||
0x61, 0x74, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x72, 0x61, 0x64, 0x69, 0x75,
|
||||
0x73, 0x3b, 0x0a, 0x75, 0x6e, 0x69, 0x66, 0x6f, 0x72, 0x6d, 0x20, 0x66,
|
||||
0x6c, 0x6f, 0x61, 0x74, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74,
|
||||
0x72, 0x61, 0x6e, 0x73, 0x70, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x3b,
|
||||
0x0a, 0x76, 0x65, 0x63, 0x32, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74,
|
||||
0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x32, 0x28, 0x31, 0x2e, 0x30, 0x66,
|
||||
0x2c, 0x20, 0x31, 0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0a, 0x66, 0x6c, 0x6f,
|
||||
0x61, 0x74, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x20, 0x3d,
|
||||
0x20, 0x31, 0x2e, 0x30, 0x66, 0x3b, 0x0a, 0x0a, 0x76, 0x6f, 0x69, 0x64,
|
||||
0x20, 0x6d, 0x61, 0x69, 0x6e, 0x28, 0x29, 0x0a, 0x7b, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x78, 0x20, 0x2d,
|
||||
0x3d, 0x20, 0x66, 0x72, 0x61, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f,
|
||||
0x72, 0x64, 0x2e, 0x78, 0x20, 0x2a, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x2e, 0x79, 0x20, 0x2d,
|
||||
0x3d, 0x20, 0x66, 0x72, 0x61, 0x67, 0x54, 0x65, 0x78, 0x43, 0x6f, 0x6f,
|
||||
0x72, 0x64, 0x2e, 0x79, 0x20, 0x2a, 0x20, 0x32, 0x3b, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x66, 0x6c, 0x6f, 0x61, 0x74, 0x20, 0x72, 0x61, 0x64, 0x69,
|
||||
0x75, 0x73, 0x20, 0x3d, 0x20, 0x6c, 0x65, 0x6e, 0x67, 0x74, 0x68, 0x28,
|
||||
0x6f, 0x66, 0x66, 0x73, 0x65, 0x74, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20,
|
||||
0x20, 0x69, 0x66, 0x28, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x20, 0x3c,
|
||||
0x20, 0x73, 0x75, 0x6e, 0x5f, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x29,
|
||||
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69,
|
||||
0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76,
|
||||
0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x31,
|
||||
0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x65,
|
||||
0x6c, 0x73, 0x65, 0x20, 0x69, 0x66, 0x28, 0x72, 0x61, 0x64, 0x69, 0x75,
|
||||
0x73, 0x20, 0x3c, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x29,
|
||||
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x6c,
|
||||
0x6f, 0x61, 0x74, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x20, 0x3d, 0x20, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69,
|
||||
0x65, 0x6e, 0x74, 0x20, 0x2d, 0x3d, 0x20, 0x73, 0x75, 0x6e, 0x5f, 0x72,
|
||||
0x61, 0x64, 0x69, 0x75, 0x73, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20,
|
||||
0x3d, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74, 0x20, 0x2f,
|
||||
0x20, 0x28, 0x73, 0x75, 0x6e, 0x5f, 0x65, 0x6e, 0x64, 0x20, 0x2d, 0x20,
|
||||
0x73, 0x75, 0x6e, 0x5f, 0x72, 0x61, 0x64, 0x69, 0x75, 0x73, 0x29, 0x20,
|
||||
0x2a, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74, 0x5f, 0x74, 0x72, 0x61, 0x6e,
|
||||
0x73, 0x70, 0x65, 0x72, 0x65, 0x6e, 0x63, 0x79, 0x3b, 0x0a, 0x20, 0x20,
|
||||
0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69, 0x6e, 0x61, 0x6c, 0x43,
|
||||
0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76, 0x65, 0x63, 0x34, 0x28,
|
||||
0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x73, 0x74, 0x61, 0x72, 0x74,
|
||||
0x5f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x70, 0x65, 0x72, 0x65, 0x6e, 0x63,
|
||||
0x79, 0x20, 0x2d, 0x20, 0x67, 0x72, 0x61, 0x64, 0x69, 0x65, 0x6e, 0x74,
|
||||
0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x65, 0x6c, 0x73, 0x65,
|
||||
0x7b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x66, 0x69,
|
||||
0x6e, 0x61, 0x6c, 0x43, 0x6f, 0x6c, 0x6f, 0x72, 0x20, 0x3d, 0x20, 0x76,
|
||||
0x65, 0x63, 0x34, 0x28, 0x63, 0x6f, 0x6c, 0x6f, 0x72, 0x2c, 0x20, 0x30,
|
||||
0x2e, 0x30, 0x66, 0x29, 0x3b, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x7d, 0x0a,
|
||||
0x7d, 0x0a};
|
@@ -4,6 +4,12 @@ const char create_like_table[] = "CREATE TABLE IF NOT EXISTS like_table ( ID INT
|
||||
|
||||
const char create_user_table[] = "CREATE TABLE IF NOT EXISTS user_table ( ID INTEGER PRIMARY KEY, USER_ID INTEGER, GEN INTEGER, CHECKED INTEGER);";
|
||||
|
||||
const char create_blocked_ip_table[] = "CREATE TABLE IF NOT EXISTS blocked_ip_table ( ID INTEGER PRIMARY KEY, WARNINGS INTEGER);";
|
||||
|
||||
const char get_warnings[] = "SELECT WARNINGS FROM blocked_ip_table WHERE ID = ?;";
|
||||
const char insert_warnings[] = "INSERT INTO blocked_ip_table (ID, WARNINGS) VALUES(?, 1);";
|
||||
const char set_warnings[] = "UPDATE blocked_ip_table SET WARNINGS = ? WHERE ID = ?;";
|
||||
|
||||
const char max_gen[] = "SELECT MAX(GEN) FROM user_table WHERE USER_ID = ?;";
|
||||
|
||||
const char insert_user_data[] = "INSERT INTO user_table (USER_ID, GEN, CHECKED) VALUES(?, ?, 0);";
|
||||
@@ -27,8 +33,10 @@ constexpr char DB_NAME[] = "data.db";
|
||||
struct sqlite3;
|
||||
struct sqlite3_stmt;
|
||||
|
||||
#define SQLITE_ROW 100 /* sqlite3_step() has another row ready */
|
||||
#define SQL_DONE 101
|
||||
#define SQL_NULL 5
|
||||
#define SQLITE_OK 0
|
||||
|
||||
namespace sql
|
||||
{
|
||||
|
@@ -9,6 +9,8 @@
|
||||
#define MAX_DEPTH 8
|
||||
#define MAX_POSIBLE_DEPTH 11
|
||||
static_assert(MAX_DEPTH <= MAX_POSIBLE_DEPTH);
|
||||
static_assert(180 == sizeof(Dna));
|
||||
constexpr int SIZE_OF_DNA = sizeof(Dna);
|
||||
|
||||
struct Branch
|
||||
{
|
||||
@@ -45,6 +47,7 @@ struct Dna
|
||||
uint8_t colorSet;
|
||||
Branch branches[MAX_DEPTH];
|
||||
};
|
||||
|
||||
namespace DNA
|
||||
{
|
||||
void newDna(Dna *dna, uint128 *state);
|
||||
|
@@ -5,13 +5,14 @@ namespace Similarity
|
||||
{
|
||||
// float euclidean_distance(Dna *d1, Dna *d2); direct distance betwen vector. wont give 0 and 1
|
||||
// float dot_product(Dna *d1, Dna *d2); doent return betwen 0 to 1
|
||||
float cosine_similarity(Dna *d1, Dna *d2);
|
||||
float cosine_similarity_int(Dna *d1, Dna *d2);
|
||||
// float cosine_similarity(Dna *d1, Dna *d2);
|
||||
// float cosine_similarity_int(Dna *d1, Dna *d2);
|
||||
float hamming_distance(Dna *d1, Dna *d2);
|
||||
float hamming_distance_without_seeds(Dna *d1, Dna *d2);
|
||||
// float jaccard_index(Dna *d1, Dna *d2); // primerja unio genov naprimer gleda ce je gen za nebo isti z genom za barvo za liste, to nerabimo
|
||||
// float levenshtein_distance(Dna *d1, Dna *d2); // odstranjen ker mi vrne iste podatke kot hamming distance ki je bolj enostaven za izracun
|
||||
// float needleman_wunsch(Dna *d1, Dna *d2); used for bioinformatics and aligment. Dont need its aligned alredy
|
||||
|
||||
typedef float(simil_func)(Dna *d1, Dna *d2);
|
||||
float calc_similarity(std::vector<Dna> &vec, simil_func f);
|
||||
float calc_similarity(std::vector<Dna> &vec, simil_func f = hamming_distance_without_seeds);
|
||||
}
|
@@ -2,7 +2,6 @@
|
||||
|
||||
#include "canvas/BackGround.hpp"
|
||||
#include "canvas/BackGroundColors.hpp"
|
||||
#include "canvas/Circle.hpp"
|
||||
#include "canvas/stb_perlin.h"
|
||||
|
||||
#include <raylib.h>
|
||||
@@ -44,6 +43,9 @@ Color ColorAdd(Color c1, Color c2)
|
||||
void BackGround::init(int canvasSize)
|
||||
{
|
||||
this->canvasSize = canvasSize;
|
||||
// resitev da ne postane tekstura okoli sonca transparentna in da se ne vidi nasledna slika
|
||||
// https://github.com/raysan5/raylib/issues/3820
|
||||
rlSetBlendFactorsSeparate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE, RL_FUNC_ADD, RL_MAX);
|
||||
}
|
||||
|
||||
void BackGround::deinit()
|
||||
@@ -52,7 +54,6 @@ void BackGround::deinit()
|
||||
|
||||
void BackGround::draw(Dna *dna)
|
||||
{
|
||||
Circle::setSoftEdge(true);
|
||||
m_dna = dna;
|
||||
mountenSeed = dna->mountenSeed;
|
||||
starSeed = dna->starSeed;
|
||||
@@ -118,26 +119,45 @@ void BackGround::drawStars()
|
||||
|
||||
void BackGround::drawSun()
|
||||
{
|
||||
int r = ((m_dna->moonY / 255.0f * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
int radius = ((m_dna->moonY / 255.0f * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
int xpos = Lerp(canvasSize * moonXOffset, canvasSize - canvasSize * moonXOffset, m_dna->moonX / 255.0f);
|
||||
int ypos = Lerp(canvasSize * moonXOffset, maxYPosOfMoon * canvasSize, m_dna->moonY / 255.0f);
|
||||
|
||||
Color color = {0};
|
||||
if (getColorSet() == 3)
|
||||
{
|
||||
Circle::setColor(BackGroundColors::moonColor);
|
||||
r = (((m_dna->moonSize / 255.0f) * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
color = BackGroundColors::moonColor;
|
||||
radius = (((m_dna->moonSize / 255.0f) * (maxSizeOfMoon - minSizeOfMoon)) + minSizeOfMoon) * canvasSize;
|
||||
}
|
||||
else
|
||||
{
|
||||
Color color = {0};
|
||||
color.r = 255;
|
||||
color.g = std::lerp(200, 50, m_dna->moonY / 255.0f);
|
||||
color.b = std::lerp(50, 0, m_dna->moonY / 255.0f);
|
||||
color.a = 255;
|
||||
|
||||
Circle::setColor(color);
|
||||
}
|
||||
Circle::draw(xpos, ypos, r);
|
||||
|
||||
BeginBlendMode(RL_BLEND_CUSTOM_SEPARATE);
|
||||
|
||||
constexpr float numOfCircles = 15.0f;
|
||||
constexpr float sunMin = 1.7f;
|
||||
|
||||
float amount = 0.0f;
|
||||
color.a = 15;
|
||||
for (size_t i = 0; i < numOfCircles; i++)
|
||||
{
|
||||
|
||||
float r = Lerp(radius, radius / sunMin, amount);
|
||||
DrawCircle(xpos, ypos, r, color);
|
||||
amount += 1.0f / numOfCircles;
|
||||
}
|
||||
|
||||
|
||||
EndBlendMode();
|
||||
|
||||
color.a = 255;
|
||||
DrawCircle(xpos, ypos, radius / sunMin, color);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void BackGround::drawMounten(size_t mountenSegments, int min, int max, Color color, float scale)
|
||||
|
@@ -1,11 +1,9 @@
|
||||
#include "canvas/Canvas.hpp"
|
||||
#include "canvas/Circle.hpp"
|
||||
|
||||
void Canvas::init(int size)
|
||||
{
|
||||
backGround.init(size);
|
||||
tree.init(size);
|
||||
Circle::init();
|
||||
}
|
||||
|
||||
void Canvas::newGen(RenderTexture2D &target, Dna *dna)
|
||||
@@ -30,5 +28,4 @@ bool Canvas::tick(RenderTexture2D &target)
|
||||
void Canvas::deinit()
|
||||
{
|
||||
backGround.deinit();
|
||||
Circle::deinit();
|
||||
}
|
||||
|
@@ -1,83 +0,0 @@
|
||||
#include "canvas/Circle.hpp"
|
||||
#include "canvas/sunShader.hpp"
|
||||
|
||||
#include <raylib.h>
|
||||
#include <rlgl.h>
|
||||
|
||||
RenderTexture2D Circle::target;
|
||||
Shader Circle::shader;
|
||||
float Circle::radius;
|
||||
float Circle::start_transperency;
|
||||
float Circle::c[3];
|
||||
int Circle::radius_loc;
|
||||
int Circle::start_transperency_loc;
|
||||
int Circle::colorLoc;
|
||||
|
||||
void Circle::init()
|
||||
{
|
||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_WEB)
|
||||
shader = LoadShaderFromMemory(nullptr, sun_shader_100);
|
||||
#else
|
||||
shader = LoadShaderFromMemory(nullptr, (const char *)shaders_sun_330_fs);
|
||||
#endif
|
||||
target = LoadRenderTexture(sizeTexute, sizeTexute);
|
||||
|
||||
radius = 0.6f;
|
||||
radius_loc = GetShaderLocation(shader, "sun_radius");
|
||||
SetShaderValue(shader, radius_loc, &radius, SHADER_UNIFORM_FLOAT);
|
||||
|
||||
start_transperency = 0.40f;
|
||||
start_transperency_loc = GetShaderLocation(shader, "start_transperency");
|
||||
SetShaderValue(shader, start_transperency_loc, &start_transperency, SHADER_UNIFORM_FLOAT);
|
||||
|
||||
c[0] = 1.0f;
|
||||
c[1] = 1.0f;
|
||||
c[2] = 1.0f;
|
||||
colorLoc = GetShaderLocation(shader, "color");
|
||||
SetShaderValue(shader, colorLoc, c, SHADER_UNIFORM_VEC3);
|
||||
|
||||
// resitev da ne postane tekstura okoli sonca transparentna in da se ne vidi nasledna slika
|
||||
// https://github.com/raysan5/raylib/issues/3820
|
||||
rlSetBlendFactorsSeparate(RL_SRC_ALPHA, RL_ONE_MINUS_SRC_ALPHA, RL_ONE, RL_ONE, RL_FUNC_ADD, RL_MAX);
|
||||
}
|
||||
|
||||
void Circle::deinit()
|
||||
{
|
||||
UnloadShader(shader);
|
||||
UnloadRenderTexture(target);
|
||||
}
|
||||
|
||||
void Circle::setColor(Color color)
|
||||
{
|
||||
c[0] = color.r / 255.0f;
|
||||
c[1] = color.g / 255.0f;
|
||||
c[2] = color.b / 255.0f;
|
||||
SetShaderValue(shader, colorLoc, c, SHADER_UNIFORM_VEC3);
|
||||
}
|
||||
|
||||
void Circle::setSoftEdge(bool soft)
|
||||
{
|
||||
if (soft)
|
||||
{
|
||||
radius = 0.6f;
|
||||
}
|
||||
else
|
||||
{
|
||||
radius = 1.0f;
|
||||
}
|
||||
SetShaderValue(shader, radius_loc, &radius, SHADER_UNIFORM_FLOAT);
|
||||
}
|
||||
|
||||
void Circle::draw(float x, float y, float size)
|
||||
{
|
||||
Rectangle dest = {x - size, y - size, size * 2, size * 2};
|
||||
Rectangle source = {0, 0, (float)target.texture.width, (float)-target.texture.height};
|
||||
Vector2 origin = {0.0f, 0.0f};
|
||||
|
||||
// zgorni komentar da se mesanje barv oklopi pravilno
|
||||
BeginBlendMode(RL_BLEND_CUSTOM_SEPARATE);
|
||||
BeginShaderMode(shader);
|
||||
DrawTexturePro(target.texture, source, dest, origin, 0.0f, WHITE);
|
||||
EndShaderMode();
|
||||
EndBlendMode();
|
||||
}
|
@@ -1,7 +1,6 @@
|
||||
#include <cmath>
|
||||
|
||||
#include "canvas/Tree.hpp"
|
||||
#include "canvas/Circle.hpp"
|
||||
|
||||
#include <raylib.h>
|
||||
#include <raymath.h>
|
||||
@@ -41,12 +40,11 @@ void Tree::init(int size)
|
||||
start.x = size / 2;
|
||||
start.y = size;
|
||||
calculateLevels(size);
|
||||
//texBunny = LoadTexture("dot.png"); // bug add deinit to unload texutre
|
||||
}
|
||||
|
||||
void Tree::draw(Dna *dna)
|
||||
{
|
||||
Circle::setSoftEdge(false);
|
||||
|
||||
m_dna = dna;
|
||||
branchSeed = dna->branchSeed;
|
||||
drawCalls.push_back({start, 180.0f, 0});
|
||||
@@ -94,9 +92,8 @@ void Tree::drawBranch()
|
||||
Vector2 point = Vector2Lerp(arg.start, end, i);
|
||||
Color color = ColorLerp(colorStart, colorEnd, i);
|
||||
int size = Lerp(sizeStart, sizeEnd, i);
|
||||
DrawCircleV(point, size, color); // Fester on the phone to call DrawCircle insted of the Circle shader
|
||||
// Circle::setColor(color);
|
||||
// Circle::draw(point.x, point.y, thick); // TODO Change to BeginShaderMode and EndShaderMode only onece
|
||||
DrawCircleV(point, size, color);
|
||||
//DrawTextureEx(texBunny, point,0, ((float)size) / texBunny.height, color);
|
||||
|
||||
// use
|
||||
// DrawRectangleGradientEx
|
||||
|
@@ -50,6 +50,17 @@ namespace sql
|
||||
fprintf(stdout, "user_table created successfully\n");
|
||||
}
|
||||
|
||||
rc = sqlite3_exec(db, create_blocked_ip_table, nullptr, 0, &zErrMsg);
|
||||
if (rc != SQLITE_OK)
|
||||
{
|
||||
fprintf(stderr, "SQL error: %s\n", zErrMsg);
|
||||
sqlite3_free(zErrMsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stdout, "blocked_ip_table created successfully\n");
|
||||
}
|
||||
|
||||
sqlite3_close(db);
|
||||
}
|
||||
|
||||
|
@@ -52,6 +52,7 @@ namespace DNA
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void mutate(Dna *dna, uint32_t num, uint128 *state)
|
||||
{
|
||||
uint8_t *array = (uint8_t *)dna;
|
||||
|
@@ -7,50 +7,50 @@ namespace Similarity
|
||||
// 0 -> -128
|
||||
// 255 -> 127
|
||||
// int8_t = uint8_t - 128
|
||||
float cosine_similarity(Dna *d1, Dna *d2)
|
||||
{
|
||||
uint8_t *d1a = (uint8_t *)d1;
|
||||
uint8_t *d2a = (uint8_t *)d2;
|
||||
// float cosine_similarity(Dna *d1, Dna *d2)
|
||||
// {
|
||||
// uint8_t *d1a = (uint8_t *)d1;
|
||||
// uint8_t *d2a = (uint8_t *)d2;
|
||||
|
||||
float mag1 = 0.0f;
|
||||
float mag2 = 0.0f;
|
||||
float dot_prod = 0.0f;
|
||||
for (size_t i = 0; i < sizeof(Dna); i++)
|
||||
{
|
||||
dot_prod += d1a[i] * d2a[i];
|
||||
mag1 += d1a[i] * d1a[i];
|
||||
mag2 += d2a[i] * d2a[i];
|
||||
}
|
||||
mag1 = sqrt(mag1);
|
||||
mag2 = sqrt(mag2);
|
||||
// float mag1 = 0.0f;
|
||||
// float mag2 = 0.0f;
|
||||
// float dot_prod = 0.0f;
|
||||
// for (size_t i = 0; i < sizeof(Dna); i++)
|
||||
// {
|
||||
// dot_prod += d1a[i] * d2a[i];
|
||||
// mag1 += d1a[i] * d1a[i];
|
||||
// mag2 += d2a[i] * d2a[i];
|
||||
// }
|
||||
// mag1 = sqrt(mag1);
|
||||
// mag2 = sqrt(mag2);
|
||||
|
||||
return dot_prod / (mag1 * mag2);
|
||||
}
|
||||
// return dot_prod / (mag1 * mag2);
|
||||
// }
|
||||
|
||||
float cosine_similarity_int(Dna *d1, Dna *d2)
|
||||
{
|
||||
auto map = [](uint8_t a) -> int8_t
|
||||
{ return a - 128; };
|
||||
// float cosine_similarity_int(Dna *d1, Dna *d2)
|
||||
// {
|
||||
// auto map = [](uint8_t a) -> int8_t
|
||||
// { return a - 128; };
|
||||
|
||||
uint8_t *d1a = (uint8_t *)d1;
|
||||
uint8_t *d2a = (uint8_t *)d2;
|
||||
// uint8_t *d1a = (uint8_t *)d1;
|
||||
// uint8_t *d2a = (uint8_t *)d2;
|
||||
|
||||
float mag1 = 0.0f;
|
||||
float mag2 = 0.0f;
|
||||
float dot_prod = 0.0f;
|
||||
for (size_t i = 0; i < sizeof(Dna); i++)
|
||||
{
|
||||
int8_t a = map(d1a[i]);
|
||||
int8_t b = map(d2a[i]);
|
||||
dot_prod += a * b;
|
||||
mag1 += a * a;
|
||||
mag2 += b * b;
|
||||
}
|
||||
mag1 = sqrt(mag1);
|
||||
mag2 = sqrt(mag2);
|
||||
// float mag1 = 0.0f;
|
||||
// float mag2 = 0.0f;
|
||||
// float dot_prod = 0.0f;
|
||||
// for (size_t i = 0; i < sizeof(Dna); i++)
|
||||
// {
|
||||
// int8_t a = map(d1a[i]);
|
||||
// int8_t b = map(d2a[i]);
|
||||
// dot_prod += a * b;
|
||||
// mag1 += a * a;
|
||||
// mag2 += b * b;
|
||||
// }
|
||||
// mag1 = sqrt(mag1);
|
||||
// mag2 = sqrt(mag2);
|
||||
|
||||
return dot_prod / (mag1 * mag2);
|
||||
}
|
||||
// return dot_prod / (mag1 * mag2);
|
||||
// }
|
||||
|
||||
float hamming_distance(Dna *d1, Dna *d2)
|
||||
{
|
||||
@@ -67,6 +67,23 @@ namespace Similarity
|
||||
return 1 - (distance / sizeof(Dna));
|
||||
}
|
||||
|
||||
float hamming_distance_without_seeds(Dna *d1, Dna *d2)
|
||||
{
|
||||
constexpr size_t start = sizeof(uint128) * 3;
|
||||
constexpr size_t end = sizeof(Dna);
|
||||
uint8_t *d1a = (uint8_t *)d1;
|
||||
uint8_t *d2a = (uint8_t *)d2;
|
||||
float distance = 0;
|
||||
for (size_t i = start; i < end; i++)
|
||||
{
|
||||
if (d1a[i] != d2a[i])
|
||||
{
|
||||
distance++;
|
||||
}
|
||||
}
|
||||
return 1 - (distance / (end - start));
|
||||
}
|
||||
|
||||
float calc_similarity(std::vector<Dna> &vec, simil_func f)
|
||||
{
|
||||
size_t num_pairs = (vec.size() * (vec.size() - 1)) / 2;
|
||||
|
@@ -14,10 +14,12 @@ enum DrawingStage
|
||||
done,
|
||||
};
|
||||
|
||||
constexpr int numberOfFunc = 2;
|
||||
|
||||
class Vapp
|
||||
{
|
||||
public:
|
||||
void init();
|
||||
void init(char* filename);
|
||||
void update();
|
||||
void draw();
|
||||
void deinit();
|
||||
@@ -46,8 +48,8 @@ private:
|
||||
int drawY = 0;
|
||||
void setUpManager();
|
||||
|
||||
std::array<float, 3> simil;
|
||||
std::vector<std::array<float, 3>> similTable;
|
||||
std::array<float, numberOfFunc> simil;
|
||||
std::vector<std::array<float, numberOfFunc>> similTable;
|
||||
|
||||
void setUpTable();
|
||||
};
|
@@ -11,7 +11,7 @@ const char select_user_id[] = "SELECT USER_ID FROM user_table GROUP BY USER_ID;"
|
||||
|
||||
constexpr int sizeOfCanvas = 1000;
|
||||
|
||||
void Vapp::init()
|
||||
void Vapp::init(char* filename)
|
||||
{
|
||||
bigTexture = LoadRenderTexture(sizeOfCanvas * 4, sizeOfCanvas * 4);
|
||||
treeTexture = LoadRenderTexture(sizeOfCanvas, sizeOfCanvas);
|
||||
@@ -20,7 +20,7 @@ void Vapp::init()
|
||||
DnaManager::setUp(&manager, 0);
|
||||
|
||||
sql::init();
|
||||
sql::open(DB_NAME, &db);
|
||||
sql::open(filename, &db);
|
||||
|
||||
sqlite3_stmt *stmt;
|
||||
sql::prepare_v2(db, select_user_id, -1, &stmt, NULL);
|
||||
@@ -100,9 +100,8 @@ void Vapp::update()
|
||||
break;
|
||||
case DrawingStage::calSim:
|
||||
|
||||
simil[0] = Similarity::calc_similarity(manager.vector, Similarity::cosine_similarity);
|
||||
simil[1] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
simil[2] = Similarity::calc_similarity(manager.vector, Similarity::cosine_similarity_int);
|
||||
simil[0] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
simil[1] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance_without_seeds);
|
||||
stageOfDrawing = DrawingStage::done;
|
||||
break;
|
||||
|
||||
@@ -174,12 +173,11 @@ void Vapp::draw()
|
||||
if (showStats)
|
||||
{
|
||||
ImGui::Begin("Status", &showStats);
|
||||
ImGui::LabelText("##sim1", "cosine_similarity: %f", simil[0]);
|
||||
ImGui::LabelText("##sim2", "hamming_distance: %f", simil[1]);
|
||||
ImGui::LabelText("##sim3", "cosine_similarity_int: %f", simil[2]);
|
||||
ImGui::LabelText("##sim1", "hamming_distance: %f", simil[0]);
|
||||
ImGui::LabelText("##sim2", "hamming_distance_without_seeds: %f", simil[1]);
|
||||
|
||||
const ImGuiTableFlags flags = ImGuiTableFlags_NoHostExtendX | ImGuiTableFlags_SizingFixedFit | ImGuiTableFlags_Resizable | ImGuiTableFlags_BordersOuter | ImGuiTableFlags_BordersV | ImGuiTableFlags_ContextMenuInBody;
|
||||
const int columns = 4;
|
||||
const int columns = numberOfFunc + 1;
|
||||
if (ImGui::BeginTable("table1", columns, flags))
|
||||
{
|
||||
for (int row = 0; row < similTable.size(); row++)
|
||||
@@ -292,9 +290,8 @@ void Vapp::setUpTable()
|
||||
{
|
||||
similTable.emplace_back();
|
||||
int s = similTable.size() - 1;
|
||||
similTable[s][0] = Similarity::calc_similarity(manager.vector, Similarity::cosine_similarity);
|
||||
similTable[s][1] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
similTable[s][2] = Similarity::calc_similarity(manager.vector, Similarity::cosine_similarity_int);
|
||||
similTable[s][0] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance);
|
||||
similTable[s][1] = Similarity::calc_similarity(manager.vector, Similarity::hamming_distance_without_seeds);
|
||||
|
||||
DnaManager::newGen(&manager);
|
||||
}
|
||||
|
@@ -2,18 +2,24 @@
|
||||
#include <imgui.h>
|
||||
#include <rlImGui.h>
|
||||
#include "Vapp.hpp"
|
||||
#include <cstdio>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int screenWidth = 1000;
|
||||
int screenHeight = 1000;
|
||||
|
||||
if(argc != 2){
|
||||
printf("MISING DB FILE\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
Vapp app;
|
||||
SetConfigFlags(FLAG_WINDOW_RESIZABLE);
|
||||
InitWindow(screenWidth, screenHeight, "VIEW");
|
||||
SetTargetFPS(60);
|
||||
rlImGuiSetup(true);
|
||||
app.init();
|
||||
app.init(argv[1]);
|
||||
ImGui::GetIO().ConfigFlags |= ImGuiConfigFlags_DockingEnable;
|
||||
|
||||
while (!WindowShouldClose())
|
||||
|
Reference in New Issue
Block a user