-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualization.h
More file actions
56 lines (46 loc) · 1.05 KB
/
visualization.h
File metadata and controls
56 lines (46 loc) · 1.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#pragma once
#include <iostream>
#include <vector>
#include <cassert>
#include <SFML/System.hpp>
#include "sortableObject.h"
#define numberOfObjs 150
class visualization {
public:
enum State {
RUN,
BUBBLESORT,
SELECTIONSORT,
INSERTIONSORT,
MERGESORT,
QUICKSORT
};
visualization(int width, int length);
~visualization();
bool isClosed();
void createList();
void randomizeList();
void run();
void pollEvents();
void render();
void switchObjects(int index1, int index2);
void completionAnimation();
void bubbleSort();
void selectionSort();
void insertionSort();
void mergeSort(int start, int end);
void merge(int start, int mid, int end);
void quickSort(int low, int high);
int partition(int low, int high);
private:
int width;
int length;
double objectWidth;
std::vector<sortableObject> objectsToSort;
State state;
sf::RenderWindow* window;
sf::Event event;
sf::Font* font;
sf::Text* info;
sf::Clock clock;
};