Adding movement controls & refactoring code.

This commit is contained in:
2025-04-23 16:01:12 -04:00
parent 7d8d8cf7ba
commit d4393ee835
2 changed files with 23 additions and 10 deletions

View File

@@ -193,7 +193,19 @@ public:
using CmdArgs = std::vector<std::string>;
void PositionCmd(const CmdArgs& args) {
if (args.empty()) { // Output position + scale
console->Log(std::format("Pos: {}, {}, Zoom: {}", u_translation.x, u_translation.y, u_scale));
return;
}
if (args.size() >= 2) { // Set Position
u_translation.x = std::stof(args[0]);
u_translation.y = std::stof(args[1]);
if (args.size() >= 3) { // Also set scale
u_scale = std::stof(args[2]);
}
}
console->Log(std::format("{}", args.size()));
}
void CreateMenu() {
@@ -232,18 +244,19 @@ public:
console->OnInput += [this] (const std::string& message) {
auto tokens = string_expand(message);
std::string cmd = tokens[0];
// TODO: Remove 0th element from tokens before passing to command delegates.
if (tokens.size() == 0)
{
if (tokens.size() == 0) {
console->Log("No command input!", Colors::Red);
return;
}
std::string cmd = tokens[0];
// Remove 0th element from tokens before passing to command delegates.
tokens.erase(tokens.begin());
if (cmd == "r" || cmd == "reload") {
ReloadShader();
} else if (cmd == "lf") {

View File

@@ -16,8 +16,8 @@ uniform float u_scale;
uniform vec3 u_rgb_1;
uniform vec3 u_rgb_2;
#define N 48.
#define B 4.
#define N 256. // Number of iterations?
#define B 4. // What does B mean?
vec3 pal(in float t, in vec3 a, in vec3 b, in vec3 c, in vec3 d) {