Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 28th, 2012  |  syntax: None  |  size: 1.12 KB  |  hits: 17  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. #include <Windows.h>
  2. #include <gamearmor/loader.h>
  3.  
  4. extern "C" void __declspec(dllexport) LoadGA()
  5. {
  6.  
  7. }
  8.  
  9. class test1
  10.         : public gamearmor_module
  11. {
  12. public:
  13.         test1()
  14.                 : gamearmor_module("Test 1")
  15.         {
  16.  
  17.         }
  18.  
  19.         virtual gam_result initialize()
  20.         {
  21.                 return GAM_SUCCESS;
  22.         }
  23. };
  24.  
  25. test1 test1_instance;
  26. template<> test1 *gamearmor_module_manager<test1>::instance() { return &test1_instance; }
  27.  
  28. class test2
  29.         : public gamearmor_module
  30. {
  31. public:
  32.         test2()
  33.                 : gamearmor_module("Test 2")
  34.         {
  35.  
  36.         }
  37.  
  38.         virtual gam_result initialize()
  39.         {
  40.                 return GAM_SUCCESS;
  41.         }
  42. };
  43.  
  44. test2 test2_instance;
  45. template<> test2 *gamearmor_module_manager<test2>::instance() { return &test2_instance; }
  46.  
  47. BOOL APIENTRY DllMain(HMODULE hModule, DWORD  ul_reason_for_call, LPVOID lpReserved)
  48. {
  49.         switch (ul_reason_for_call)
  50.         {
  51.         case DLL_PROCESS_ATTACH:
  52.                 {
  53.                         gamearmor_loader ld;
  54.  
  55.                         try
  56.                         {
  57.                                 ld.module<test1>(1000);
  58.                                 ld.module<test2>(2000);
  59.  
  60.                                 ld.run();
  61.                         }
  62.                         catch (std::exception &ex)
  63.                         {
  64.  
  65.                         }
  66.                 }
  67.                 break;
  68.         case DLL_THREAD_ATTACH:
  69.         case DLL_THREAD_DETACH:
  70.         case DLL_PROCESS_DETACH:
  71.                 break;
  72.         }
  73.         return TRUE;
  74. }