-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathApp.cpp
More file actions
44 lines (30 loc) · 1.04 KB
/
Copy pathApp.cpp
File metadata and controls
44 lines (30 loc) · 1.04 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
#include "App.hpp"
App:: App(unsigned int _width,unsigned int _height,unsigned int _elementCount) {
width=_width;
height=_height;
elementCount=_elementCount;
windowInitialize("Tomb rendezes vizualizalo", width, height, &window, &renderer);
}
void App::visualizeSorting() {
for(unsigned int i =0; i<elementCount; ++i) {
unsigned int value=rand() % elementCount + 1;
sortmeVector.push_back(Element(value, i, elementCount, width, height, renderer));
}
SelectionSort(sortmeVector, elementCount);
shuffle(sortmeVector,elementCount);
MergeSort(sortmeVector,0,elementCount-1);
shuffle(sortmeVector,elementCount);
BubbleSort(sortmeVector,elementCount);
shuffle(sortmeVector,elementCount);
InsertionSort(sortmeVector);
shuffle(sortmeVector,elementCount);
std::sort(sortmeVector.begin(),sortmeVector.end());
SDL_Event ev;
while (SDL_WaitEvent(&ev) && ev.type != SDL_QUIT) {
}
SDL_Quit();
}
App::~App() {
SDL_DestroyRenderer(renderer);
SDL_DestroyWindow(window);
}