Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Initial commit

  • Loading branch information...
commit 6ec3a1a7c0729b3a2a1f6015a3d1f37ae71c0908 0 parents
mave1337@gmail.com authored
Showing with 38,560 additions and 0 deletions.
  1. +135 −0 client/Ball.cpp
  2. +36 −0 client/Ball.h
  3. +232 −0 client/Game.cpp
  4. +53 −0 client/Game.h
  5. +54 −0 client/Graphics.cpp
  6. +25 −0 client/Graphics.h
  7. +50 −0 client/Keyboard.cpp
  8. +26 −0 client/Keyboard.h
  9. +185 −0 client/Network.cpp
  10. +44 −0 client/Network.h
  11. +122 −0 client/Platform.cpp
  12. +34 −0 client/Platform.h
  13. +1 −0  client/StdInc.cpp
  14. +13 −0 client/StdInc.h
  15. +260 −0 client/main.cpp
  16. +244 −0 client/pongmp-client.vcproj
  17. +19 −0 deps/allegro/include/allegro5/alcompat.h
  18. +32 −0 deps/allegro/include/allegro5/alinline.h
  19. +74 −0 deps/allegro/include/allegro5/allegro.h
  20. +2 −0  deps/allegro/include/allegro5/allegro5.h
  21. +40 −0 deps/allegro/include/allegro5/allegro_acodec.h
  22. +373 −0 deps/allegro/include/allegro5/allegro_audio.h
  23. +68 −0 deps/allegro/include/allegro5/allegro_color.h
  24. +49 −0 deps/allegro/include/allegro5/allegro_direct3d.h
  25. +110 −0 deps/allegro/include/allegro5/allegro_font.h
  26. +42 −0 deps/allegro/include/allegro5/allegro_image.h
  27. +32 −0 deps/allegro/include/allegro5/allegro_iphone.h
  28. +40 −0 deps/allegro/include/allegro5/allegro_memfile.h
  29. +90 −0 deps/allegro/include/allegro5/allegro_native_dialog.h
  30. +144 −0 deps/allegro/include/allegro5/allegro_opengl.h
  31. +41 −0 deps/allegro/include/allegro5/allegro_physfs.h
  32. +161 −0 deps/allegro/include/allegro5/allegro_primitives.h
  33. +46 −0 deps/allegro/include/allegro5/allegro_ttf.h
  34. +38 −0 deps/allegro/include/allegro5/allegro_windows.h
  35. +30 −0 deps/allegro/include/allegro5/altime.h
  36. +103 −0 deps/allegro/include/allegro5/base.h
  37. +196 −0 deps/allegro/include/allegro5/bitmap.h
  38. +31 −0 deps/allegro/include/allegro5/bitmap_io.h
  39. +23 −0 deps/allegro/include/allegro5/color.h
  40. +45 −0 deps/allegro/include/allegro5/config.h
  41. +77 −0 deps/allegro/include/allegro5/debug.h
  42. +184 −0 deps/allegro/include/allegro5/display.h
  43. +39 −0 deps/allegro/include/allegro5/error.h
  44. +241 −0 deps/allegro/include/allegro5/events.h
  45. +99 −0 deps/allegro/include/allegro5/file.h
  46. +41 −0 deps/allegro/include/allegro5/fixed.h
  47. +46 −0 deps/allegro/include/allegro5/fmaths.h
  48. +130 −0 deps/allegro/include/allegro5/fshook.h
  49. +258 −0 deps/allegro/include/allegro5/inline/fmaths.inl
  50. +62 −0 deps/allegro/include/allegro5/internal/aintern.h
  51. +23 −0 deps/allegro/include/allegro5/internal/aintern_aatree.h
  52. +9 −0 deps/allegro/include/allegro5/internal/aintern_acodec_cfg.h
  53. +120 −0 deps/allegro/include/allegro5/internal/aintern_atomicops.h
  54. +319 −0 deps/allegro/include/allegro5/internal/aintern_audio.h
  55. +6 −0 deps/allegro/include/allegro5/internal/aintern_audio_cfg.h
  56. +155 −0 deps/allegro/include/allegro5/internal/aintern_bitmap.h
  57. +110 −0 deps/allegro/include/allegro5/internal/aintern_blend.h
  58. +29 −0 deps/allegro/include/allegro5/internal/aintern_config.h
  59. +1,523 −0 deps/allegro/include/allegro5/internal/aintern_convert.h
  60. +18 −0 deps/allegro/include/allegro5/internal/aintern_direct3d.h
  61. +151 −0 deps/allegro/include/allegro5/internal/aintern_display.h
  62. +31 −0 deps/allegro/include/allegro5/internal/aintern_dtor.h
  63. +48 −0 deps/allegro/include/allegro5/internal/aintern_events.h
  64. +27 −0 deps/allegro/include/allegro5/internal/aintern_file.h
  65. +16 −0 deps/allegro/include/allegro5/internal/aintern_float.h
  66. +33 −0 deps/allegro/include/allegro5/internal/aintern_fshook.h
  67. +51 −0 deps/allegro/include/allegro5/internal/aintern_gp2xwiz.h
  68. +73 −0 deps/allegro/include/allegro5/internal/aintern_image.h
  69. +11 −0 deps/allegro/include/allegro5/internal/aintern_image_cfg.h
  70. +42 −0 deps/allegro/include/allegro5/internal/aintern_iphone.h
  71. +89 −0 deps/allegro/include/allegro5/internal/aintern_joystick.h
  72. +62 −0 deps/allegro/include/allegro5/internal/aintern_keyboard.h
  73. +75 −0 deps/allegro/include/allegro5/internal/aintern_list.h
  74. +43 −0 deps/allegro/include/allegro5/internal/aintern_mouse.h
  75. +51 −0 deps/allegro/include/allegro5/internal/aintern_native_dialog.h
  76. +3 −0  deps/allegro/include/allegro5/internal/aintern_native_dialog_cfg.h
  77. +140 −0 deps/allegro/include/allegro5/internal/aintern_opengl.h
  78. +14 −0 deps/allegro/include/allegro5/internal/aintern_path.h
  79. +460 −0 deps/allegro/include/allegro5/internal/aintern_pixels.h
  80. +13 −0 deps/allegro/include/allegro5/internal/aintern_prim.h
  81. +21 −0 deps/allegro/include/allegro5/internal/aintern_prim_directx.h
  82. +10 −0 deps/allegro/include/allegro5/internal/aintern_prim_opengl.h
  83. +13 −0 deps/allegro/include/allegro5/internal/aintern_prim_soft.h
  84. +58 −0 deps/allegro/include/allegro5/internal/aintern_system.h
  85. +52 −0 deps/allegro/include/allegro5/internal/aintern_thread.h
  86. +16 −0 deps/allegro/include/allegro5/internal/aintern_timer.h
  87. +24 −0 deps/allegro/include/allegro5/internal/aintern_tls.h
  88. +27 −0 deps/allegro/include/allegro5/internal/aintern_tri_soft.h
  89. +1 −0  deps/allegro/include/allegro5/internal/aintern_ttf_cfg.h
  90. +55 −0 deps/allegro/include/allegro5/internal/aintern_vector.h
  91. +235 −0 deps/allegro/include/allegro5/internal/aintern_xglx.h
  92. +347 −0 deps/allegro/include/allegro5/internal/alconfig.h
  93. +309 −0 deps/allegro/include/allegro5/internal/bstrlib.h
  94. +90 −0 deps/allegro/include/allegro5/joystick.h
  95. +71 −0 deps/allegro/include/allegro5/keyboard.h
  96. +189 −0 deps/allegro/include/allegro5/keycodes.h
  97. +73 −0 deps/allegro/include/allegro5/memory.h
  98. +128 −0 deps/allegro/include/allegro5/mouse.h
  99. +2,564 −0 deps/allegro/include/allegro5/opengl/GLext/gl_ext_alias.h
  100. +2,563 −0 deps/allegro/include/allegro5/opengl/GLext/gl_ext_api.h
  101. +5,108 −0 deps/allegro/include/allegro5/opengl/GLext/gl_ext_defs.h
  102. +358 −0 deps/allegro/include/allegro5/opengl/GLext/gl_ext_list.h
  103. +213 −0 deps/allegro/include/allegro5/opengl/GLext/glx_ext_alias.h
  104. +212 −0 deps/allegro/include/allegro5/opengl/GLext/glx_ext_api.h
  105. +505 −0 deps/allegro/include/allegro5/opengl/GLext/glx_ext_defs.h
  106. +40 −0 deps/allegro/include/allegro5/opengl/GLext/glx_ext_list.h
  107. +168 −0 deps/allegro/include/allegro5/opengl/GLext/wgl_ext_alias.h
  108. +167 −0 deps/allegro/include/allegro5/opengl/GLext/wgl_ext_api.h
  109. +386 −0 deps/allegro/include/allegro5/opengl/GLext/wgl_ext_defs.h
  110. +38 −0 deps/allegro/include/allegro5/opengl/GLext/wgl_ext_list.h
  111. +140 −0 deps/allegro/include/allegro5/opengl/gl_ext.h
  112. +56 −0 deps/allegro/include/allegro5/path.h
  113. +15 −0 deps/allegro/include/allegro5/platform/aintiphone.h
  114. +174 −0 deps/allegro/include/allegro5/platform/aintlnx.h
  115. +160 −0 deps/allegro/include/allegro5/platform/aintosx.h
  116. +94 −0 deps/allegro/include/allegro5/platform/aintunix.h
  117. +101 −0 deps/allegro/include/allegro5/platform/aintuthr.h
  118. +208 −0 deps/allegro/include/allegro5/platform/aintwin.h
  119. +16 −0 deps/allegro/include/allegro5/platform/aintwiz.h
  120. +75 −0 deps/allegro/include/allegro5/platform/aintwthr.h
  121. +10 −0 deps/allegro/include/allegro5/platform/aintxglx.h
  122. +422 −0 deps/allegro/include/allegro5/platform/al386gcc.h
  123. +269 −0 deps/allegro/include/allegro5/platform/al386vc.h
  124. +241 −0 deps/allegro/include/allegro5/platform/al386wat.h
  125. +100 −0 deps/allegro/include/allegro5/platform/albcc32.h
  126. +91 −0 deps/allegro/include/allegro5/platform/aldmc.h
  127. +11 −0 deps/allegro/include/allegro5/platform/aliphone.h
  128. +35 −0 deps/allegro/include/allegro5/platform/aliphonecfg.h
  129. +91 −0 deps/allegro/include/allegro5/platform/almngw32.h
  130. +114 −0 deps/allegro/include/allegro5/platform/almsvc.h
  131. +77 −0 deps/allegro/include/allegro5/platform/alosx.h
  132. +39 −0 deps/allegro/include/allegro5/platform/alosxcfg.h
  133. +183 −0 deps/allegro/include/allegro5/platform/alplatf.h
  134. +55 −0 deps/allegro/include/allegro5/platform/alucfg.h
  135. +23 −0 deps/allegro/include/allegro5/platform/alunix.h
  136. +190 −0 deps/allegro/include/allegro5/platform/alwatcom.h
  137. +58 −0 deps/allegro/include/allegro5/platform/alwin.h
  138. +32 −0 deps/allegro/include/allegro5/platform/alwiz.h
  139. +43 −0 deps/allegro/include/allegro5/platform/alwizcfg.h
  140. +35 −0 deps/allegro/include/allegro5/platform/astdbool.h
  141. +75 −0 deps/allegro/include/allegro5/platform/astdint.h
  142. +49 −0 deps/allegro/include/allegro5/system.h
  143. +67 −0 deps/allegro/include/allegro5/threads.h
  144. +65 −0 deps/allegro/include/allegro5/timer.h
  145. +65 −0 deps/allegro/include/allegro5/tls.h
  146. +34 −0 deps/allegro/include/allegro5/transformations.h
  147. +150 −0 deps/allegro/include/allegro5/utf8.h
  148. +2,403 −0 deps/allegro/include/physfs.h
  149. BIN  deps/allegro/lib/allegro-5.0.4-monolith-static-mt.lib
  150. BIN  deps/allegro/lib/allegro-5.0.4-static-mt.lib
  151. BIN  deps/allegro/lib/allegro_acodec-5.0.4-static-mt.lib
  152. BIN  deps/allegro/lib/allegro_audio-5.0.4-static-mt.lib
  153. BIN  deps/allegro/lib/allegro_color-5.0.4-static-mt.lib
  154. BIN  deps/allegro/lib/allegro_dialog-5.0.4-static-mt.lib
  155. BIN  deps/allegro/lib/allegro_font-5.0.4-static-mt.lib
  156. BIN  deps/allegro/lib/allegro_image-5.0.4-static-mt.lib
  157. BIN  deps/allegro/lib/allegro_memfile-5.0.4-static-mt.lib
  158. BIN  deps/allegro/lib/allegro_physfs-5.0.4-static-mt.lib
  159. BIN  deps/allegro/lib/allegro_primitives-5.0.4-static-mt.lib
  160. BIN  deps/allegro/lib/allegro_ttf-5.0.4-static-mt.lib
  161. BIN  deps/allegro/lib/dumb-0.9.3-static-mt.lib
  162. BIN  deps/allegro/lib/freetype-2.4.4-static-mt.lib
  163. BIN  deps/allegro/lib/libFLAC-1.2.1-static-mt.lib
  164. BIN  deps/allegro/lib/libogg-1.2.1-static-mt.lib
  165. BIN  deps/allegro/lib/libvorbis-1.3.2-static-mt.lib
  166. BIN  deps/allegro/lib/libvorbisfile-1.3.2-static-mt.lib
  167. BIN  deps/allegro/lib/zlib-1.2.5-static-mt.lib
  168. BIN  deps/raknet/Lib/RakNetLibStatic.lib
  169. +23 −0 deps/raknet/Source/AutopatcherPatchContext.h
  170. +72 −0 deps/raknet/Source/AutopatcherRepositoryInterface.h
  171. +1,172 −0 deps/raknet/Source/BitStream.cpp
  172. +2,032 −0 deps/raknet/Source/BitStream.h
  173. +332 −0 deps/raknet/Source/CCRakNetSlidingWindow.cpp
  174. +209 −0 deps/raknet/Source/CCRakNetSlidingWindow.h
  175. +798 −0 deps/raknet/Source/CCRakNetUDT.cpp
  176. +394 −0 deps/raknet/Source/CCRakNetUDT.h
  177. +1 −0  deps/raknet/Source/CMakeLists.txt
  178. +97 −0 deps/raknet/Source/CheckSum.cpp
  179. +53 −0 deps/raknet/Source/CheckSum.h
  180. +242 −0 deps/raknet/Source/CloudClient.cpp
  181. +163 −0 deps/raknet/Source/CloudClient.h
  182. +159 −0 deps/raknet/Source/CloudCommon.cpp
  183. +141 −0 deps/raknet/Source/CloudCommon.h
  184. +1,673 −0 deps/raknet/Source/CloudServer.cpp
  185. +375 −0 deps/raknet/Source/CloudServer.h
  186. +161 −0 deps/raknet/Source/CommandParserInterface.cpp
  187. +140 −0 deps/raknet/Source/CommandParserInterface.h
  188. +299 −0 deps/raknet/Source/ConnectionGraph2.cpp
  189. +118 −0 deps/raknet/Source/ConnectionGraph2.h
  190. +311 −0 deps/raknet/Source/ConsoleServer.cpp
  191. +77 −0 deps/raknet/Source/ConsoleServer.h
  192. +1,146 −0 deps/raknet/Source/DS_BPlusTree.h
Sorry, we could not display the entire diff because too many files (656) changed.
135 client/Ball.cpp
@@ -0,0 +1,135 @@
+#include "StdInc.h"
+#include "Ball.h"
+#include <math.h>
+
+Ball::Ball()
+ : m_bInteraction(false), m_fAngle(0.0f), m_fVelX(0.0f), m_fVelY(0.0f)
+{
+ m_fPosX = SCREEN_W / 2.0f - BALL_SIZE / 2.0f;
+ m_fPosY = SCREEN_H / 2.0f - BALL_SIZE / 2.0f;
+}
+
+Ball::~Ball()
+{
+}
+
+bool Ball::initialize()
+{
+ m_pBitmap = al_create_bitmap(BALL_SIZE, BALL_SIZE);
+ if (!m_pBitmap)
+ {
+ return false;
+ }
+
+ al_set_target_bitmap(m_pBitmap);
+ al_clear_to_color(al_map_rgb(255, 255, 255));
+
+ return true;
+}
+
+void Ball::deinitialize()
+{
+ al_destroy_bitmap(m_pBitmap);
+}
+
+bool Ball::process()
+{
+ bool bInteraction = m_bInteraction;
+ m_bInteraction = false;
+
+ bool bRedraw = bInteraction;
+
+ if (m_bInteraction)
+ {
+ /*if (m_fVelocity > 10.0f)
+ {
+ m_fVelocity = 10.0f;
+ }
+ else if (m_fVelocity < -10.0f)
+ {
+ m_fVelocity = -10.0f;
+ }*/
+ }
+ /*else
+ {
+ if (m_fVelocity < 0.0f)
+ {
+ bRedraw = true;
+ m_fVelocity += 0.15f;
+ if (m_fVelocity > 0.0f) m_fVelocity = 0.0f;
+ }
+ else if (m_fVelocity > 0.0f)
+ {
+ bRedraw = true;
+ m_fVelocity -= 0.15f;
+ if (m_fVelocity < 0.0f) m_fVelocity = 0.0f;
+ }
+ }*/
+
+ m_fPosX += sin(m_fAngle * (3.1415926f / 180.0f)) * m_fVelX;
+ m_fPosY += cos(m_fAngle * (3.1415926f / 180.0f)) * m_fVelY;
+
+ if (m_fPosX < 0.0f)
+ {
+ m_fPosX = 0.0f;
+ m_fVelX = -m_fVelX;
+ }
+ else if (m_fPosX > SCREEN_W - BALL_SIZE)
+ {
+ m_fPosX = SCREEN_W - BALL_SIZE;
+ m_fVelX = -m_fVelX;
+ }
+
+ if (m_fPosY < 0.0f)
+ {
+ m_fPosY = 0.0f;
+ m_fVelY = -m_fVelY;
+ }
+ else if (m_fPosY > SCREEN_H - BALL_SIZE)
+ {
+ m_fPosY = SCREEN_H - BALL_SIZE;
+ m_fVelY = -m_fVelY;
+ }
+
+ return bRedraw;
+}
+
+void Ball::draw()
+{
+ al_draw_bitmap(m_pBitmap, m_fPosX, m_fPosY, 0);
+}
+
+void Ball::setAngle(float fAngle)
+{
+ m_fAngle = fAngle;
+}
+
+float Ball::getAngle()
+{
+ return m_fAngle;
+}
+
+void Ball::setVelocity(float fVelX, float fVelY)
+{
+ m_fVelX = fVelX;
+ m_fVelY = fVelY;
+ m_bInteraction = true;
+}
+
+void Ball::getVelocity(float &fVelX, float &fVelY)
+{
+ fVelX = m_fVelX;
+ fVelY = m_fVelY;
+}
+
+void Ball::getPosition(float &fPosX, float &fPosY)
+{
+ fPosX = m_fPosX;
+ fPosY = m_fPosY;
+}
+
+void Ball::setPosition(float fPosX, float fPosY)
+{
+ m_fPosX = fPosX;
+ m_fPosY = fPosY;
+}
36 client/Ball.h
@@ -0,0 +1,36 @@
+class Ball;
+
+#ifndef _BALL_H
+#define _BALL_H
+
+class Ball
+{
+public:
+ Ball();
+ ~Ball();
+
+ bool initialize();
+ void deinitialize();
+
+ bool process();
+ void draw();
+
+ void setAngle(float fAngle);
+ float getAngle();
+ void setVelocity(float fVelX, float fVelY);
+ void getVelocity(float &fVelX, float &fVelY);
+ void getPosition(float &fPosX, float &fPosY);
+ void setPosition(float fPosX, float fPosY);
+
+private:
+ float m_fPosX;
+ float m_fPosY;
+ float m_fAngle;
+ float m_fVelX;
+ float m_fVelY;
+ bool m_bInteraction;
+
+ ALLEGRO_BITMAP *m_pBitmap;
+};
+
+#endif
232 client/Game.cpp
@@ -0,0 +1,232 @@
+#include "StdInc.h"
+#include "Game.h"
+#include <stdio.h>
+
+Game::Game()
+ : m_bRunning(false)
+{
+ m_pGraphics = new Graphics();
+ m_pKeyboard = new Keyboard();
+
+ m_pPlatform[0] = new Platform(5);
+ m_pPlatform[1] = new Platform(SCREEN_W - PLATFORM_W - 5);
+ m_pBall = new Ball();
+
+ m_pNetwork = new Network();
+}
+
+Game::~Game()
+{
+ delete m_pGraphics;
+ delete m_pKeyboard;
+
+ delete m_pPlatform[0];
+ delete m_pPlatform[1];
+ delete m_pBall;
+
+ delete m_pNetwork;
+}
+
+bool Game::initialize()
+{
+ m_pNetwork->initialize();
+
+ m_pFrameTimer = al_create_timer(1.0 / FPS);
+ if (!m_pFrameTimer)
+ {
+ return false;
+ }
+
+ m_pNetworkTimer = al_create_timer(0.06);
+ if (!m_pNetworkTimer)
+ {
+ return false;
+ }
+
+ if (!m_pGraphics->initialize())
+ {
+ al_destroy_timer(m_pFrameTimer);
+ return false;
+ }
+
+ if (!m_pPlatform[0]->initialize() || !m_pPlatform[1]->initialize() || !m_pBall->initialize())
+ {
+ al_destroy_timer(m_pFrameTimer);
+ return false;
+ }
+
+ m_pEventQueue = al_create_event_queue();
+ if (!m_pEventQueue)
+ {
+ al_destroy_timer(m_pFrameTimer);
+ return false;
+ }
+
+ al_register_event_source(m_pEventQueue, al_get_display_event_source(m_pGraphics->getDisplay()));
+ al_register_event_source(m_pEventQueue, al_get_timer_event_source(m_pFrameTimer));
+ al_register_event_source(m_pEventQueue, al_get_timer_event_source(m_pNetworkTimer));
+ al_register_event_source(m_pEventQueue, al_get_keyboard_event_source());
+
+ al_set_target_bitmap(al_get_backbuffer(m_pGraphics->getDisplay()));
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+
+ al_flip_display();
+
+ al_start_timer(m_pFrameTimer);
+ al_start_timer(m_pNetworkTimer);
+
+ return true;
+}
+
+void Game::run()
+{
+ bool bRedraw = true;
+ bool bSendPlatform = true;
+
+ m_pBall->setAngle(-45.0f);
+ m_pBall->setVelocity(3.2f, 3.2f);
+
+ m_bRunning = true;
+ do
+ {
+ ALLEGRO_EVENT ev;
+ al_wait_for_event(m_pEventQueue, &ev);
+
+ if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
+ {
+ m_bRunning = false;
+ break;
+ }
+ else if (ev.type == ALLEGRO_EVENT_TIMER && ev.timer.source == m_pNetworkTimer)
+ {
+ if (bSendPlatform)
+ {
+ bSendPlatform = false;
+ float fX, fY;
+ m_pPlatform[0]->getPosition(fX, fY);
+ m_pNetwork->updatePlatform(fY, m_pPlatform[0]->getVelocity());
+ }
+ }
+ else if (ev.type == ALLEGRO_EVENT_TIMER && ev.timer.source == m_pFrameTimer)
+ {
+ m_pNetwork->process();
+
+ if (m_pGraphics->process()) bRedraw = true;
+
+ if (m_pKeyboard->isKeyDown(Keyboard::UP))
+ {
+ m_pPlatform[0]->decelerate(0.60f);
+ }
+ else if (m_pKeyboard->isKeyDown(Keyboard::DOWN))
+ {
+ m_pPlatform[0]->accelerate(0.60f);
+ }
+
+ // sync the platforms
+ //m_pPlatform[1]->setVelocity(m_pPlatform[0]->getVelocity());
+
+ float fX, fY;
+ m_pPlatform[0]->getPosition(fX, fY);
+ float fX2, fY2;
+ m_pPlatform[1]->getPosition(fX2, fY2);
+
+ float fBallX, fBallY;
+ m_pBall->getPosition(fBallX, fBallY);
+
+#if 0
+ if (fBallX < fX + PLATFORM_W)
+ {
+ if (fBallY + BALL_SIZE < fY || fBallY - BALL_SIZE > fY + PLATFORM_H)
+ {
+ MessageBoxA(NULL, "lose tbh", "", 0);
+ ExitProcess(0);
+ }
+ else
+ {
+ float fVelX, fVelY;
+ m_pBall->getVelocity(fVelX, fVelY);
+ m_pBall->setVelocity(-fVelX, fVelY);
+ }
+ }
+ if (fBallX + BALL_SIZE > fX2)
+ {
+ if (fBallY + BALL_SIZE < fY2 || fBallY - BALL_SIZE > fY2 + PLATFORM_H)
+ {
+ MessageBoxA(NULL, "lose tbh", "", 0);
+ ExitProcess(0);
+ }
+ else
+ {
+ float fVelX, fVelY;
+ m_pBall->getVelocity(fVelX, fVelY);
+ m_pBall->setVelocity(-fVelX, fVelY);
+ }
+ }
+#endif
+
+ if (m_pPlatform[0]->process())
+ {
+ bRedraw = true;
+ bSendPlatform = true;
+ }
+ if (m_pPlatform[1]->process()) bRedraw = true;
+ if (m_pBall->process()) bRedraw = true;
+ }
+ else if (ev.type == ALLEGRO_EVENT_KEY_DOWN)
+ {
+ m_pKeyboard->handleKeyDown(ev.keyboard.keycode);
+ }
+ else if (ev.type == ALLEGRO_EVENT_KEY_UP)
+ {
+ m_pKeyboard->handleKeyUp(ev.keyboard.keycode);
+ }
+
+ if (bRedraw && al_is_event_queue_empty(m_pEventQueue))
+ {
+ bRedraw = false;
+
+ m_pGraphics->draw();
+ for (int i = 0; i < 2; ++i)
+ {
+ m_pPlatform[i]->draw();
+ }
+ m_pBall->draw();
+
+ al_flip_display();
+ }
+ }
+ while (m_bRunning);
+}
+
+void Game::deinitialize()
+{
+ m_pNetwork->deinitialize();
+
+ m_pGraphics->deinitialize();
+ m_pPlatform[0]->deinitialize();
+ m_pPlatform[1]->deinitialize();
+ m_pBall->deinitialize();
+
+ al_destroy_timer(m_pFrameTimer);
+ al_destroy_event_queue(m_pEventQueue);
+}
+
+Graphics *Game::getGraphics()
+{
+ return m_pGraphics;
+}
+
+Keyboard *Game::getKeyboard()
+{
+ return m_pKeyboard;
+}
+
+Platform *Game::getPlatform(int i)
+{
+ return m_pPlatform[i];
+}
+
+Network *Game::getNetwork()
+{
+ return m_pNetwork;
+}
53 client/Game.h
@@ -0,0 +1,53 @@
+class Game;
+
+#ifndef _GAME_H
+#define _GAME_H
+
+#include <allegro5/allegro.h>
+
+#include <allegro5/allegro_font.h>
+#include <allegro5/allegro_ttf.h>
+
+#include "Graphics.h"
+#include "Keyboard.h"
+#include "Platform.h"
+#include "Ball.h"
+#include "Network.h"
+
+const float FPS = 60.0f;
+const int SCREEN_W = 640;
+const int SCREEN_H = 480;
+const int PLATFORM_W = 10;
+const int PLATFORM_H = 50;
+const int BALL_SIZE = 15;
+
+class Game
+{
+public:
+ Game();
+ ~Game();
+
+ bool initialize();
+ void run();
+ void deinitialize();
+
+ Graphics *getGraphics();
+ Keyboard *getKeyboard();
+ Platform *getPlatform(int i);
+ Network *getNetwork();
+
+private:
+ Graphics *m_pGraphics;
+ Keyboard *m_pKeyboard;
+ Platform *m_pPlatform[2];
+ Ball *m_pBall;
+ Network *m_pNetwork;
+
+ ALLEGRO_EVENT_QUEUE *m_pEventQueue;
+ ALLEGRO_TIMER *m_pFrameTimer;
+ ALLEGRO_TIMER *m_pNetworkTimer;
+
+ bool m_bRunning;
+};
+
+#endif
54 client/Graphics.cpp
@@ -0,0 +1,54 @@
+#include "StdInc.h"
+#include "Graphics.h"
+
+Graphics::Graphics()
+{
+}
+
+Graphics::~Graphics()
+{
+}
+
+bool Graphics::initialize()
+{
+ m_pDisplay = al_create_display(SCREEN_W, SCREEN_H);
+ if (!m_pDisplay)
+ {
+ return false;
+ }
+
+ /*m_pDefaultFont = al_load_ttf_font("miscfs.ttf", 72, 0);
+ if (!m_pDefaultFont)
+ {
+ return false;
+ }*/
+
+ return true;
+}
+
+void Graphics::deinitialize()
+{
+ //al_destroy_font(m_pDefaultFont);
+ al_destroy_display(m_pDisplay);
+}
+
+bool Graphics::process()
+{
+ return true;
+}
+
+void Graphics::draw()
+{
+ al_set_target_bitmap(al_get_backbuffer(m_pDisplay));
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+
+ g_pGame->getPlatform(0)->draw();
+ g_pGame->getPlatform(1)->draw();
+
+ //al_draw_text(m_pDefaultFont, al_map_rgb(255, 255, 255), (SCREEN_W)/2, (SCREEN_H)/4, ALLEGRO_ALIGN_CENTRE, "hello world");
+}
+
+ALLEGRO_DISPLAY *Graphics::getDisplay()
+{
+ return m_pDisplay;
+}
25 client/Graphics.h
@@ -0,0 +1,25 @@
+class Graphics;
+
+#ifndef _GRAPHICS_H
+#define _GRAPHICS_H
+
+class Graphics
+{
+public:
+ Graphics();
+ ~Graphics();
+
+ bool initialize();
+ void deinitialize();
+
+ bool process();
+ void draw();
+
+ ALLEGRO_DISPLAY *getDisplay();
+
+private:
+ ALLEGRO_DISPLAY *m_pDisplay;
+ ALLEGRO_FONT *m_pDefaultFont;
+};
+
+#endif
50 client/Keyboard.cpp
@@ -0,0 +1,50 @@
+#include <allegro5/allegro.h>
+#include "StdInc.h"
+#include "Keyboard.h"
+
+Keyboard::Keyboard()
+{
+ memset(m_bKeyState, 0, sizeof(bool) * NUMKEYS);
+}
+
+Keyboard::~Keyboard()
+{
+}
+
+void Keyboard::handleKeyDown(int iKeyCode)
+{
+ switch (iKeyCode)
+ {
+ case ALLEGRO_KEY_UP:
+ m_bKeyState[UP] = true;
+ break;
+
+ case ALLEGRO_KEY_DOWN:
+ m_bKeyState[DOWN] = true;
+ break;
+ }
+}
+
+void Keyboard::handleKeyUp(int iKeyCode)
+{
+ switch (iKeyCode)
+ {
+ case ALLEGRO_KEY_UP:
+ m_bKeyState[UP] = false;
+ break;
+
+ case ALLEGRO_KEY_DOWN:
+ m_bKeyState[DOWN] = false;
+ break;
+ }
+}
+
+bool Keyboard::isKeyDown(int iKey)
+{
+ if (iKey < 0 || iKey >= NUMKEYS)
+ {
+ return false;
+ }
+
+ return m_bKeyState[iKey];
+}
26 client/Keyboard.h
@@ -0,0 +1,26 @@
+class Keyboard;
+
+#ifndef _KEYBOARD_H
+#define _KEYBOARD_H
+
+class Keyboard
+{
+public:
+ Keyboard();
+ ~Keyboard();
+
+ enum
+ {
+ UP, DOWN,
+ NUMKEYS
+ };
+
+ void handleKeyDown(int iKeyCode);
+ void handleKeyUp(int iKeyCode);
+ bool isKeyDown(int iKey);
+
+private:
+ bool m_bKeyState[NUMKEYS];
+};
+
+#endif
185 client/Network.cpp
@@ -0,0 +1,185 @@
+#include "StdInc.h"
+#include "Network.h"
+#include <stdio.h>
+#include <BitStream.h>
+#include <RakNetTypes.h>
+
+Network::Network()
+{
+}
+
+Network::~Network()
+{
+}
+
+bool Network::initialize()
+{
+ m_qwInitTime = GetTickCount64();
+
+ m_pPeer = RakNet::RakPeerInterface::GetInstance();
+ if (!m_pPeer)
+ {
+ return false;
+ }
+
+ m_pPeer->Startup(1, &RakNet::SocketDescriptor(), 1);
+
+ m_pPeer->Connect("localhost", 45000, NULL, 0);
+
+ return true;
+}
+
+void Network::deinitialize()
+{
+ RakNet::RakPeerInterface::DestroyInstance(m_pPeer);
+}
+
+void Network::process()
+{
+ for (RakNet::Packet *pPacket = m_pPeer->Receive(); pPacket; m_pPeer->DeallocatePacket(pPacket), pPacket = m_pPeer->Receive())
+ {
+ switch (pPacket->data[0])
+ {
+ case ID_REMOTE_DISCONNECTION_NOTIFICATION:
+ printf("Another client has disconnected.\n");
+ break;
+ case ID_REMOTE_CONNECTION_LOST:
+ printf("Another client has lost the connection.\n");
+ break;
+ case ID_REMOTE_NEW_INCOMING_CONNECTION:
+ printf("Another client has connected.\n");
+ break;
+ case ID_CONNECTION_REQUEST_ACCEPTED:
+ {
+ printf("Our connection request has been accepted.\n");
+
+ // Use a BitStream to write a custom user message
+ // Bitstreams are easier to use than sending casted structures, and handle endian swapping automatically
+ RakNet::BitStream bsOut;
+ bsOut.Write((RakNet::MessageID)ID_INIT);
+
+ Platform *p = g_pGame->getPlatform(1);
+ float fX, fY;
+ p->getPosition(fX, fY);
+ bsOut.Write(fY);
+ bsOut.Write(p->getVelocity());
+
+ m_pPeer->Send(&bsOut, HIGH_PRIORITY, RELIABLE_ORDERED, 0, pPacket->systemAddress, false);
+ }
+ break;
+ case ID_NO_FREE_INCOMING_CONNECTIONS:
+ printf("The server is full.\n");
+ break;
+ case ID_DISCONNECTION_NOTIFICATION:
+ printf("We have been disconnected.\n");
+ break;
+ case ID_CONNECTION_LOST:
+ printf("Connection lost.\n");
+ break;
+
+ case ID_PLATFORM:
+ {
+ RakNet::BitStream bsIn(pPacket->data, pPacket->length, false);
+ bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
+
+ float fTimestamp;
+ bsIn.Read(fTimestamp);
+
+ if (m_fLastPlatformPacket > fTimestamp)
+ {
+ break;
+ }
+ m_fLastPlatformPacket = fTimestamp;
+
+ float fPos, fVelocity;
+ bsIn.Read(fPos);
+ bsIn.Read(fVelocity);
+
+ Platform *p = g_pGame->getPlatform(1);
+ float fX, fY;
+ p->getPosition(fX, fY);
+ p->setPosition(fX, fPos);
+ p->setVelocity(fVelocity);
+ }
+ break;
+
+ /*case ID_INIT:
+ {
+ RakNet::BitStream bsIn(pPacket->data, pPacket->length, false);
+ bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
+
+ bsIn.Read(m_fCurrentPos);
+ }
+ break;
+
+ case ID_CLIENTUPDATE:
+ {
+ RakNet::BitStream bsIn(pPacket->data, pPacket->length, false);
+ bsIn.IgnoreBytes(sizeof(RakNet::MessageID));
+
+ float fTime;
+ unsigned char ucState;
+ float fPos, fVel;
+ bsIn.Read(fTime);
+ bsIn.Read(ucState);
+ bsIn.Read(fPos);
+ bsIn.Read(fVel);
+
+ float fDeltaPos = m_fCurrentPos >= fPos ? m_fCurrentPos - fPos : fPos - m_fCurrentPos;
+ if (fDeltaPos > 1.0f)
+ {
+ m_fCurrentPos = fPos;
+ }
+ else if (fDeltaPos > 0.2f)
+ {
+ m_fCurrentPos += (m_fCurrentPos - fPos) * 0.1f;
+ }
+
+ Platform *p = g_pGame->getPlatform(1);
+ float fX, fY;
+ p->getPosition(fX, fY);
+ p->setPosition(fX, m_fCurrentPos);
+ p->setVelocity(fVel);
+ }
+ break;*/
+
+ default:
+ printf("Message with identifier %i has arrived.\n", pPacket->data[0]);
+ break;
+ }
+ }
+}
+
+float Network::getCurrentTime()
+{
+ DWORD64 qwDelta = GetTickCount64() - m_qwInitTime;
+ return (float)qwDelta / 1000.0f;
+}
+
+void Network::updatePlatform(float fPos, float fVelocity)
+{
+ RakNet::BitStream bsOut;
+ bsOut.Write((RakNet::MessageID)ID_PLATFORM);
+ bsOut.Write(fPos);
+ bsOut.Write(fVelocity);
+ m_pPeer->Send(&bsOut, HIGH_PRIORITY, UNRELIABLE_SEQUENCED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true);
+}
+
+void Network::updateInput(bool bUp, bool bDown)
+{
+ unsigned char ucState = 0;
+ if (bUp)
+ {
+ ucState = 1;
+ }
+ else if (bDown)
+ {
+ ucState = 2;
+ }
+
+ RakNet::BitStream bsOut;
+ bsOut.Write((RakNet::MessageID)ID_INPUT);
+ bsOut.Write(GetTickCount());
+ bsOut.Write(ucState);
+ m_pPeer->Send(&bsOut, HIGH_PRIORITY, UNRELIABLE_SEQUENCED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true);
+}
44 client/Network.h
@@ -0,0 +1,44 @@
+class Network;
+
+#ifndef _NETWORK_H
+#define _NETWORK_H
+
+#include <RakPeerInterface.h>
+#include <MessageIdentifiers.h>
+
+class Network
+{
+public:
+ Network();
+ ~Network();
+
+ bool initialize();
+ void deinitialize();
+
+ void process();
+
+ float getCurrentTime();
+
+ void updatePlatform(float fPosition, float fVelocity);
+ void updateInput(bool bUp, bool bDown);
+
+private:
+ enum GamePackets
+ {
+ ID_TEST = ID_USER_PACKET_ENUM + 1,
+ ID_PLATFORM,
+
+ ID_INIT,
+ ID_INPUT,
+ ID_CLIENTUPDATE
+ };
+
+ DWORD64 m_qwInitTime;
+ float m_fLastPlatformPacket;
+
+ float m_fCurrentPos;
+
+ RakNet::RakPeerInterface *m_pPeer;
+};
+
+#endif
122 client/Platform.cpp
@@ -0,0 +1,122 @@
+#include "StdInc.h"
+#include "Platform.h"
+
+Platform::Platform(float fX)
+ : m_bInteraction(false)
+{
+ m_fPosX = fX;
+ m_fPosY = SCREEN_H / 2.0f - PLATFORM_H / 2.0f;
+}
+
+Platform::~Platform()
+{
+}
+
+bool Platform::initialize()
+{
+ m_pBitmap = al_create_bitmap(PLATFORM_W, PLATFORM_H);
+ if (!m_pBitmap)
+ {
+ return false;
+ }
+
+ al_set_target_bitmap(m_pBitmap);
+ al_clear_to_color(al_map_rgb(255, 255, 255));
+
+ return true;
+}
+
+void Platform::deinitialize()
+{
+ al_destroy_bitmap(m_pBitmap);
+}
+
+bool Platform::process()
+{
+ m_bInteraction = false;
+ bool bInteraction = m_bInteraction;
+
+ bool bRedraw = bInteraction;
+
+ if (m_bInteraction)
+ {
+ if (m_fVelocity > 7.0f)
+ {
+ m_fVelocity = 7.0f;
+ }
+ else if (m_fVelocity < -7.0f)
+ {
+ m_fVelocity = -7.0f;
+ }
+ }
+ else
+ {
+ if (m_fVelocity < 0.0f)
+ {
+ bRedraw = true;
+ m_fVelocity += 0.15f;
+ if (m_fVelocity > 0.0f) m_fVelocity = 0.0f;
+ }
+ else if (m_fVelocity > 0.0f)
+ {
+ bRedraw = true;
+ m_fVelocity -= 0.15f;
+ if (m_fVelocity < 0.0f) m_fVelocity = 0.0f;
+ }
+ }
+
+ m_fPosY += m_fVelocity;
+ if (m_fPosY < 0)
+ {
+ m_fPosY = 0;
+ m_fVelocity = 0.0f;
+ }
+ else if (m_fPosY > SCREEN_H - PLATFORM_H)
+ {
+ m_fPosY = SCREEN_H - PLATFORM_H;
+ m_fVelocity = 0.0f;
+ }
+
+ return bRedraw;
+}
+
+void Platform::draw()
+{
+ al_draw_bitmap(m_pBitmap, m_fPosX, m_fPosY, 0);
+}
+
+void Platform::setPosition(float fPosX, float fPosY)
+{
+ m_fPosX = fPosX;
+ m_fPosY = fPosY;
+}
+
+void Platform::getPosition(float &fPosX, float &fPosY)
+{
+ fPosX = m_fPosX;
+ fPosY = m_fPosY;
+}
+
+void Platform::setVelocity(float fVelocity)
+{
+ m_fVelocity = fVelocity;
+ m_bInteraction = true;
+}
+
+float Platform::getVelocity()
+{
+ return m_fVelocity;
+}
+
+void Platform::accelerate(float fAcceleration)
+{
+ m_bInteraction = true;
+ m_fVelocity += fAcceleration;
+}
+
+void Platform::decelerate(float fDeceleration)
+{
+ m_bInteraction = true;
+ m_fVelocity -= fDeceleration;
+}
+
34 client/Platform.h
@@ -0,0 +1,34 @@
+class Platform;
+
+#ifndef _PLATFORM_H
+#define _PLATFORM_H
+
+class Platform
+{
+public:
+ Platform(float fX);
+ ~Platform();
+
+ bool initialize();
+ void deinitialize();
+
+ bool process();
+ void draw();
+
+ void setPosition(float fPosX, float fPosY);
+ void getPosition(float &fPosX, float &fPosY);
+ void setVelocity(float fVelocity);
+ float getVelocity();
+ void accelerate(float fAcceleration);
+ void decelerate(float fDeceleration);
+
+private:
+ float m_fPosX;
+ float m_fPosY;
+ float m_fVelocity;
+ bool m_bInteraction;
+
+ ALLEGRO_BITMAP *m_pBitmap;
+};
+
+#endif
1  client/StdInc.cpp
@@ -0,0 +1 @@
+#include "StdInc.h"
13 client/StdInc.h
@@ -0,0 +1,13 @@
+#ifndef _STDINC_H
+#define _STDINC_H
+
+#ifdef WIN32
+#include <winsock2.h>
+#include <windows.h>
+#endif
+
+#include "Game.h"
+
+extern Game *g_pGame;
+
+#endif
260 client/main.cpp
@@ -0,0 +1,260 @@
+#include "StdInc.h"
+#include "Game.h"
+
+Game *g_pGame = NULL;
+
+#if 0
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+ ALLEGRO_DISPLAY *display = NULL;
+ ALLEGRO_EVENT_QUEUE *event_queue = NULL;
+ ALLEGRO_TIMER *timer = NULL;
+ ALLEGRO_BITMAP *bouncer = NULL;
+ float bouncer_x = 10.0f;
+ float bouncer_y = SCREEN_H / 2.0 - PLATFORM_H / 2.0;
+ float bouncer_dx = -4.0, bouncer_dy = 4.0;
+ bool redraw = true;
+ bool doexit = false;
+
+ bool key[4] = { false, false, false, false };
+
+ if (!al_init())
+ {
+ error("failed to initialize allegro!\n");
+ return -1;
+ }
+
+ al_init_font_addon(); // initialize the font addon
+ if (!al_init_ttf_addon())
+ {
+ error("failed to initialize ttf addon");
+ return -1;
+ }
+ if (!al_install_keyboard())
+ {
+ error("failed to initialize the keyboard!\n");
+ return -1;
+ }
+ ALLEGRO_FONT *font = al_load_ttf_font("miscfs.ttf", 72, 0); // load the font | Font from Larabie Free Fonts
+ if (!font)
+ {
+ error("failed to load font");
+ return -1;
+ }
+
+
+ timer = al_create_timer(1.0 / FPS);
+ if (!timer)
+ {
+ error("failed to create timer!\n");
+ return -1;
+ }
+
+ display = al_create_display(SCREEN_W, SCREEN_H);
+ if (!display)
+ {
+ error("failed to create display!\n");
+ al_destroy_timer(timer);
+ return -1;
+ }
+
+ bouncer = al_create_bitmap(PLATFORM_W, PLATFORM_H);
+ if (!bouncer)
+ {
+ error("failed to create bouncer bitmap!\n");
+ al_destroy_display(display);
+ al_destroy_timer(timer);
+ return -1;
+ }
+
+ al_set_target_bitmap(bouncer);
+ al_clear_to_color(al_map_rgb(255, 255, 255));
+
+ al_set_target_bitmap(al_get_backbuffer(display));
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+
+ event_queue = al_create_event_queue();
+ if (!event_queue)
+ {
+ error("failed to create event_queue!\n");
+ al_destroy_bitmap(bouncer);
+ al_destroy_display(display);
+ al_destroy_timer(timer);
+ return -1;
+ }
+
+ al_register_event_source(event_queue, al_get_display_event_source(display));
+ al_register_event_source(event_queue, al_get_timer_event_source(timer));
+ al_register_event_source(event_queue, al_get_keyboard_event_source());
+
+ al_flip_display();
+
+ al_start_timer(timer);
+
+ float fVelY = 0.0f;
+
+ while (!doexit)
+ {
+ ALLEGRO_EVENT ev;
+ al_wait_for_event(event_queue, &ev);
+
+ if (ev.type == ALLEGRO_EVENT_TIMER)
+ {
+ bool changed = false;
+ if (key[KEY_UP])
+ {
+ changed = true;
+ fVelY -= 0.65f;
+ }
+ else if (key[KEY_DOWN])
+ {
+ changed = true;
+ fVelY += 0.65f;
+ }
+
+ if (changed)
+ {
+ if (fVelY > 10.0f)
+ {
+ fVelY = 10.0f;
+ }
+ else if (fVelY < -10.0f)
+ {
+ fVelY = -10.0f;
+ }
+ }
+ else
+ {
+ if (fVelY < 0.0f)
+ {
+ fVelY += 0.15f;
+ if (fVelY > 0.0f) fVelY = 0.0f;
+ }
+ else if (fVelY > 0.0f)
+ {
+ fVelY -= 0.15f;
+ if (fVelY < 0.0f) fVelY = 0.0f;
+ }
+ }
+
+ bouncer_y += fVelY;
+ if (bouncer_y < 0)
+ {
+ bouncer_y = 0;
+ fVelY = 0.0f;
+ }
+ else if (bouncer_y > SCREEN_H - PLATFORM_H)
+ {
+ bouncer_y = SCREEN_H - PLATFORM_H;
+ fVelY = 0.0f;
+ }
+
+ redraw = true;
+ }
+ else if (ev.type == ALLEGRO_EVENT_DISPLAY_CLOSE)
+ {
+ break;
+ }
+ else if (ev.type == ALLEGRO_EVENT_KEY_DOWN)
+ {
+ switch (ev.keyboard.keycode)
+ {
+ case ALLEGRO_KEY_UP:
+ key[KEY_UP] = true;
+ break;
+
+ case ALLEGRO_KEY_DOWN:
+ key[KEY_DOWN] = true;
+ break;
+
+ case ALLEGRO_KEY_LEFT:
+ key[KEY_LEFT] = true;
+ break;
+
+ case ALLEGRO_KEY_RIGHT:
+ key[KEY_RIGHT] = true;
+ break;
+ }
+ }
+ else if (ev.type == ALLEGRO_EVENT_KEY_UP)
+ {
+ switch (ev.keyboard.keycode)
+ {
+ case ALLEGRO_KEY_UP:
+ key[KEY_UP] = false;
+ break;
+
+ case ALLEGRO_KEY_DOWN:
+ key[KEY_DOWN] = false;
+ break;
+
+ case ALLEGRO_KEY_LEFT:
+ key[KEY_LEFT] = false;
+ break;
+
+ case ALLEGRO_KEY_RIGHT:
+ key[KEY_RIGHT] = false;
+ break;
+
+ case ALLEGRO_KEY_ESCAPE:
+ doexit = true;
+ break;
+ }
+ }
+
+ if (redraw && al_is_event_queue_empty(event_queue))
+ {
+ redraw = false;
+
+ al_clear_to_color(al_map_rgb(0, 0, 0));
+
+ al_draw_bitmap(bouncer, bouncer_x, bouncer_y, 0);
+
+ char tmp[128];
+ sprintf(tmp, "%.5f", fVelY);
+
+ al_draw_text(font, al_map_rgb(255, 255, 255), (SCREEN_W)/2, (SCREEN_H)/4, ALLEGRO_ALIGN_CENTRE, tmp);// draw the text
+
+ al_flip_display();
+ }
+ }
+
+ al_destroy_bitmap(bouncer);
+ al_destroy_timer(timer);
+ al_destroy_display(display);
+ al_destroy_event_queue(event_queue);
+
+ return 0;
+}
+#endif
+
+int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
+{
+ if (!al_init())
+ {
+ return -1;
+ }
+
+ al_init_font_addon(); // initialize the font addon
+ if (!al_init_ttf_addon())
+ {
+ return -1;
+ }
+ if (!al_install_keyboard())
+ {
+ return -1;
+ }
+
+ g_pGame = new Game();
+
+ if (!g_pGame->initialize())
+ {
+ return 1;
+ }
+
+ g_pGame->run();
+
+ g_pGame->deinitialize();
+
+ return 0;
+}
244 client/pongmp-client.vcproj
@@ -0,0 +1,244 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="9,00"
+ Name="pongmp"
+ ProjectGUID="{29DEFEA8-A5A7-4FA4-B78B-CBDB3D6BCBE6}"
+ RootNamespace="pongmp"
+ Keyword="Win32Proj"
+ TargetFrameworkVersion="196613"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="$(SolutionDir)build-dbg"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
+ MinimalRebuild="true"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ UsePrecompiledHeader="0"
+ WarningLevel="3"
+ DebugInformationFormat="4"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkIncremental="2"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="$(SolutionDir)build"
+ IntermediateDirectory="$(ConfigurationName)"
+ ConfigurationType="1"
+ CharacterSet="0"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="2"
+ EnableIntrinsicFunctions="true"
+ AdditionalIncludeDirectories="..\deps\allegro\include;..\deps\raknet\Source"
+ PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;ALLEGRO_STATICLINK;ALLEGRO_NO_MAGIC_MAIN"
+ RuntimeLibrary="0"
+ EnableFunctionLevelLinking="true"
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="StdInc.h"
+ WarningLevel="3"
+ DebugInformationFormat="3"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="allegro-5.0.4-static-mt.lib allegro_primitives-5.0.4-static-mt.lib allegro_image-5.0.4-static-mt.lib allegro_ttf-5.0.4-static-mt.lib allegro_font-5.0.4-static-mt.lib freetype-2.4.4-static-mt.lib opengl32.lib gdiplus.lib winmm.lib psapi.lib Shlwapi.lib ..\deps\raknet\Lib\RakNetLibStatic.lib ws2_32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="..\deps\allegro\lib"
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <File
+ RelativePath=".\Ball.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Ball.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Game.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Game.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Graphics.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Graphics.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Keyboard.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Keyboard.h"
+ >
+ </File>
+ <File
+ RelativePath=".\main.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Network.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Network.h"
+ >
+ </File>
+ <File
+ RelativePath=".\Platform.cpp"
+ >
+ </File>
+ <File
+ RelativePath=".\Platform.h"
+ >
+ </File>
+ <File
+ RelativePath=".\StdInc.cpp"
+ >
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ PrecompiledHeaderThrough="StdInc.h"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath=".\StdInc.h"
+ >
+ </File>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
19 deps/allegro/include/allegro5/alcompat.h
@@ -0,0 +1,19 @@
+#ifndef __al_included_allegro5_alcompat_h
+#define __al_included_allegro5_alcompat_h
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+
+#define al_current_time() (al_get_time())
+#define al_event_queue_is_empty(q) (al_is_event_queue_empty(q))
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
+
+/* vim: set sts=3 sw=3 et: */
32 deps/allegro/include/allegro5/alinline.h
@@ -0,0 +1,32 @@
+/* ______ ___ ___
+ * /\ _ \ /\_ \ /\_ \
+ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
+ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
+ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
+ * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
+ * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
+ * /\____/
+ * \_/__/
+ *
+ * Inline functions (generic C).
+ *
+ * By Shawn Hargreaves.
+ *
+ * See readme.txt for copyright information.
+ */
+
+
+#include "allegro5/inline/gfx.inl"
+
+#include "allegro5/inline/color.inl"
+
+#include "allegro5/inline/draw.inl"
+
+#include "allegro5/inline/fmaths.inl"
+
+#include "allegro5/inline/3dmaths.inl"
+
+#include "allegro5/inline/matrix.inl"
+
+/* alcompat.h includes some inline functions */
+#include "allegro5/alcompat.h"
74 deps/allegro/include/allegro5/allegro.h
@@ -0,0 +1,74 @@
+/* ______ ___ ___
+ * /\ _ \ /\_ \ /\_ \
+ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
+ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
+ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
+ * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
+ * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
+ * /\____/
+ * \_/__/
+ *
+ * Main header file for the entire Allegro library.
+ * (separate modules can be included from the allegro/ directory)
+ *
+ * By Shawn Hargreaves.
+ *
+ * Vincent Penquerc'h split the original allegro.h into separate headers.
+ *
+ * See readme.txt for copyright information.
+ */
+
+
+#ifndef __al_included_allegro5_allegro_h
+#define __al_included_allegro5_allegro_h
+
+
+#include "allegro5/base.h"
+
+#include "allegro5/system.h"
+#include "allegro5/memory.h"
+#include "allegro5/debug.h"
+#include "allegro5/error.h"
+
+#include "allegro5/utf8.h"
+
+#include "allegro5/altime.h"
+
+#include "allegro5/events.h"
+
+#include "allegro5/mouse.h"
+#include "allegro5/timer.h"
+#include "allegro5/keyboard.h"
+#include "allegro5/joystick.h"
+
+#include "allegro5/threads.h"
+
+#include "allegro5/display.h"
+#include "allegro5/transformations.h"
+#include "allegro5/bitmap_io.h"
+#include "allegro5/bitmap.h"
+
+#include "allegro5/tls.h"
+
+#include "allegro5/file.h"
+#include "allegro5/fshook.h"
+#include "allegro5/path.h"
+
+#include "allegro5/fmaths.h"
+
+#include "allegro5/config.h"
+
+
+#ifndef ALLEGRO_NO_COMPATIBILITY
+ #include "allegro5/alcompat.h"
+#endif
+
+
+#ifdef ALLEGRO_EXTRA_HEADER
+ #include ALLEGRO_EXTRA_HEADER
+#endif
+
+
+#endif
+
+
2  deps/allegro/include/allegro5/allegro5.h
@@ -0,0 +1,2 @@
+#include "allegro.h"
+
40 deps/allegro/include/allegro5/allegro_acodec.h
@@ -0,0 +1,40 @@
+#ifndef __al_included_allegro5_allegro_acodec_h
+#define __al_included_allegro5_allegro_acodec_h
+
+#include "allegro5/allegro.h"
+#include "allegro5/allegro_audio.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC)
+ #ifndef ALLEGRO_STATICLINK
+ #ifdef ALLEGRO_ACODEC_SRC
+ #define _ALLEGRO_ACODEC_DLL __declspec(dllexport)
+ #else
+ #define _ALLEGRO_ACODEC_DLL __declspec(dllimport)
+ #endif
+ #else
+ #define _ALLEGRO_ACODEC_DLL
+ #endif
+#endif
+
+#if defined ALLEGRO_MSVC
+ #define ALLEGRO_ACODEC_FUNC(type, name, args) _ALLEGRO_ACODEC_DLL type __cdecl name args
+#elif defined ALLEGRO_MINGW32
+ #define ALLEGRO_ACODEC_FUNC(type, name, args) extern type name args
+#else
+ #define ALLEGRO_ACODEC_FUNC AL_FUNC
+#endif
+
+
+ALLEGRO_ACODEC_FUNC(bool, al_init_acodec_addon, (void));
+ALLEGRO_ACODEC_FUNC(uint32_t, al_get_allegro_acodec_version, (void));
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
373 deps/allegro/include/allegro5/allegro_audio.h
@@ -0,0 +1,373 @@
+/*
+ * Updated for 4.9 api inclusion by Ryan Dickie
+ * Originally done by KC/Milan
+ */
+
+#ifndef __al_included_allegro5_allegro_audio_h
+#define __al_included_allegro5_allegro_audio_h
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* Title: Audio types
+ */
+
+#include "allegro5/allegro.h"
+
+
+#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
+ #ifndef ALLEGRO_STATICLINK
+ #ifdef ALLEGRO_KCM_AUDIO_SRC
+ #define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllexport)
+ #else
+ #define _ALLEGRO_KCM_AUDIO_DLL __declspec(dllimport)
+ #endif
+ #else
+ #define _ALLEGRO_KCM_AUDIO_DLL
+ #endif
+#endif
+
+#if defined ALLEGRO_MSVC
+ #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) _ALLEGRO_KCM_AUDIO_DLL type __cdecl name args
+#elif defined ALLEGRO_MINGW32
+ #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern type name args
+#elif defined ALLEGRO_BCC32
+ #define ALLEGRO_KCM_AUDIO_FUNC(type, name, args) extern _ALLEGRO_KCM_AUDIO_DLL type name args
+#else
+ #define ALLEGRO_KCM_AUDIO_FUNC AL_FUNC
+#endif
+
+
+/* Internal, used to communicate with acodec. */
+/* Must be in 512 <= n < 1024 */
+#define _KCM_STREAM_FEEDER_QUIT_EVENT_TYPE (512)
+
+/* User event type emitted when a stream fragment is ready to be
+ * refilled with more audio data.
+ * Must be in 512 <= n < 1024
+ */
+#define ALLEGRO_EVENT_AUDIO_STREAM_FRAGMENT (513)
+#define ALLEGRO_EVENT_AUDIO_STREAM_FINISHED (514)
+
+
+#ifndef __cplusplus
+typedef enum ALLEGRO_AUDIO_DEPTH ALLEGRO_AUDIO_DEPTH;
+typedef enum ALLEGRO_CHANNEL_CONF ALLEGRO_CHANNEL_CONF;
+typedef enum ALLEGRO_PLAYMODE ALLEGRO_PLAYMODE;
+typedef enum ALLEGRO_MIXER_QUALITY ALLEGRO_MIXER_QUALITY;
+typedef enum ALLEGRO_AUDIO_PROPERTY ALLEGRO_AUDIO_PROPERTY;
+typedef enum ALLEGRO_AUDIO_DRIVER_ENUM ALLEGRO_AUDIO_DRIVER_ENUM;
+#endif
+
+
+/* Enum: ALLEGRO_AUDIO_DEPTH
+ */
+enum ALLEGRO_AUDIO_DEPTH
+{
+ /* Sample depth and type, and signedness. Mixers only use 32-bit signed
+ * float (-1..+1). The unsigned value is a bit-flag applied to the depth
+ * value.
+ */
+ ALLEGRO_AUDIO_DEPTH_INT8 = 0x00,
+ ALLEGRO_AUDIO_DEPTH_INT16 = 0x01,
+ ALLEGRO_AUDIO_DEPTH_INT24 = 0x02,
+ ALLEGRO_AUDIO_DEPTH_FLOAT32 = 0x03,
+
+ ALLEGRO_AUDIO_DEPTH_UNSIGNED = 0x08,
+
+ /* For convenience */
+ ALLEGRO_AUDIO_DEPTH_UINT8 = ALLEGRO_AUDIO_DEPTH_INT8 |
+ ALLEGRO_AUDIO_DEPTH_UNSIGNED,
+ ALLEGRO_AUDIO_DEPTH_UINT16 = ALLEGRO_AUDIO_DEPTH_INT16 |
+ ALLEGRO_AUDIO_DEPTH_UNSIGNED,
+ ALLEGRO_AUDIO_DEPTH_UINT24 = ALLEGRO_AUDIO_DEPTH_INT24 |
+ ALLEGRO_AUDIO_DEPTH_UNSIGNED
+};
+
+
+/* Enum: ALLEGRO_CHANNEL_CONF
+ */
+enum ALLEGRO_CHANNEL_CONF
+{
+ /* Speaker configuration (mono, stereo, 2.1, 3, etc). With regards to
+ * behavior, most of this code makes no distinction between, say, 4.1 and
+ * 5 speaker setups.. they both have 5 "channels". However, users would
+ * like the distinction, and later when the higher-level stuff is added,
+ * the differences will become more important. (v>>4)+(v&0xF) should yield
+ * the total channel count.
+ */
+ ALLEGRO_CHANNEL_CONF_1 = 0x10,
+ ALLEGRO_CHANNEL_CONF_2 = 0x20,
+ ALLEGRO_CHANNEL_CONF_3 = 0x30,
+ ALLEGRO_CHANNEL_CONF_4 = 0x40,
+ ALLEGRO_CHANNEL_CONF_5_1 = 0x51,
+ ALLEGRO_CHANNEL_CONF_6_1 = 0x61,
+ ALLEGRO_CHANNEL_CONF_7_1 = 0x71
+#define ALLEGRO_MAX_CHANNELS 8
+};
+
+
+/* Enum: ALLEGRO_PLAYMODE
+ */
+enum ALLEGRO_PLAYMODE
+{
+ ALLEGRO_PLAYMODE_ONCE = 0x100,
+ ALLEGRO_PLAYMODE_LOOP = 0x101,
+ ALLEGRO_PLAYMODE_BIDIR = 0x102,
+ _ALLEGRO_PLAYMODE_STREAM_ONCE = 0x103, /* internal */
+ _ALLEGRO_PLAYMODE_STREAM_ONEDIR = 0x104 /* internal */
+};
+
+
+/* Enum: ALLEGRO_MIXER_QUALITY
+ */
+enum ALLEGRO_MIXER_QUALITY
+{
+ ALLEGRO_MIXER_QUALITY_POINT = 0x110,
+ ALLEGRO_MIXER_QUALITY_LINEAR = 0x111,
+};
+
+
+/* Enum: ALLEGRO_AUDIO_PAN_NONE
+ */
+#define ALLEGRO_AUDIO_PAN_NONE (-1000.0f)
+
+
+/* Type: ALLEGRO_SAMPLE
+ */
+typedef struct ALLEGRO_SAMPLE ALLEGRO_SAMPLE;
+
+
+/* Type: ALLEGRO_SAMPLE_ID
+ */
+typedef struct ALLEGRO_SAMPLE_ID ALLEGRO_SAMPLE_ID;
+
+struct ALLEGRO_SAMPLE_ID {
+ int _index;
+ int _id;
+};
+
+
+/* Type: ALLEGRO_SAMPLE_INSTANCE
+ */
+typedef struct ALLEGRO_SAMPLE_INSTANCE ALLEGRO_SAMPLE_INSTANCE;
+
+
+/* Type: ALLEGRO_AUDIO_STREAM
+ */
+typedef struct ALLEGRO_AUDIO_STREAM ALLEGRO_AUDIO_STREAM;
+
+
+/* Type: ALLEGRO_MIXER
+ */
+typedef struct ALLEGRO_MIXER ALLEGRO_MIXER;
+
+
+/* Type: ALLEGRO_VOICE
+ */
+typedef struct ALLEGRO_VOICE ALLEGRO_VOICE;
+
+
+/* Sample functions */
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_create_sample, (void *buf,
+ unsigned int samples, unsigned int freq, ALLEGRO_AUDIO_DEPTH depth,
+ ALLEGRO_CHANNEL_CONF chan_conf, bool free_buf));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample, (ALLEGRO_SAMPLE *spl));
+
+
+/* Sample instance functions */
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE_INSTANCE*, al_create_sample_instance, (
+ ALLEGRO_SAMPLE *data));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_sample_instance, (
+ ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_frequency, (const ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_length, (const ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_depth, (const ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_channels, (const ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_sample_data, (const ALLEGRO_SAMPLE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_frequency, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_length, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_sample_instance_position, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_speed, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_gain, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_pan, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_sample_instance_time, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_sample_instance_depth, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_sample_instance_channels, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_sample_instance_playmode, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_playing, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_sample_instance_attached, (const ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_position, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_length, (ALLEGRO_SAMPLE_INSTANCE *spl, unsigned int val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_speed, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_gain, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_pan, (ALLEGRO_SAMPLE_INSTANCE *spl, float val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playmode, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_PLAYMODE val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample_instance_playing, (ALLEGRO_SAMPLE_INSTANCE *spl, bool val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_sample, (ALLEGRO_SAMPLE_INSTANCE *spl, ALLEGRO_SAMPLE *data));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_get_sample, (ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_stop_sample_instance, (ALLEGRO_SAMPLE_INSTANCE *spl));
+
+
+/* Stream functions */
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM*, al_create_audio_stream, (size_t buffer_count,
+ unsigned int samples, unsigned int freq,
+ ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_drain_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
+
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_frequency, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_length, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_available_audio_stream_fragments, (const ALLEGRO_AUDIO_STREAM *stream));
+
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_speed, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_gain, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(float, al_get_audio_stream_pan, (const ALLEGRO_AUDIO_STREAM *stream));
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_audio_stream_channels, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_audio_stream_depth, (const ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_PLAYMODE, al_get_audio_stream_playmode, (const ALLEGRO_AUDIO_STREAM *stream));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_playing, (const ALLEGRO_AUDIO_STREAM *spl));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_audio_stream_attached, (const ALLEGRO_AUDIO_STREAM *spl));
+
+ALLEGRO_KCM_AUDIO_FUNC(void *, al_get_audio_stream_fragment, (const ALLEGRO_AUDIO_STREAM *stream));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_speed, (ALLEGRO_AUDIO_STREAM *stream, float val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_gain, (ALLEGRO_AUDIO_STREAM *stream, float val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_pan, (ALLEGRO_AUDIO_STREAM *stream, float val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playmode, (ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_PLAYMODE val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_playing, (ALLEGRO_AUDIO_STREAM *stream, bool val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_fragment, (ALLEGRO_AUDIO_STREAM *stream, void *val));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_rewind_audio_stream, (ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_seek_audio_stream_secs, (ALLEGRO_AUDIO_STREAM *stream, double time));
+ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_position_secs, (ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(double, al_get_audio_stream_length_secs, (ALLEGRO_AUDIO_STREAM *stream));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_audio_stream_loop_secs, (ALLEGRO_AUDIO_STREAM *stream, double start, double end));
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_EVENT_SOURCE *, al_get_audio_stream_event_source, (ALLEGRO_AUDIO_STREAM *stream));
+
+/* Mixer functions */
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER*, al_create_mixer, (unsigned int freq,
+ ALLEGRO_AUDIO_DEPTH depth, ALLEGRO_CHANNEL_CONF chan_conf));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_mixer, (ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_mixer, (
+ ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_mixer, (ALLEGRO_AUDIO_STREAM *stream,
+ ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_mixer, (ALLEGRO_MIXER *stream,
+ ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_postprocess_callback, (
+ ALLEGRO_MIXER *mixer,
+ void (*cb)(void *buf, unsigned int samples, void *data),
+ void *data));
+
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_mixer_frequency, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_mixer_channels, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_mixer_depth, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER_QUALITY, al_get_mixer_quality, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_playing, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_mixer_attached, (const ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_frequency, (ALLEGRO_MIXER *mixer, unsigned int val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_quality, (ALLEGRO_MIXER *mixer, ALLEGRO_MIXER_QUALITY val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_mixer_playing, (ALLEGRO_MIXER *mixer, bool val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_detach_mixer, (ALLEGRO_MIXER *mixer));
+
+/* Voice functions */
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_VOICE*, al_create_voice, (unsigned int freq,
+ ALLEGRO_AUDIO_DEPTH depth,
+ ALLEGRO_CHANNEL_CONF chan_conf));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_destroy_voice, (ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_sample_instance_to_voice, (
+ ALLEGRO_SAMPLE_INSTANCE *stream, ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_audio_stream_to_voice, (
+ ALLEGRO_AUDIO_STREAM *stream, ALLEGRO_VOICE *voice ));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_attach_mixer_to_voice, (ALLEGRO_MIXER *mixer,
+ ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_detach_voice, (ALLEGRO_VOICE *voice));
+
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_frequency, (const ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(unsigned int, al_get_voice_position, (const ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_CHANNEL_CONF, al_get_voice_channels, (const ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_DEPTH, al_get_voice_depth, (const ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_get_voice_playing, (const ALLEGRO_VOICE *voice));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_position, (ALLEGRO_VOICE *voice, unsigned int val));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_voice_playing, (ALLEGRO_VOICE *voice, bool val));
+
+/* Misc. audio functions */
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_install_audio, (void));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_uninstall_audio, (void));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_is_audio_installed, (void));
+ALLEGRO_KCM_AUDIO_FUNC(uint32_t, al_get_allegro_audio_version, (void));
+
+ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_channel_count, (ALLEGRO_CHANNEL_CONF conf));
+ALLEGRO_KCM_AUDIO_FUNC(size_t, al_get_audio_depth_size, (ALLEGRO_AUDIO_DEPTH conf));
+
+/* Simple audio layer */
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_reserve_samples, (int reserve_samples));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_MIXER *, al_get_default_mixer, (void));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_set_default_mixer, (ALLEGRO_MIXER *mixer));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_restore_default_mixer, (void));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_play_sample, (ALLEGRO_SAMPLE *data,
+ float gain, float pan, float speed, ALLEGRO_PLAYMODE loop, ALLEGRO_SAMPLE_ID *ret_id));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_sample, (ALLEGRO_SAMPLE_ID *spl_id));
+ALLEGRO_KCM_AUDIO_FUNC(void, al_stop_samples, (void));
+
+/* File type handlers */
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader, (const char *ext,
+ ALLEGRO_SAMPLE *(*loader)(const char *filename)));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver, (const char *ext,
+ bool (*saver)(const char *filename, ALLEGRO_SAMPLE *spl)));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader, (const char *ext,
+ ALLEGRO_AUDIO_STREAM *(*stream_loader)(const char *filename,
+ size_t buffer_count, unsigned int samples)));
+
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_loader_f, (const char *ext,
+ ALLEGRO_SAMPLE *(*loader)(ALLEGRO_FILE *fp)));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_sample_saver_f, (const char *ext,
+ bool (*saver)(ALLEGRO_FILE *fp, ALLEGRO_SAMPLE *spl)));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_register_audio_stream_loader_f, (const char *ext,
+ ALLEGRO_AUDIO_STREAM *(*stream_loader)(ALLEGRO_FILE *fp,
+ size_t buffer_count, unsigned int samples)));
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample, (const char *filename));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample, (const char *filename,
+ ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream, (const char *filename,
+ size_t buffer_count, unsigned int samples));
+
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_SAMPLE *, al_load_sample_f, (ALLEGRO_FILE* fp, const char *ident));
+ALLEGRO_KCM_AUDIO_FUNC(bool, al_save_sample_f, (ALLEGRO_FILE* fp, const char *ident,
+ ALLEGRO_SAMPLE *spl));
+ALLEGRO_KCM_AUDIO_FUNC(ALLEGRO_AUDIO_STREAM *, al_load_audio_stream_f, (ALLEGRO_FILE* fp, const char *ident,
+ size_t buffer_count, unsigned int samples));
+
+
+#ifdef __cplusplus
+} /* End extern "C" */
+#endif
+
+
+#endif
+
+
+/* vim: set sts=3 sw=3 et: */
68 deps/allegro/include/allegro5/allegro_color.h
@@ -0,0 +1,68 @@
+#ifndef __al_included_allegro5_allegro_color_h
+#define __al_included_allegro5_allegro_color_h
+
+#include "allegro5/allegro.h"
+
+#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
+ #ifndef ALLEGRO_STATICLINK
+ #ifdef ALLEGRO_COLOR_SRC
+ #define _ALLEGRO_COLOR_DLL __declspec(dllexport)
+ #else
+ #define _ALLEGRO_COLOR_DLL __declspec(dllimport)
+ #endif
+ #else
+ #define _ALLEGRO_COLOR_DLL
+ #endif
+#endif
+
+#if defined ALLEGRO_MSVC
+ #define ALLEGRO_COLOR_FUNC(type, name, args) _ALLEGRO_COLOR_DLL type __cdecl name args
+#elif defined ALLEGRO_MINGW32
+ #define ALLEGRO_COLOR_FUNC(type, name, args) extern type name args
+#elif defined ALLEGRO_BCC32
+ #define ALLEGRO_COLOR_FUNC(type, name, args) extern _ALLEGRO_COLOR_DLL type name args
+#else
+ #define ALLEGRO_COLOR_FUNC AL_FUNC
+#endif
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+ALLEGRO_COLOR_FUNC(uint32_t, al_get_allegro_color_version, (void));
+
+ALLEGRO_COLOR_FUNC(void, al_color_hsv_to_rgb, (float hue, float saturation,
+ float value, float *red, float *green, float *blue));
+ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsl, (float red, float green, float blue,
+ float *hue, float *saturation, float *lightness));
+ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_hsv, (float red, float green, float blue,
+ float *hue, float *saturation, float *value));
+ALLEGRO_COLOR_FUNC(void, al_color_hsl_to_rgb, (float hue, float saturation, float lightness,
+ float *red, float *green, float *blue));
+ALLEGRO_COLOR_FUNC(bool, al_color_name_to_rgb, (char const *name, float *r, float *g,
+ float *b));
+ALLEGRO_COLOR_FUNC(const char*, al_color_rgb_to_name, (float r, float g, float b));
+ALLEGRO_COLOR_FUNC(void, al_color_cmyk_to_rgb, (float cyan, float magenta, float yellow,
+ float key, float *red, float *green, float *blue));
+ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_cmyk, (float red, float green, float blue,
+ float *cyan, float *magenta, float *yellow, float *key));
+ALLEGRO_COLOR_FUNC(void, al_color_yuv_to_rgb, (float y, float u, float v,
+ float *red, float *green, float *blue));
+ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_yuv, (float red, float green, float blue,
+ float *y, float *u, float *v));
+ALLEGRO_COLOR_FUNC(void, al_color_rgb_to_html, (float red, float green, float blue,
+ char *string));
+ALLEGRO_COLOR_FUNC(void, al_color_html_to_rgb, (char const *string,
+ float *red, float *green, float *blue));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_yuv, (float y, float u, float v));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_cmyk, (float c, float m, float y, float k));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsl, (float h, float s, float l));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_hsv, (float h, float s, float v));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_name, (char const *name));
+ALLEGRO_COLOR_FUNC(ALLEGRO_COLOR, al_color_html, (char const *string));
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
49 deps/allegro/include/allegro5/allegro_direct3d.h
@@ -0,0 +1,49 @@
+/* ______ ___ ___
+ * /\ _ \ /\_ \ /\_ \
+ * \ \ \L\ \\//\ \ \//\ \ __ __ _ __ ___
+ * \ \ __ \ \ \ \ \ \ \ /'__`\ /'_ `\/\`'__\/ __`\
+ * \ \ \/\ \ \_\ \_ \_\ \_/\ __//\ \L\ \ \ \//\ \L\ \
+ * \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
+ * \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
+ * /\____/
+ * \_/__/
+ *
+ * Header file for Direct3D specific API.
+ *
+ * By Milan Mimica.
+ *
+ */
+
+#ifndef __al_included_allegro5_allegro_direct3d_h
+#define __al_included_allegro5_allegro_direct3d_h
+
+#include <d3d9.h>
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+/*
+ * Public Direct3D-related API
+ */
+
+/* Display creation flag. */
+#define ALLEGRO_DIRECT3D ALLEGRO_DIRECT3D_INTERNAL
+
+
+AL_FUNC(LPDIRECT3DDEVICE9, al_get_d3d_device, (ALLEGRO_DISPLAY *));
+AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_system_texture, (ALLEGRO_BITMAP *));
+AL_FUNC(LPDIRECT3DTEXTURE9, al_get_d3d_video_texture, (ALLEGRO_BITMAP *));
+AL_FUNC(bool, al_have_d3d_non_pow2_texture_support, (void));
+AL_FUNC(bool, al_have_d3d_non_square_texture_support, (void));
+AL_FUNC(void, al_get_d3d_texture_position, (ALLEGRO_BITMAP *bitmap, int *u, int *v));
+AL_FUNC(bool, al_is_d3d_device_lost, (ALLEGRO_DISPLAY *display));
+
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif
+
+/* vim: set ts=8 sts=3 sw=3 et: */
110 deps/allegro/include/allegro5/allegro_font.h
@@ -0,0 +1,110 @@
+#ifndef __al_included_allegro5_allegro_font_h
+#define __al_included_allegro5_allegro_font_h
+
+#if (defined ALLEGRO_MINGW32) || (defined ALLEGRO_MSVC) || (defined ALLEGRO_BCC32)
+ #ifndef ALLEGRO_STATICLINK
+ #ifdef ALLEGRO_FONT_SRC
+ #define _ALLEGRO_FONT_DLL __declspec(dllexport)
+ #else
+ #define _ALLEGRO_FONT_DLL __declspec(dllimport) </