Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/wiimote/src/external/wiicpp/wiic/definitions.h @ 11183

Last change on this file since 11183 was 9780, checked in by georgr, 11 years ago

WiiCpp library successfully (?) added - won't work without libbluetooth-dev

  • Property svn:executable set to *
File size: 2.1 KB
Line 
1/*
2 *    definitions.h
3 *
4 *        This file is part of WiiC, written by:
5 *              Gabriele Randelli
6 *              Email: randelli@dis.uniroma1.it
7 *
8 *    Copyright 2010
9 *             
10 *        This file is based on Wiiuse, written By:
11 *              Michael Laforest        < para >
12 *              Email: < thepara (--AT--) g m a i l [--DOT--] com >
13 *
14 *        Copyright 2006-2007
15 *
16 *    This program is free software; you can redistribute it and/or modify
17 *    it under the terms of the GNU General Public License as published by
18 *    the Free Software Foundation; either version 3 of the License, or
19 *    (at your option) any later version.
20 *
21 *    This program is distributed in the hope that it will be useful,
22 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
23 *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
24 *    GNU General Public License for more details.
25 *
26 *    You should have received a copy of the GNU General Public License
27 *    along with this program.  If not, see <http://www.gnu.org/licenses/>.
28 *
29 *        $Header$
30 */
31
32/**
33 *      @file
34 *      @brief General definitions.
35 */
36
37#ifndef DEFINITIONS_H_INCLUDED
38#define DEFINITIONS_H_INCLUDED
39
40/* this is WiiC - used to distinguish from third party programs using wiic.h */
41
42#define WIIMOTE_PI                      3.14159265f
43
44/* Error output macros */
45#define WIIC_ERROR(fmt, ...)            fprintf(stderr, "[ERROR] " fmt "\n", ##__VA_ARGS__)
46
47/* Warning output macros */
48#define WIIC_WARNING(fmt, ...)  fprintf(stderr, "[WARNING] " fmt "\n",  ##__VA_ARGS__)
49
50/* Information output macros */
51#define WIIC_INFO(fmt, ...)             fprintf(stderr, "[INFO] " fmt "\n", ##__VA_ARGS__)
52
53#ifdef WITH_WIIC_DEBUG
54        #define WIIC_DEBUG(fmt, ...)    fprintf(stderr, "[DEBUG] " __FILE__ ":%i: " fmt "\n", __LINE__, ##__VA_ARGS__)
55#else
56        #define WIIC_DEBUG(fmt, ...)
57#endif
58
59/* Convert between radians and degrees */
60#define RAD_TO_DEGREE(r)        ((r * 180.0f) / WIIMOTE_PI)
61#define DEGREE_TO_RAD(d)        (d * (WIIMOTE_PI / 180.0f))
62
63/* Convert to big endian */
64#define BIG_ENDIAN_LONG(i)                              (htonl(i))
65#define BIG_ENDIAN_SHORT(i)                             (htons(i))
66
67#define absf(x)                                         ((x >= 0) ? (x) : (x * -1.0f))
68#define diff_f(x, y)                            ((x >= y) ? (absf(x - y)) : (absf(y - x)))
69
70#endif // DEFINITIONS_H_INCLUDED
Note: See TracBrowser for help on using the repository browser.