From 78868f5b5296fb530e32e9da64d5d8db7be51b81 Mon Sep 17 00:00:00 2001 From: kin-fuyuki Date: Sun, 22 Feb 2026 03:57:10 -0300 Subject: [PATCH] stuf --- .gitmodules | 4 + engine/CMakeLists.txt | 2 +- engine/noisedev/cloud.lua | 0 engine/noisedev/main.cpp | 118 ++++++++++++++++++++++ engine/noisedev/scripts.tdf | 7 ++ engine/src/graph/noise.cpp | 22 ++++ engine/src/graph/noise.h | 32 ++++++ games/endlauncher/CMakeLists.txt | 2 +- games/forespend/CMakeLists.txt | 2 +- games/forespend/res/npcs/canidmonster.tdf | 81 ++++++++++++++- lib/luajit | 1 + lib/tiny | 2 +- updatesymlinks.sh | 4 +- 13 files changed, 267 insertions(+), 10 deletions(-) create mode 100644 engine/noisedev/cloud.lua create mode 100644 engine/noisedev/main.cpp create mode 100644 engine/noisedev/scripts.tdf create mode 100644 engine/src/graph/noise.cpp create mode 100644 engine/src/graph/noise.h create mode 160000 lib/luajit diff --git a/.gitmodules b/.gitmodules index e7764a6..ba0978d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,7 @@ [submodule "lib/tiny-lua"] path = lib/tiny-lua url = https://github.com/kin-fuyuki/tiny-lua.git +[submodule "lib/luajit"] + path = lib/luajit + url = https://github.com/LuaJIT/LuaJIT.git + branch = v2.0 diff --git a/engine/CMakeLists.txt b/engine/CMakeLists.txt index 0d56041..0d39f1e 100644 --- a/engine/CMakeLists.txt +++ b/engine/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.20) -set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -w -Oz -g") +set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -w -Oz -g -mavx2") if (DEFINED PLATFORMNAME) SET(CURRPLATFORM ${PLATFORMNAME}) diff --git a/engine/noisedev/cloud.lua b/engine/noisedev/cloud.lua new file mode 100644 index 0000000..e69de29 diff --git a/engine/noisedev/main.cpp b/engine/noisedev/main.cpp new file mode 100644 index 0000000..8aa9af5 --- /dev/null +++ b/engine/noisedev/main.cpp @@ -0,0 +1,118 @@ +#include +#include +#include +#include + + +Texture2D* noiseresult; +std::vector* gui=new std::vector{ + new enginend::nodes::twod::textured(noiseresult,0,0,512,512), + new enginend::nodes::twod::text(NULL,enginend::DEFAULT,0,0,512,32,32,"") +}; + + +class noiserenderer :public enginend::program{ +public: + tiny::TDF_FILE* config; + std::string currentscript; + std::vector scripts; + const char* CONF()override{return "scripts.tdf";} + Image noiseout; + noiserenderer(){ + config=new tiny::TDF_FILE; + config->filepath=(char*)this->CONF(); + config->read(); + boost::unordered_mapluascripts=*(config->getclass({"lua"})); + for (auto data:luascripts){ + if (data.second.type==tiny::TDF_STR){ + scripts.push_back(*static_cast(data.second.datapointer)); + } + } + currentscript=scripts[0]; + } + void boot() override{ + SetConfigFlags(FLAG_VSYNC_HINT); + InitWindow(512, 512, "lua noise viewer"); + noiseout=GenImageColor(512,512,{255,255,255,255}); + + + this->currentscene=new enginend::scene(); + this->tickrate=3; + this->framerate=3; + } + void tick() override{} + void draw() override { + + } + void exit() override{} + ~noiserenderer() {}; + +}; + +void refreshstuf(noiserenderer *program,char *refreshtdf,char *refreshnoise); + +int main() { + noiserenderer program; + program.boot(); + struct timespec peepy; + long time=1000000000L/((long)(program.framerate)); + char refreshtdf=program.config->getint({"tdfrefresh"}); + char refreshnoise=program.config->getint({"refreshsecs"}); + char checkrefresh=0,checkrefreshtdf=0,checkrefreshnoise=0; + peepy.tv_nsec=time; + peepy.tv_sec=0; + + while (true) { + program.tick(); + program.draw(); + nanosleep(&peepy, nullptr); + if (++checkrefresh==3) { + checkrefresh=0; + if (++checkrefreshnoise==refreshnoise) { + checkrefreshnoise=0; + + } + if (++checkrefreshtdf==refreshtdf) { + checkrefreshtdf=0; + refreshstuf(&program,&refreshtdf,&refreshnoise); + } + } + if (IsKeyDown(KEY_LEFT_ALT)&&IsKeyDown(KEY_F4)){break;} + } + program.exit(); +} + + +void refreshstuf(noiserenderer *program,char *refreshtdf,char *refreshnoise){ + tiny::TDF_FILE *tocheck=new tiny::TDF_FILE; + tocheck->filepath=(char*)program->CONF(); + tocheck->read(); + bool isequal=true; + if (tocheck->todelete.size()!=program->config->todelete.size())isequal=false; + else { + std::string og=""; + std::string justread=""; + program->config->crawl(program->config->data,&og); + tocheck->crawl(tocheck->data,&justread); + isequal=og==justread; + } + if (!isequal){ + program->config->close(); + delete program->config; + program->config=tocheck; + boost::unordered_mapluascripts=*(program->config->getclass({"lua"})); + for (auto data:luascripts){ + if (data.second.type==tiny::TDF_STR){ + program->scripts.push_back(*static_cast(data.second.datapointer)); + } + } + *refreshtdf=program->config->getint({"tdfrefresh"}); + *refreshnoise=program->config->getint({"refreshsecs"}); + program->currentscript=program->scripts[0]; + } + else { + tocheck->close(); + delete tocheck; + } + +} \ No newline at end of file diff --git a/engine/noisedev/scripts.tdf b/engine/noisedev/scripts.tdf new file mode 100644 index 0000000..fb403c3 --- /dev/null +++ b/engine/noisedev/scripts.tdf @@ -0,0 +1,7 @@ +{ lua +" CLOUD cloud.lua +" NOISE noise.lua +} +i refreshsecs 3 +i tdfrefresh 5 +i imagesize 512 \ No newline at end of file diff --git a/engine/src/graph/noise.cpp b/engine/src/graph/noise.cpp new file mode 100644 index 0000000..50cb03a --- /dev/null +++ b/engine/src/graph/noise.cpp @@ -0,0 +1,22 @@ +#include "noise.h" + +#include + +Image* noise::gen(short w, short h, int x, int y) { + switch (this->type) { + case CLOUD: + return cloud(this,w, h, x, y); + case RANDOM: + return random(this,w, h, x, y); + default: + return nullptr; + } +} + +Image* cloud(noise* noise,short w, short h,int x, int y) { + + +} +Image* random(noise* noise,short w, short h,int x, int y) { + +} \ No newline at end of file diff --git a/engine/src/graph/noise.h b/engine/src/graph/noise.h new file mode 100644 index 0000000..d3f8478 --- /dev/null +++ b/engine/src/graph/noise.h @@ -0,0 +1,32 @@ +#pragma once +#include "window.h" +enum NOISETYPE { + CLOUD, + RANDOM, + +}; +enum DIMENSION { + ONE,TWO,THREE,FOUR +}; + +class noise { + public: + int freq; + int octave; + int amp; + NOISETYPE type; + DIMENSION dims; + noise(int freq,int octave, int amp, NOISETYPE type, DIMENSION dims): + freq(freq), octave(octave), amp(amp), type(type),dims(dims) {} +/// to explain the image generator +/// \param x int +/// \param y int +/// ^ these here is the position the noise will start rendering +/// \param w +/// \param h +/// these are the image width and height. PLEASE DO NOT GET CONFUSED + Image* gen(short w, short h,int x, int y); +}; + +Image* cloud(noise* noise,short w, short h,int x, int y); +Image* random(noise* noise, short w, short h,int x, int y); \ No newline at end of file diff --git a/games/endlauncher/CMakeLists.txt b/games/endlauncher/CMakeLists.txt index 00f7b1e..cf8344e 100644 --- a/games/endlauncher/CMakeLists.txt +++ b/games/endlauncher/CMakeLists.txt @@ -7,7 +7,7 @@ else () endif (DEFINED PLATFORMNAME) -set(CMAKE_CXX_FLAGS "-std=c++11 -w -g -Wno-error -O0") +set(CMAKE_CXX_FLAGS "-std=c++11 -w -g -Wno-error -Oz -mavx2") file(GLOB_RECURSE ENDLAUNCHER "src/*.cpp") add_executable(endlauncher ${ENDLAUNCHER}) diff --git a/games/forespend/CMakeLists.txt b/games/forespend/CMakeLists.txt index fa21fad..b9273ff 100644 --- a/games/forespend/CMakeLists.txt +++ b/games/forespend/CMakeLists.txt @@ -1,6 +1,6 @@ cmake_minimum_required(VERSION 3.20) -set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -Oz -w -g") +set(CMAKE_CXX_FLAGS "-std=c++26 -Wno-error -Oz -w -g -mavx2") file(GLOB_RECURSE FORESPEND_SOURCES CONFIGURE_DEPENDS "src/*.cpp") add_executable(forespend ${FORESPEND_SOURCES}) if(NOT DEFINED ${ARCH}) diff --git a/games/forespend/res/npcs/canidmonster.tdf b/games/forespend/res/npcs/canidmonster.tdf index ca28a57..d0173af 100644 --- a/games/forespend/res/npcs/canidmonster.tdf +++ b/games/forespend/res/npcs/canidmonster.tdf @@ -1,7 +1,80 @@ +# kin, if ur seeing this, please me of future.. complete the colors ;w; +# please look in the reference for the image result while reading this on res/npcs/canidmonstertutorial.png +# and canidmonster/*.png to see how it works on the spritesheet + +# how to use this file +# here is the entity name: " type canidmonster -{ proccol -i r 255 -i g 0 -i b 255 +# color ranges have the colors per color mask, from min to max during +# noise generation +{ sprite +# emote definition (yes, defines can have space :3c) +stare around +look down +breathe +# folder where the sprites will be +" folder canidmonster +# fb: front back | lr: left right | ud: up down +i fb-framew 32 +i fb-frameh 128 +# note: i recommend 2x width on the side view in case of the running animation being wide +# well this is mostly for vertically standing beings, for horizontal then do whatever +i lr-framew 64 +i lr-frameh 128 +i ud-framew 64 +i ud-frameh 32 +# frame count, not defined animations wont be loaded +i idle 4 +i walk 8 +i run 8 +i swim 8 + + +} + +{ colorranges +# define range names +1 +2 +3 +shiny +# if generate a shiny one, all colors must be the same +{ forcedequals +shiny +} +# the class name will be the color used as mask, if you use a color range, then the color generated +# will be a tint over the existing texture instead of full replacement. it will overlay one another +# ex color range: +#{ aaaaaa-ffffff + +# in this example, the color ffffff is the belly +{ ffffff +# here we set which noise, this is an optional setting since it wont do noise if you dont set +# it will just use the first color for the range +" noise random +# here you set if you want it to repeat, if yes then it will use the 4d torus technique to seamlessly repeat +# 20 here is horizontal, 10 is vertical +#" param repeat 20 10 +i frequency 1 +i amplitude 1 +i octave 1 +# now we finally define the ranges, the name is the range between 1.0 and 0.0 +# this have a 2d range format. +# x_y.y +# x is the name of the range, since you could have multiple color ranges + +# this range for example is good for gray fur with brown spots +h 1_0.35 777777 +h 1_0.3 bbbbbb +h 1_0.29 6b4422 + +h ezra_0.0 ffffff +# also you can make ranges glow! (not be affected by ambient light) +{ glow +3 +} + +} +# end of range ffffff } diff --git a/lib/luajit b/lib/luajit new file mode 160000 index 0000000..5db4b03 --- /dev/null +++ b/lib/luajit @@ -0,0 +1 @@ +Subproject commit 5db4b03aeaf0f72eb817b468461b896466f820fd diff --git a/lib/tiny b/lib/tiny index 2707a41..1d60210 160000 --- a/lib/tiny +++ b/lib/tiny @@ -1 +1 @@ -Subproject commit 2707a41755ffdecbde19775c84ea4097bb72b587 +Subproject commit 1d60210e1b3487c4d1b1f48e28174b8521940f65 diff --git a/updatesymlinks.sh b/updatesymlinks.sh index f26a3c8..c594ef4 100755 --- a/updatesymlinks.sh +++ b/updatesymlinks.sh @@ -1,7 +1,7 @@ #!/bin/bash -folders=("engine/src" "lib/raylib/include" "lib/tiny/inc") -names=("enginend" "raylib" "tiny") +folders=("engine/src" "lib/raylib/include" "lib/tiny/inc" "lib/luajit/inc") +names=("enginend" "raylib" "tiny" "luajit") outdir="include" types=("h" "hpp")