Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.26 KB | None | 0 0
  1. void Game::handleEvents()
  2. {
  3. SDL_Event event;
  4. if(SDL_PollEvent(&event))
  5. {
  6. switch (event.type)
  7. {
  8. case SDL_MOUSEBUTTONDOWN:
  9. m_bRunning = false;
  10. break;
  11. default:
  12. break;
  13. }
  14. }
  15. }
  16.  
  17. /*
  18. SDL_image: An example image loading library for use with SDL
  19. Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
  20.  
  21. This software is provided 'as-is', without any express or implied
  22. warranty. In no event will the authors be held liable for any damages
  23. arising from the use of this software.
  24.  
  25. Permission is granted to anyone to use this software for any purpose,
  26. including commercial applications, and to alter it and redistribute it
  27. freely, subject to the following restrictions:
  28.  
  29. 1. The origin of this software must not be misrepresented; you must not
  30. claim that you wrote the original software. If you use this software
  31. in a product, an acknowledgment in the product documentation would be
  32. appreciated but is not required.
  33. 2. Altered source versions must be plainly marked as such, and must not be
  34. misrepresented as being the original software.
  35. 3. This notice may not be removed or altered from any source distribution.
  36. */
  37.  
  38. /* A simple library to load images of various formats as SDL surfaces */
  39.  
  40. #ifndef _SDL_IMAGE_H
  41. #define _SDL_IMAGE_H
  42.  
  43. #include "SDL.h"
  44. #include "SDL_version.h"
  45. #include "begin_code.h"
  46.  
  47. /* Set up for C function definitions, even when using C++ */
  48. #ifdef __cplusplus
  49. extern "C" {
  50. #endif
  51.  
  52. /* Printable format: "%d.%d.%d", MAJOR, MINOR, PATCHLEVEL
  53. */
  54. #define SDL_IMAGE_MAJOR_VERSION 2
  55. #define SDL_IMAGE_MINOR_VERSION 0
  56. #define SDL_IMAGE_PATCHLEVEL 0
  57.  
  58. /* This macro can be used to fill a version structure with the compile-time
  59. * version of the SDL_image library.
  60. */
  61. #define SDL_IMAGE_VERSION(X)
  62. {
  63. (X)->major = SDL_IMAGE_MAJOR_VERSION;
  64. (X)->minor = SDL_IMAGE_MINOR_VERSION;
  65. (X)->patch = SDL_IMAGE_PATCHLEVEL;
  66. }
  67.  
  68. /* This function gets the version of the dynamically linked SDL_image library.
  69. it should NOT be used to fill a version structure, instead you should
  70. use the SDL_IMAGE_VERSION() macro.
  71. */
  72. extern DECLSPEC const SDL_version * SDLCALL IMG_Linked_Version(void);
  73.  
  74. typedef enum
  75. {
  76. IMG_INIT_JPG = 0x00000001,
  77. IMG_INIT_PNG = 0x00000002,
  78. IMG_INIT_TIF = 0x00000004,
  79. IMG_INIT_WEBP = 0x00000008
  80. } IMG_InitFlags;
  81.  
  82. /* Loads dynamic libraries and prepares them for use. Flags should be
  83. one or more flags from IMG_InitFlags OR'd together.
  84. It returns the flags successfully initialized, or 0 on failure.
  85. */
  86. extern DECLSPEC int SDLCALL IMG_Init(int flags);
  87.  
  88. /* Unloads libraries loaded with IMG_Init */
  89. extern DECLSPEC void SDLCALL IMG_Quit(void);
  90.  
  91. /* Load an image from an SDL data source.
  92. The 'type' may be one of: "BMP", "GIF", "PNG", etc.
  93.  
  94. If the image format supports a transparent pixel, SDL will set the
  95. colorkey for the surface. You can enable RLE acceleration on the
  96. surface afterwards by calling:
  97. SDL_SetColorKey(image, SDL_RLEACCEL, image->format->colorkey);
  98. */
  99. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTyped_RW(SDL_RWops *src, int freesrc, const char *type);
  100. /* Convenience functions */
  101. extern DECLSPEC SDL_Surface * SDLCALL IMG_Load(const char *file);
  102. extern DECLSPEC SDL_Surface * SDLCALL IMG_Load_RW(SDL_RWops *src, int freesrc);
  103.  
  104. #if SDL_VERSION_ATLEAST(2,0,0)
  105. /* Load an image directly into a render texture.
  106. */
  107. extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture(SDL_Renderer *renderer, const char *file);
  108. extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTexture_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc);
  109. extern DECLSPEC SDL_Texture * SDLCALL IMG_LoadTextureTyped_RW(SDL_Renderer *renderer, SDL_RWops *src, int freesrc, const char *type);
  110. #endif /* SDL 2.0 */
  111.  
  112. /* Functions to detect a file type, given a seekable source */
  113. extern DECLSPEC int SDLCALL IMG_isICO(SDL_RWops *src);
  114. extern DECLSPEC int SDLCALL IMG_isCUR(SDL_RWops *src);
  115. extern DECLSPEC int SDLCALL IMG_isBMP(SDL_RWops *src);
  116. extern DECLSPEC int SDLCALL IMG_isGIF(SDL_RWops *src);
  117. extern DECLSPEC int SDLCALL IMG_isJPG(SDL_RWops *src);
  118. extern DECLSPEC int SDLCALL IMG_isLBM(SDL_RWops *src);
  119. extern DECLSPEC int SDLCALL IMG_isPCX(SDL_RWops *src);
  120. extern DECLSPEC int SDLCALL IMG_isPNG(SDL_RWops *src);
  121. extern DECLSPEC int SDLCALL IMG_isPNM(SDL_RWops *src);
  122. extern DECLSPEC int SDLCALL IMG_isTIF(SDL_RWops *src);
  123. extern DECLSPEC int SDLCALL IMG_isXCF(SDL_RWops *src);
  124. extern DECLSPEC int SDLCALL IMG_isXPM(SDL_RWops *src);
  125. extern DECLSPEC int SDLCALL IMG_isXV(SDL_RWops *src);
  126. extern DECLSPEC int SDLCALL IMG_isWEBP(SDL_RWops *src);
  127.  
  128. /* Individual loading functions */
  129. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadICO_RW(SDL_RWops *src);
  130. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadCUR_RW(SDL_RWops *src);
  131. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadBMP_RW(SDL_RWops *src);
  132. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadGIF_RW(SDL_RWops *src);
  133. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadJPG_RW(SDL_RWops *src);
  134. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadLBM_RW(SDL_RWops *src);
  135. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPCX_RW(SDL_RWops *src);
  136. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNG_RW(SDL_RWops *src);
  137. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadPNM_RW(SDL_RWops *src);
  138. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTGA_RW(SDL_RWops *src);
  139. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadTIF_RW(SDL_RWops *src);
  140. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXCF_RW(SDL_RWops *src);
  141. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXPM_RW(SDL_RWops *src);
  142. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadXV_RW(SDL_RWops *src);
  143. extern DECLSPEC SDL_Surface * SDLCALL IMG_LoadWEBP_RW(SDL_RWops *src);
  144.  
  145. extern DECLSPEC SDL_Surface * SDLCALL IMG_ReadXPMFromArray(char **xpm);
  146.  
  147. /* Individual saving functions */
  148. extern DECLSPEC int SDLCALL IMG_SavePNG(SDL_Surface *surface, const char *file);
  149. extern DECLSPEC int SDLCALL IMG_SavePNG_RW(SDL_Surface *surface, SDL_RWops *dst, int freedst);
  150.  
  151. /* We'll use SDL for reporting errors */
  152. #define IMG_SetError SDL_SetError
  153. #define IMG_GetError SDL_GetError
  154.  
  155. /* Ends C function definitions when using C++ */
  156. #ifdef __cplusplus
  157. }
  158. #endif
  159. #include "close_code.h"
  160.  
  161. #endif /* _SDL_IMAGE_H */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement