-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
125 lines (105 loc) · 2.38 KB
/
main.cpp
File metadata and controls
125 lines (105 loc) · 2.38 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include <SFML/Graphics.hpp>
#include <iostream>
#include <cstdlib>
#include <ctime>
#include "Deck.h" // test
#include "Game.h"
#include "Text_UI.h"
#include "Gui.h"
// apparently, sfml + windows gcc = broken exception handling
// maybe i'll figure it out later, for now just avoid exception handling
void except_test()
{
try
{
throw 20;
}
catch (int e)
{
std::cout << "caught\n";
}
}
void test_winscreen()
{
Gui gui;
gui.win_screen();
}
void test_gui()
{
Gui gui;
//gui.test();
gui.play();
}
void test_text_ui()
{
Text_UI game;
game.play();
}
void test_game()
{
Game a;
a.play_test();
}
void dynamic_ai_test()
{
Game_Hand hand;
hand.dynamic_play_ai(0);
}
void test_some_inside_stuff()
{
// test
Deck deck(true);
std::vector<Suit> new_sort = {HEARTS, DIAMONDS, SPADES, CLUBS};
deck.change_sort(new_sort);
// test iteration through deck
for (auto itr = deck.begin(); itr != deck.end(); ++itr)
{
std::cout << itr->get_value() << ' ' << itr->get_suit() << std::endl;
}
Card pick = deck.deal_one();
std::cout << "dealt card: " << pick.get_value() << ' ' << pick.get_suit() << std::endl;
// rest of deck
for (auto itr = deck.begin(); itr != deck.end(); ++itr)
{
std::cout << itr->get_value() << ' ' << itr->get_suit() << std::endl;
}
// test Deck::insert
deck.insert(pick);
//show deck again
std::cout << "after insert\n";
for (auto itr = deck.begin(); itr != deck.end(); ++itr)
{
std::cout << itr->get_value() << ' ' << itr->get_suit() << std::endl;
}
}
void sfml_test()
{
// test sfml
sf::RenderWindow window(sf::VideoMode(800, 600), "SFML works!");
sf::Texture card_texture;
card_texture.loadFromFile("resources/Diamond.jpg", sf::IntRect(8,6,272,422));
card_texture.setSmooth(true);
sf::Sprite card;
card.setTexture(card_texture);
card.setScale(.238, .238);
// sf::CircleShape shape(100.f);
// shape.setFillColor(sf::Color::Green);
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
window.clear();
window.draw(card);
window.display();
}
}
int main()
{
srand(time(NULL));
test_gui();
return 0;
}