00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "Core/precomp.h"
00021
00022 #ifdef USE_OPENGL
00023
00024 #include "implementation_xwindow.h"
00025 #include "implementation_glx.h"
00026
00027 #include "API/Display/Display/display.h"
00028 #include "API/Display/Input/input.h"
00029
00030 #include "Display/Display/X11/display_xwindow.h"
00031 #include "Display/Input/X11/mouse_x11.h"
00032 #include "Display/Input/X11/keyboard_x11.h"
00033 #include "Display/Input/X11/joystick_linux.h"
00034
00035 #include "GL/GLX/displaycard_glx.h"
00036
00037 extern "C"
00038 {
00039 char* clan_module_identify()
00040 {
00041 return "GLX target";
00042 }
00043
00044 char* clan_module_abbreviation()
00045 {
00046 return "glx";
00047 }
00048
00049 void clan_module_init()
00050 {
00051 CL_Implementation_GLX::add_display();
00052 }
00053 }
00054
00055 char* glx_identify()
00056 {
00057 return clan_module_identify();
00058 }
00059
00060 char* glx_abbreviation()
00061 {
00062 return clan_module_abbreviation();
00063 }
00064
00065 void glx_init()
00066 {
00067 clan_module_init();
00068 }
00069
00070 void CL_Implementation_GLX::add_display()
00071 {
00072 if (CL_Implementation_XWindow::init() == false)
00073 {
00074 std::cout << "ClanLib: Failed to open display. No X11 display available." << std::endl;
00075 exit(-1);
00076 }
00077
00078 CL_GLX_DisplayCard *card = new CL_GLX_DisplayCard(
00079 CL_Implementation_XWindow::dpy,
00080 CL_Implementation_XWindow::root,
00081 CL_Implementation_XWindow::display_counter);
00082
00083 CL_Display::cards.push_back(card);
00084
00085 CL_Input::keyboards.push_back(new CL_XWindowKeyboard(card));
00086 CL_Input::pointers.push_back(new CL_Mouse_XWin(card));
00087 #ifdef USE_JOY
00088 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,1,0)
00089
00090 CL_LinuxJoystick *joy = new CL_LinuxJoystick();
00091 if (joy->init())
00092 CL_Input::joysticks.push_back(joy);
00093 else
00094 delete joy;
00095
00096 #endif
00097 #endif
00098
00099 CL_Implementation_XWindow::display_counter+=3;
00100 }
00101
00102 #endif