mirror of
https://github.com/koloideal/SortLab.git
synced 2026-06-10 10:25:30 +03:00
skelet
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
#pragma once
|
||||
#include <SFML/Graphics.hpp>
|
||||
#include "Array.hpp"
|
||||
|
||||
class App {
|
||||
public:
|
||||
App();
|
||||
void run();
|
||||
|
||||
private:
|
||||
void handleEvents();
|
||||
void update(float dt);
|
||||
void render();
|
||||
|
||||
sf::RenderWindow window_;
|
||||
Array array_;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
#pragma once
|
||||
#include <vector>
|
||||
|
||||
class Array {
|
||||
public:
|
||||
enum class State { NORMAL, COMPARE, SWAP, SORTED };
|
||||
|
||||
Array(int size);
|
||||
void shuffle();
|
||||
|
||||
int getSize() const;
|
||||
float getValue(int index) const;
|
||||
State getState(int index) const;
|
||||
|
||||
void setValue(int index, float value);
|
||||
void setState(int index, State state);
|
||||
void resetStates();
|
||||
|
||||
private:
|
||||
std::vector<float> data_;
|
||||
std::vector<State> states_;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user