Copying from gitlab

This commit is contained in:
2026-01-09 10:45:23 +01:00
commit 25d9b22fbd
11 changed files with 937 additions and 0 deletions

45
includes/world.hpp Normal file
View File

@@ -0,0 +1,45 @@
#include <cstdint>
#include <cstdlib>
#include <iostream>
#include <string>
#include <time.h>
#include <vector>
#include "../includes/types.hpp"
#pragma once
#define MAX_HISTORY_SIZE 100
class World {
public:
World(int width, int height);
~World();
std::vector<bool> *getWorldData();
int getWidth();
int getHeight();
void randomize();
void saveCompressed();
size_t getCycle() const { return _cycle_index; }
void stepBack();
void clear();
void setCell(int x, int y);
void resize(int width, int height); // destructive
std::vector<uint32_t> getSelection(Vector2i &origin, Vector2i &size);
// Private members
private:
std::vector<uint32_t> getCompressed();
void loadCompressed(const std::vector<uint32_t> &compressed);
std::vector<bool> *_data;
size_t _cycle_index = 0;
std::vector<std::vector<uint32_t>> _history = {};
// Private data
private:
int _width;
int _height;
};