1 
2 /**
3  *
4  * @file OpenJazz.h
5  *
6  * Part of the OpenJazz project
7  *
8  * @par History:
9  * - 23rd August 2005: Created OpenJazz.h
10  * - 31st January 2006: Created level.h from parts of OpenJazz.h
11  * - 31st January 2006: Created player.h from parts of OpenJazz.h
12  * - 3rd February 2009: Created menu.h from parts of OpenJazz.h
13  * - 3rd February 2009: Created file.h from parts of OpenJazz.h
14  * - 3rd February 2009: Created font.h from parts of OpenJazz.h
15  * - 4th February 2009: Created palette.h from parts of OpenJazz.h
16  * - 2nd March 2009: Created network.h from parts of OpenJazz.h
17  * - 2nd June 2009: Created sound.h from parts of OpenJazz.h
18  * - 3rd June 2009: Created network.h from parts of OpenJazz.h
19  * - 13th July 2009: Created controls.h from parts of OpenJazz.h
20  * - 13th July 2009: Created graphics.h from parts of OpenJazz.h
21  * - 30th April 2010: Created util.h from parts of OpenJazz.h
22  * - 30th April 2010: Created loop.h from parts of OpenJazz.h
23  *
24  * @par Licence:
25  * Copyright (c) 2005-2017 Alister Thomson
26  *
27  * OpenJazz is distributed under the terms of
28  * the GNU General Public License, version 2.0
29  *
30  * You should have received a copy of the GNU General Public License
31  * along with this program; if not, write to the Free Software
32  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
33  *
34  */
35 
36 
37 #ifndef _OPENJAZZ_H
38 #define _OPENJAZZ_H
39 
40 #ifndef EXTERN
41 	#define EXTERN extern
42 #endif
43 
44 
45 // Constants
46 
47 // Numbers in -10 exponent fixed point
48 #define FE   128
49 #define FQ   256
50 #define FH   512
51 #define F1   1024
52 #define F2   2048
53 #define F4   4096
54 #define F8   8192
55 #define F10  10240
56 #define F12  12288
57 #define F16  16384
58 #define F20  20480
59 #define F24  24576
60 #define F32  32768
61 #define F36  36864
62 #define F40  40960
63 #define F80  81920
64 #define F64  65536
65 #define F100 102400
66 #define F160 163840
67 #define F192 196608
68 
69 // Standard string length
70 #define STRING_LENGTH 32
71 
72 // Return values
73 #define E_N_OTHER      -(0x26)
74 #define E_N_DISCONNECT -(0x25)
75 #define E_N_CONNECT    -(0x24)
76 #define E_N_ADDRESS    -(0x23)
77 #define E_N_LISTEN     -(0x22)
78 #define E_N_BIND       -(0x21)
79 #define E_N_SOCKET     -(0x20)
80 #define E_DATA         -(0x15)
81 #define E_VERSION      -(0x14)
82 #define E_TIMEOUT      -(0x13)
83 #define E_DEMOTYPE     -(0x12)
84 #define E_FILE         -(0x11)
85 #define E_VIDEO        -(0x10)
86 #define E_RETURN       -(0x02)
87 #define E_QUIT         -(0x01)
88 
89 #define E_NONE       0
90 
91 
92 // Macros
93 
94 // For fixed-point operations
95 #define FTOI(x) ((x) >> 10) ///< Fixed to Int
96 #define ITOF(x) ((x) << 10) ///< Int to Fixed
97 #define MUL(x, y) (((x) * (y)) >> 10) ///< multiplication
98 #define DIV(x, y) (((x) << 10) / (y)) ///< division
99 
100 
101 // Datatype
102 
103 typedef int fixed; ///< Custom fixed-point data type
104 
105 #endif
106 
107