/
AsciiSlotMachine.cpp
52 lines (45 loc) · 1.26 KB
/
AsciiSlotMachine.cpp
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
// AsciiSlotMachine.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <string.h>
#include <iostream>
#include "Slot.h"
#include <stdlib.h>
#include <time.h>
using namespace std;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
void PrintBanner()
{
SetConsoleTitle(L"Ascii Casino");
SetConsoleTextAttribute(hConsole, 0xE);
string banner = " _ _ _ _ _ _ _ _ _ _ _ "
"\n\t / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ / \\ "
"\n\t( A | S | C | I | I ) ( C | A | S | I | N | O )"
"\n\t \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ \\_/ ";
cout << banner << endl << endl << endl << "\tGet 3";
SetConsoleTextAttribute(hConsole, 0x0A);
cout << " $$$ ";
SetConsoleTextAttribute(hConsole, 0xE);
cout << "signs and win the $15 Amazon Gift code" << endl;
}
int _tmain(int argc, _TCHAR* argv[])
{
PrintBanner();
srand(time(NULL));
//Keeps random color range between 0x09 and 0x0f
int rndmColor = (rand() % 0x07) + 0x09;
Slot *s = new Slot(rndmColor);
s->PrintSlot();
while (1)
{
cout << endl << endl << "\t\tPress Space to Spin...";
do
{
} while (!(GetKeyState(VK_SPACE) & 0x8000));
s->Pull();
system("cls");
PrintBanner();
s->PrintSlot();
}
return 0;
}