Difference between revisions of "PlugIn Development:GameEx Initialize Function"
Jump to navigation
Jump to search
(→C#) |
|||
Line 1: | Line 1: | ||
This function is called when GameEx initializes.<br />Using this function call, you can run code to do various things, like set up your log files or load your settings | This function is called when GameEx initializes.<br />Using this function call, you can run code to do various things, like set up your log files or load your settings.<br /> | ||
<br /> | <br /> | ||
== <span | == <span class="plugin_headline_text">Returns</span> == | ||
This function returns a <span class="plugin_return_text">BOOLEAN</span> value.<br /> | |||
=== <span class="plugin_text_fx">Values</span> === | |||
Return <span class="plugin_return_text">TRUE</span> to initialize your plugin.<br /> | |||
Return <span class="plugin_return_text">FALSE</span> and GameEx will not initialize your plugin. | |||
=== <span | == <span class="plugin_headline_text">Code Examples</span> == | ||
=== <span class="plugin_text_fx">VB.NET</span> === | |||
---- | ---- | ||
==== <span style="color:purple;">Structure</span> ==== | ==== <span style="color:purple;">Structure</span> ==== | ||
<pre | <pre class="code_block_struct"> | ||
<StructLayout(LayoutKind.Sequential)> _ | <StructLayout(LayoutKind.Sequential)> _ | ||
Public Structure GameExInfo | Public Structure GameExInfo | ||
Line 12: | Line 18: | ||
End Structure</pre> | End Structure</pre> | ||
==== <span style="color:purple;">Function</span> ==== | ==== <span style="color:purple;">Function</span> ==== | ||
<pre | <pre class="code_block_func"> | ||
Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean | Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean | ||
Dim Info As GameExInfo = DirectCast(Marshal.PtrToStructure(InfoPtr, GetType(GameExInfo)), GameExInfo)) | Dim Info As GameExInfo = DirectCast(Marshal.PtrToStructure(InfoPtr, GetType(GameExInfo)), GameExInfo)) | ||
Line 20: | Line 26: | ||
End Function</pre> | End Function</pre> | ||
=== <span | === <span class="plugin_text_fx">C#</span> === | ||
---- | ---- | ||
==== <span style="color:purple;">Structure</span> ==== | ==== <span style="color:purple;">Structure</span> ==== | ||
<pre | <pre class="code_block_struct> | ||
[ StructLayout( LayoutKind.Sequential )] | [ StructLayout( LayoutKind.Sequential )] | ||
public struct GameExInfo | public struct GameExInfo | ||
Line 30: | Line 36: | ||
}</pre> | }</pre> | ||
==== <span style="color:purple;">Function</span> ==== | ==== <span style="color:purple;">Function</span> ==== | ||
<pre | <pre class="code_block_func"> | ||
public bool Initialize(IntPtr InfoPtr) | public bool Initialize(IntPtr InfoPtr) | ||
{ | { |
Revision as of 23:35, 27 April 2014
This function is called when GameEx initializes.
Using this function call, you can run code to do various things, like set up your log files or load your settings.
Returns
This function returns a BOOLEAN value.
Values
Return TRUE to initialize your plugin.
Return FALSE and GameEx will not initialize your plugin.
Code Examples
VB.NET
Structure
<StructLayout(LayoutKind.Sequential)> _ Public Structure GameExInfo Public GameExVersion As String End Structure
Function
Public Function Initialize(ByVal InfoPtr As IntPtr) As Boolean Dim Info As GameExInfo = DirectCast(Marshal.PtrToStructure(InfoPtr, GetType(GameExInfo)), GameExInfo)) 'This will output the current version of GameEx: Dim GameEx_Version As String = Info.GameExVersion Return True End Function
C#
Structure
[ StructLayout( LayoutKind.Sequential )] public struct GameExInfo { public string GameExVersion; }
Function
public bool Initialize(IntPtr InfoPtr) { GameExInfo Info = (GameExInfo) Marshal.PtrToStructure(InfoPtr, typeof(GameExInfo)); //This will output the current version of GameEx as a string: string GameEx_Version = Info.GameExVersion; return true; }