00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include "Core/precomp.h"
00020
00021 #ifdef USE_GGI
00022
00023 #include "implementation_ggi.h"
00024 #include "API/Display/Display/display.h"
00025 #include "Display/Display/GGI/display_ggi.h"
00026 #include "API/Display/Input/input.h"
00027 #include "Display/Input/GGI/mouse_ggi.h"
00028 #include "Display/Input/GGI/keyboard_ggi.h"
00029 #include "Display/Input/X11/joystick_linux.h"
00030 #include "implementation.h"
00031
00032 bool CL_Implementation_GGI::initialized = false;
00033 int CL_Implementation_GGI::display_counter=0;
00034
00035 static CL_Implementation_GGI impl_ggi;
00036
00037 extern "C"
00038 {
00039 DL_PREFIX char* clan_module_identify()
00040 {
00041 return "GGI target";
00042 }
00043
00044 DL_PREFIX char* clan_module_abbreviation()
00045 {
00046 return "ggi";
00047 }
00048
00049 DL_PREFIX void clan_module_init()
00050 {
00051 impl_ggi.add_display();
00052 }
00053 }
00054
00055 char *ggi_identify()
00056 {
00057 return clan_module_identify();
00058 }
00059
00060 char *ggi_abbreviation()
00061 {
00062 return clan_module_abbreviation();
00063 }
00064
00065 void ggi_init()
00066 {
00067 clan_module_init();
00068 }
00069
00070 CL_Implementation_GGI::~CL_Implementation_GGI()
00071 {
00072 clean_up();
00073 }
00074
00075 bool CL_Implementation_GGI::init()
00076 {
00077 if (initialized) return true;
00078
00079 return true;
00080 }
00081
00082 void CL_Implementation_GGI::clean_up()
00083 {
00084 if (display_counter == 0) return;
00085
00086 display_counter--;
00087 if (display_counter>0) return;
00088 }
00089
00090 void CL_Implementation_GGI::add_display()
00091 {
00092 if (init() == false)
00093 {
00094 cout << "ClanLib: Failed to open display. No GGI display available." << endl;
00095 }
00096
00097 CL_GGI_DisplayCard *card = new CL_GGI_DisplayCard(display_counter);
00098
00099 CL_Display::cards.push_back(card);
00100
00101 CL_Input::keyboards.push_back(new CL_GGIKeyboard(card));
00102 CL_Input::pointers.push_back(new CL_Mouse_GGI(card));
00103 #ifdef USE_JOY
00104 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
00105
00106 for (int i=0; i<8; i++)
00107 {
00108 CL_LinuxJoystick *joy = new CL_LinuxJoystick();
00109 if (joy->init(i))
00110 CL_Input::joysticks.push_back(joy);
00111 else
00112 delete joy;
00113 }
00114
00115 #endif
00116 #endif
00117
00118 display_counter+=2;
00119 }
00120
00121 #endif