PageRenderTime 21ms CodeModel.GetById 2ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/xbmc/visualizations/XBMCProjectM/libprojectM/sdltoprojectM.h

http://github.com/xbmc/xbmc
C++ Header | 165 lines | 122 code | 9 blank | 34 comment | 2 complexity | 9bb9abbb1fe8e73f84f700f06bf3d0c5 MD5 | raw file
  1/**
  2 * projectM -- Milkdrop-esque visualisation SDK
  3 * Copyright (C)2003-2007 projectM Team
  4 *
  5 * This library is free software; you can redistribute it and/or
  6 * modify it under the terms of the GNU Lesser General Public
  7 * License as published by the Free Software Foundation; either
  8 * version 2.1 of the License, or (at your option) any later version.
  9 *
 10 * This library is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13 * Lesser General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU Lesser General Public
 16 * License along with this library; if not, write to the Free Software
 17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 18 * See 'LICENSE.txt' included within this release
 19 *
 20 */
 21/**
 22 * $Id: sdltoprojectM.hpp,v 1.1 2004/10/08 00:35:28 cvs Exp $
 23 *
 24 * Translates SDL -> projectM variables
 25 *
 26 * $Log: sdltoprojectM.hpp,v $
 27 * Revision 1.1  2004/10/08 00:35:28  cvs
 28 * Moved and imported
 29 *
 30 * Revision 1.1.1.1  2004/10/04 12:56:00  cvs
 31 * Imported
 32 *
 33 */
 34
 35#ifndef _SDLTOPROJECTM_H
 36#define _SDLTOPROJECTM_H
 37
 38#include "event.h"
 39
 40 //#include "projectM/projectM.hpp"
 41#ifdef WIN32
 42#include <SDL.h>
 43#else
 44#include <SDL/SDL.h>
 45#endif
 46
 47inline projectMEvent sdl2pmEvent( SDL_Event event ) { \
 48							
 49    switch ( event.type ) { \
 50        case SDL_VIDEORESIZE:
 51            return PROJECTM_VIDEORESIZE; \
 52        case SDL_KEYUP: \
 53            return PROJECTM_KEYUP; \
 54        case SDL_KEYDOWN: \
 55            return PROJECTM_KEYDOWN; \
 56        default:
 57            return PROJECTM_KEYUP; \
 58      } \
 59  } \
 60
 61inline projectMKeycode sdl2pmKeycode( SDLKey keysym ) { \
 62    switch ( keysym ) { \
 63        case SDLK_F1: \
 64            return PROJECTM_K_F1; \
 65        case SDLK_F2: \
 66            return PROJECTM_K_F2; \
 67        case SDLK_F3: \
 68            return PROJECTM_K_F3; \
 69        case SDLK_F4: \
 70            return PROJECTM_K_F4; \
 71        case SDLK_F5: \
 72            return PROJECTM_K_F5; \
 73        case SDLK_F6: \
 74            return PROJECTM_K_F6; \
 75        case SDLK_F7: \
 76            return PROJECTM_K_F7; \
 77        case SDLK_F8: \
 78            return PROJECTM_K_F8; \
 79        case SDLK_F9: \
 80            return PROJECTM_K_F9; \
 81        case SDLK_F10: \
 82            return PROJECTM_K_F10; \
 83        case SDLK_F11: \
 84            return PROJECTM_K_F11; \
 85        case SDLK_F12: \
 86            return PROJECTM_K_F12; \
 87	  case SDLK_ESCAPE: \
 88	    return PROJECTM_K_ESCAPE; 
 89    case SDLK_a:
 90      return PROJECTM_K_a;
 91    case SDLK_b:
 92      return PROJECTM_K_b;
 93    case SDLK_c:  
 94      return PROJECTM_K_c;
 95    case SDLK_d: 
 96      return PROJECTM_K_d; 
 97    case SDLK_e:
 98      return PROJECTM_K_e; 
 99    case SDLK_f: 
100      return PROJECTM_K_f; 
101    case SDLK_g: 
102      return PROJECTM_K_g; 
103    case SDLK_h: 
104      return PROJECTM_K_h; 
105    case SDLK_i: 
106      return PROJECTM_K_i; 
107    case SDLK_j:
108      return PROJECTM_K_j;
109    case SDLK_k:
110      return PROJECTM_K_k;
111    case SDLK_l:  
112      return PROJECTM_K_l;
113    case SDLK_m: 
114      return PROJECTM_K_m; 
115    case SDLK_n:
116      return PROJECTM_K_n; 
117    case SDLK_o: 
118      return PROJECTM_K_o; 
119    case SDLK_p: 
120      return PROJECTM_K_p; 
121    case SDLK_q: 
122      return PROJECTM_K_q; 
123    case SDLK_r: 
124      return PROJECTM_K_r; 
125    case SDLK_s: 
126      return PROJECTM_K_s; 
127    case SDLK_t:
128      return PROJECTM_K_t; 
129    case SDLK_u: 
130      return PROJECTM_K_u; 
131    case SDLK_v: 
132      return PROJECTM_K_v; 
133    case SDLK_w: 
134      return PROJECTM_K_w; 
135    case SDLK_x: 
136      return PROJECTM_K_x; 
137    case SDLK_y: 
138      return PROJECTM_K_y; 
139    case SDLK_z: 
140      return PROJECTM_K_z; 
141    case SDLK_UP:
142      return PROJECTM_K_UP;
143    case SDLK_RETURN:
144      return PROJECTM_K_RETURN;
145    case SDLK_RIGHT:
146      return PROJECTM_K_RIGHT;
147    case SDLK_LEFT:
148      return PROJECTM_K_LEFT;
149    case SDLK_DOWN:
150      return PROJECTM_K_DOWN;
151    case SDLK_PAGEUP:
152      return PROJECTM_K_PAGEUP;
153    case SDLK_PAGEDOWN:
154      return PROJECTM_K_PAGEDOWN;
155   
156        default: \
157            return PROJECTM_K_NONE; \
158      } \
159  } \
160
161inline projectMModifier sdl2pmModifier( SDLMod mod ) { \
162    return PROJECTM_KMOD_LSHIFT; \
163  } \
164
165#endif /** _SDLTOPROJECTM_H */