1
1

anttweakbar.d 6.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. Boost Software License - Version 1.0 - August 17th, 2003
  3. Permission is hereby granted, free of charge, to any person or organization
  4. obtaining a copy of the software and accompanying documentation covered by
  5. this license (the "Software") to use, reproduce, display, distribute,
  6. execute, and transmit the Software, and to prepare derivative works of the
  7. Software, and to permit third-parties to whom the Software is furnished to
  8. do so, all subject to the following:
  9. The copyright notices in the Software and this entire statement, including
  10. the above license grant, this restriction and the following disclaimer,
  11. must be included in all copies of the Software, in whole or in part, and
  12. all derivative works of the Software, unless such copies or derivative
  13. works are solely in the form of machine-executable object code generated by
  14. a source language processor.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
  18. SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
  19. FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
  20. ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
  21. DEALINGS IN THE SOFTWARE.
  22. */
  23. module derelict.anttweakbar.anttweakbar;
  24. public
  25. {
  26. import derelict.anttweakbar.types;
  27. import derelict.anttweakbar.functions;
  28. }
  29. private
  30. {
  31. import derelict.util.loader;
  32. import derelict.util.system;
  33. static if(Derelict_OS_Windows)
  34. version(Win64) enum libNames = "AntTweakBar64.dll";
  35. else enum libNames = "AntTweakBar.dll";
  36. else static if(Derelict_OS_Mac)
  37. enum libNames = "libAntTweakBar.dylib";
  38. else static if(Derelict_OS_Posix)
  39. enum libNames = "libAntTweakBar.so,libAntTweakBar.so,/usr/local/lib/libAntTweakBar.so,/usr/local/lib/libAntTweakBar.so";
  40. else
  41. static assert(0, "Need to implement AntTweakBar libNames for this operating system.");
  42. }
  43. class DerelictAntTweakBarLoader : SharedLibLoader
  44. {
  45. protected
  46. {
  47. override void loadSymbols()
  48. {
  49. bindFunc(cast(void**)&TwNewBar , "_TwNewBar@4");
  50. bindFunc(cast(void**)&TwDeleteBar , "_TwDeleteBar@4");
  51. bindFunc(cast(void**)&TwDeleteAllBars , "_TwDeleteAllBars@0");
  52. bindFunc(cast(void**)&TwSetTopBar , "_TwSetTopBar@4");
  53. bindFunc(cast(void**)&TwGetTopBar , "_TwGetTopBar@0");
  54. bindFunc(cast(void**)&TwSetBottomBar , "_TwSetBottomBar@4");
  55. bindFunc(cast(void**)&TwGetBottomBar , "_TwGetBottomBar@0");
  56. bindFunc(cast(void**)&TwGetBarName , "_TwGetBarName@4");
  57. bindFunc(cast(void**)&TwGetBarCount , "_TwGetBarCount@0");
  58. bindFunc(cast(void**)&TwGetBarByIndex , "_TwGetBarByIndex@4");
  59. bindFunc(cast(void**)&TwGetBarByName , "_TwGetBarByName@4");
  60. bindFunc(cast(void**)&TwRefreshBar , "_TwRefreshBar@4");
  61. bindFunc(cast(void**)&TwAddVarRW , "_TwAddVarRW@20");
  62. bindFunc(cast(void**)&TwAddVarRO , "_TwAddVarRO@20");
  63. bindFunc(cast(void**)&TwAddVarCB , "_TwAddVarCB@28");
  64. bindFunc(cast(void**)&TwAddButton , "_TwAddButton@20");
  65. bindFunc(cast(void**)&TwAddSeparator , "_TwAddSeparator@12");
  66. bindFunc(cast(void**)&TwRemoveVar , "_TwRemoveVar@8");
  67. bindFunc(cast(void**)&TwRemoveAllVars , "_TwRemoveAllVars@4");
  68. bindFunc(cast(void**)&TwDefine , "_TwDefine@4");
  69. bindFunc(cast(void**)&TwDefineEnum , "_TwDefineEnum@12");
  70. bindFunc(cast(void**)&TwDefineEnumFromString , "_TwDefineEnumFromString@8");
  71. bindFunc(cast(void**)&TwDefineStruct , "_TwDefineStruct@24");
  72. bindFunc(cast(void**)&TwCopyCDStringToClientFunc , "_TwCopyCDStringToClientFunc@4");
  73. bindFunc(cast(void**)&TwCopyCDStringToLibrary , "_TwCopyCDStringToLibrary@8");
  74. bindFunc(cast(void**)&TwGetParam , "_TwGetParam@24");
  75. bindFunc(cast(void**)&TwSetParam , "_TwSetParam@24");
  76. bindFunc(cast(void**)&TwInit , "_TwInit@8");
  77. bindFunc(cast(void**)&TwTerminate , "_TwTerminate@0");
  78. bindFunc(cast(void**)&TwDraw , "_TwDraw@0");
  79. bindFunc(cast(void**)&TwWindowSize , "_TwWindowSize@8");
  80. bindFunc(cast(void**)&TwSetCurrentWindow , "_TwSetCurrentWindow@4");
  81. bindFunc(cast(void**)&TwGetCurrentWindow , "_TwGetCurrentWindow@0");
  82. bindFunc(cast(void**)&TwWindowExists , "_TwWindowExists@4");
  83. bindFunc(cast(void**)&TwKeyPressed , "_TwKeyPressed@8");
  84. bindFunc(cast(void**)&TwKeyTest , "_TwKeyTest@8");
  85. bindFunc(cast(void**)&TwMouseButton , "_TwMouseButton@8");
  86. bindFunc(cast(void**)&TwMouseMotion , "_TwMouseMotion@8");
  87. bindFunc(cast(void**)&TwMouseWheel , "_TwMouseWheel@4");
  88. bindFunc(cast(void**)&TwGetLastError , "_TwGetLastError@0");
  89. bindFunc(cast(void**)&TwHandleErrors , "_TwHandleErrors@4");
  90. bindFunc(cast(void**)&TwEventWin , "_TwEventWin@16");
  91. bindFunc(cast(void**)&TwEventSDL , "_TwEventSDL@12");
  92. bindFunc(cast(void**)&TwEventMouseButtonGLFW , "_TwEventMouseButtonGLFW@8");
  93. bindFunc(cast(void**)&TwEventKeyGLFW , "_TwEventKeyGLFW@8");
  94. bindFunc(cast(void**)&TwEventCharGLFW , "_TwEventCharGLFW@8");
  95. bindFunc(cast(void**)&TwEventMouseButtonGLUT , "TwEventMouseButtonGLUT");
  96. bindFunc(cast(void**)&TwEventMouseMotionGLUT , "TwEventMouseMotionGLUT");
  97. bindFunc(cast(void**)&TwEventKeyboardGLUT , "TwEventKeyboardGLUT");
  98. bindFunc(cast(void**)&TwEventSpecialGLUT , "TwEventSpecialGLUT");
  99. // bindFunc(cast(void**)&TwGLUTModifiersFunc , "TwGLUTModifiersFunc");
  100. // bindFunc(cast(void**)&TwEventSFML , "TwEventSFML");
  101. bindFunc(cast(void**)&TwEventMouseButtonGLFWcdecl , "TwEventMouseButtonGLFWcdecl");
  102. bindFunc(cast(void**)&TwEventKeyGLFWcdecl , "TwEventKeyGLFWcdecl");
  103. bindFunc(cast(void**)&TwEventCharGLFWcdecl , "TwEventCharGLFWcdecl");
  104. bindFunc(cast(void**)&TwEventMousePosGLFWcdecl , "TwEventMousePosGLFWcdecl");
  105. }
  106. }
  107. public
  108. {
  109. this()
  110. {
  111. super(libNames);
  112. }
  113. }
  114. }
  115. __gshared DerelictAntTweakBarLoader DerelictAntTweakBar;
  116. shared static this()
  117. {
  118. DerelictAntTweakBar = new DerelictAntTweakBarLoader();
  119. }
  120. shared static ~this()
  121. {
  122. DerelictAntTweakBar.unload();
  123. }