summaryrefslogtreecommitdiff
path: root/System.cpp
blob: 512d2b521e2855ad597ab3d35a29dbb689cfb924 (plain) (blame)
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
/* *******************************************************************
 *  Includes
 * ******************************************************************/

#include <Arduino.h>
#include <Gamebuino.h>

/* *******************************************************************
 *  Defines
 * ******************************************************************/

#define mCHECK_COLLISION(x1, y1, w1, h1, x2, y2, w2, h2)    \
            (!( ((x1) >= (x2) + (w2))       \
                        ||                  \
                ((x2) >= (x1) + (w1))       \
                        ||                  \
                ((y1) >= (y2) + (h2))       \
                        ||                  \
                ((y2) >= (y1) + (h1))   )

/* *******************************************************************
 *  Types definition
 * ******************************************************************/

/* *******************************************************************
 *  Global variables definition
 * ******************************************************************/

/*****************************************************************//**
 *
 * \brief   Global interface to Gamebuino low-level libs.
 *
 *********************************************************************/
Gamebuino gb;

/* *******************************************************************
 *  Local variables definition
 * ******************************************************************/

/* *******************************************************************
 *  Local prototypes declaration
 * ******************************************************************/

/* *******************************************************************
 *  Functions definition
 * ******************************************************************/

/*****************************************************************//**
 *
 * \brief   Initializes the device and game parameters.
 *
 *********************************************************************/
void SystemInit(void)
{
    /* Arduino initialization routine. */
    init();

    /* Initialize Gamebuino libs. */
    gb.begin();

#ifdef USBCON

    USBDevice.attach();

#endif /* USBCON */
}