-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIO.h
76 lines (61 loc) · 3 KB
/
IO.h
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
/*********************************************************************************************************************/
/*!
@file IO.h
@author sbmrgd
@section LICENSE
Software License Agreement (BSD License)
Copyright (c) 2018, sbmrgd
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holders nor the
names of its contributors may be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
This entire game is based on a tutorial by Javier López López
Link: http://javilop.com/gamedev/tetris-tutorial-in-c-platform-independent-focused-in-game-logic-for-beginners/
*/
/*********************************************************************************************************************/
#ifndef IO_H_INCLUDED
#define IO_H_INCLUDED
// ------ Includes -----
#include <cstdint>
// ------ Enums -----
enum class color{ Black, Red, Green, Blue, Cyan, Magenta, Yellow, Orange, Purple, White, Grey, Grey2, Color_Max}; // Colors
const unsigned char paletteLinez[48] = {
0x00,0x00,0x00, //000000
0xFF,0x00,0x00, //FF0000
0x00,0xFF,0x00, //00FF00
0x00,0x00,0xFF, //0000FF
0x00,0xFF,0xFF, //00FFFF
0xFF,0x00,0xFF, //FF00FF
0xFF,0xFF,0x00, //FFFF00
0xFF,0xA5,0x00, //FFA500
0x80,0x00,0x80, //800080
0xFF,0xFF,0xFF, //FFFFFF
0x2F,0x4F,0x4F, //2F4F4F
0x4F,0x4F,0x4F, //4F4F4F
0xD2,0xAA,0x99, //d2aa99
0x6D,0xC2,0xCA, //6dc2ca
0xDA,0xD4,0x5E, //dad45e
0xDE,0xEE,0xD6 //deeed6
};
// --------------------------------------------------------------------------------
// IO
// --------------------------------------------------------------------------------
uint8_t colorToIndex(color c);
#endif // IO_H_INCLUDED