DLL plugin

New releases and general discussions.

Post » Wed Sep 17, 2008 11:27 pm

Construct needs a plugin that can load DLLs and call functions from them. I spent the previous weekend creating a DLL from some code I found on the internet, only to find that Construct didn't have a plugin to use DLLs like MMF does.

The alternative would be to convert the DLL to a construct extension, but I would need to see some example extensions other than the blank template that is the SDK. The source code for the DirectSound extension would be a plus, as I might be able to remove the dependency on SDL.
B
3
G
4
Posts: 11
Reputation: 1,097

Post » Thu Sep 18, 2008 12:22 am

Try examining Template SDK. Here are some tips:
-> object basically consists of two classes - EditTime Object (this one you see and access thru layout editor) and RunTime Object - used when game's working
-> in main.h you define all fields and Action, Condition, Expression methods (called ACEs in SDK), be sure to check #define IDE_FLAGS
-> actions.cpp, conditions.cpp, expressions.cpp have implementations of these methods
-> edittime.cpp - there is a place to make init of object when it's pasted on leyout editor. You define here also Properties
-> to make extension "see" this methods, edit ACE Table.cpp - it's shown how to add ACEs and set its required parameters
-> drawing.cpp contains methods for drawing object when in layout editor and when in runtime
-> runtime.cpp - there are some initialization/freeing methods you could use for memory allocation and stuff. Most of work at runtime is done by methods in actions.cpp, conditions.cpp and expressions.cpp
-> debugging.cpp, serialization.cpp - sorry, didn't learn how to use them, but names tells everything ^^

Sorry for this kinda messed explanation, still learning C++ x(.
B
6
S
3
G
6
Posts: 219
Reputation: 3,013

Post » Thu Sep 18, 2008 1:55 pm

Also feel free to ask any questions about the SDK in the plugins forum, or in the codebase forum!
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Thu Sep 18, 2008 11:16 pm

[quote="BROO":5hvixgdi]Try examining Template SDK. Here are some tips:
-> object basically consists of two classes - EditTime Object (this one you see and access thru layout editor) and RunTime Object - used when game's working
-> in main.h you define all fields and Action, Condition, Expression methods (called ACEs in SDK), be sure to check #define IDE_FLAGS
-> actions.cpp, conditions.cpp, expressions.cpp have implementations of these methods
-> edittime.cpp - there is a place to make init of object when it's pasted on leyout editor. You define here also Properties
-> to make extension "see" this methods, edit ACE Table.cpp - it's shown how to add ACEs and set its required parameters
-> drawing.cpp contains methods for drawing object when in layout editor and when in runtime
-> runtime.cpp - there are some initialization/freeing methods you could use for memory allocation and stuff. Most of work at runtime is done by methods in actions.cpp, conditions.cpp and expressions.cpp
-> debugging.cpp, serialization.cpp - sorry, didn't learn how to use them, but names tells everything ^^

Sorry for this kinda messed explanation, still learning C++ x(.[/quote:5hvixgdi]

I've already figured that stuff out, though I'm still unsure about how serialization is supposed to work (though for my DLL, I don't think I will be needing it). I'm rather new to C++ as well, and I could really use some examples so I can figure out the little things. For instance, I know that MMF extensions had unique identifiers so that the main program could verify that you had the correct extensions required to view the project file, and I figure Construct has something similar, but I haven't found it yet. Examples would help me to figure these things out for myself so I don't have to ask so many questions :p

... But all of that is beside the point of this thread. A DLL object would be very useful, regardless of whether I make the DLL into a construct plugin or not. Converting my DLL to a plugin is just something I need to do due to the lack of a DLL object.
B
3
G
4
Posts: 11
Reputation: 1,097

Post » Sun Sep 21, 2008 2:44 pm

[quote="Jcw87":1c95for0]For instance, I know that MMF extensions had unique identifiers so that the main program could verify that you had the correct extensions required to view the project file, and I figure Construct has something similar, but I haven't found it yet.[/quote:1c95for0]
The plugin SDK has no such identifier; Construct uses the plugin filename as the identifier.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 2 guests