Advertisement
Guest User

Untitled

a guest
Feb 18th, 2025
18
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.19 KB | None | 0 0
  1. #if defined (WINDOWS_VERSION)
  2.  
  3. //#include "Common.h"
  4.  
  5. // ***** DESIGN TIME PLUGIN *******
  6.  
  7. #define IMPORT_D3DOBJECT_BASE \
  8. " import attribute bool isEnabled;\r\n"\
  9. " import attribute bool isVisible;\r\n"\
  10. " import attribute int x;\r\n"\
  11. " import attribute int y;\r\n"\
  12. " readonly import attribute int width;\r\n"\
  13. " readonly import attribute int height;\r\n"\
  14. " import attribute float anchorX;\r\n"\
  15. " import attribute float anchorY;\r\n"\
  16. " import attribute float rotation;\r\n"\
  17. " import attribute float scaling;\r\n"\
  18. " import attribute float tintR;\r\n"\
  19. " import attribute float tintG;\r\n"\
  20. " import attribute float tintB;\r\n"\
  21. " import attribute float alpha;\r\n"\
  22. " import attribute bool isAutoUpdated;\r\n"\
  23. " import attribute bool isAutoRendered;\r\n"\
  24. " import attribute D3D_RenderStage renderStage;\r\n"\
  25. " import attribute D3D_RelativeTo relativeTo;\r\n"\
  26. " import attribute int room;\r\n"\
  27. " import void SetPosition( int x, int y );\r\n"\
  28. " import void SetAnchor( float x, float y );\r\n"\
  29. " import void SetTint( float r, float g, float b );\r\n"\
  30. " import void SetParent( int parentKey );\r\n"\
  31. " import int GetKey();\r\n"\
  32. " import void Update();\r\n"\
  33. " import void Render();\r\n"
  34.  
  35. IAGSEditor *editor;
  36. const char *ourScriptHeader =
  37.  
  38. // *** D3D_Filtering ***
  39. "enum D3D_Filtering\r\n"
  40. "{\r\n"
  41. " eD3D_FilterNearest = 0,\r\n"
  42. " eD3D_FilterLinear = 1\r\n"
  43. "};\r\n\r\n"
  44.  
  45. // *** D3D_RenderStage ***
  46. "enum D3D_RenderStage\r\n"
  47. "{\r\n"
  48. " eD3D_StageBackground = 0,\r\n"
  49. " eD3D_StageScene = 1,\r\n"
  50. " eD3D_StageGUI = 2,\r\n"
  51. " eD3D_StageScreen = 3,\r\n"
  52. "};\r\n\r\n"
  53.  
  54. // *** D3D_RelativeTo ***
  55. "enum D3D_RelativeTo\r\n"
  56. "{\r\n"
  57. " eD3D_RelativeToRoom = 0,\r\n"
  58. " eD3D_RelativeToScreen = 1\r\n"
  59. "};\r\n\r\n"
  60.  
  61. // *** D3D_Sprite ***
  62. "managed struct D3D_Sprite\r\n"
  63. "{\r\n"
  64.  
  65. IMPORT_D3DOBJECT_BASE
  66.  
  67. // SpriteObject
  68. "};\r\n\r\n"
  69.  
  70. #if defined (VIDEO_PLAYBACK)
  71. // *** D3D_Video ***
  72. "managed struct D3D_Video\r\n"
  73. "{\r\n"
  74.  
  75. IMPORT_D3DOBJECT_BASE
  76.  
  77. // D3DVideoObject
  78. " import attribute bool isLooping;\r\n"
  79. " import attribute float fps;\r\n"
  80.  
  81. " import bool NextFrame();\r\n"
  82. " import void Autoplay();\r\n"
  83. " import bool IsAutoplaying();\r\n"
  84. " import void StopAutoplay();\r\n"
  85. "};\r\n\r\n"
  86. #endif // VIDEO_PLAYBACK
  87.  
  88. // *** D3D ****
  89. "struct D3D\r\n"
  90. "{\r\n"
  91. " import static void SetLoopsPerSecond( int loops );\r\n"
  92. #if defined (VIDEO_PLAYBACK)
  93. " import static D3D_Video* OpenVideo( String filename );\r\n"
  94. #endif
  95. " import static D3D_Sprite* OpenSprite( int graphic );\r\n"
  96. " import static D3D_Sprite* OpenSpriteFile( String filename, D3D_Filtering filtering );\r\n"
  97. " import static D3D_Sprite* OpenBackground( int frame );\r\n"
  98. "};\r\n"
  99. "import void testCall();\r\n"
  100. ;
  101.  
  102. LPCSTR AGS_GetPluginName()
  103. {
  104. // Return the plugin description
  105. return "SpriteVideo Plugin";
  106. }
  107.  
  108. int AGS_EditorStartup(IAGSEditor *lpEditor)
  109. {
  110. // User has checked the plugin to use it in their game
  111.  
  112. // If it's an earlier version than what we need, abort.
  113. if (lpEditor->version < 1)
  114. return -1;
  115.  
  116. editor = lpEditor;
  117. editor->RegisterScriptHeader(ourScriptHeader);
  118.  
  119. // Return 0 to indicate success
  120. return 0;
  121. }
  122.  
  123. void AGS_EditorShutdown()
  124. {
  125. // User has un-checked the plugin from their game
  126. editor->UnregisterScriptHeader(ourScriptHeader);
  127. }
  128.  
  129. void AGS_EditorProperties(HWND parent)
  130. {
  131. // User has chosen to view the Properties of the plugin
  132. // We could load up an options dialog or something here instead
  133. MessageBox(parent,
  134. L"SpriteVideo Plugin © 2022 Ivan Mogilko\n\n"
  135. L"Based on Direct3D Plugin © 2012 Aki Ahonen\n\n"
  136. L"See https://github.com/ivan-mogilko/ags-spritevideo/wiki for more information.",
  137. L"About", MB_OK | MB_ICONINFORMATION);
  138. }
  139.  
  140. int AGS_EditorSaveGame(char *buffer, int bufsize)
  141. {
  142. // We don't want to save any persistent data
  143. return 0;
  144. }
  145.  
  146. void AGS_EditorLoadGame(char *buffer, int bufsize)
  147. {
  148. // Nothing to load for this dummy plugin
  149. }
  150.  
  151.  
  152. // ******* END DESIGN TIME *******
  153. #endif // WINDOWS_VERSION
  154.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement