Category:Interfaces: Difference between revisions
Jump to navigation
Jump to search
Note:If you try to construct an interface directly, your mod will crash. This is done deliberately.
Warning:It is important to create all objects listed in these articles when exposing an interface, even if your mod can be compiled and run without one or another of them. If you try to cut corners you are likely to encounter weird, almost impossible to debug errors either today or after a future engine update!
Warning:Never, ever modify an interface class itself. You must always inherit then cast back.
TomEdwards (talk | contribs) (create all interface objects, or else!) |
TomEdwards (talk | contribs) (don't use interfaces directly) |
||
Line 1: | Line 1: | ||
'''[[Wikipedia:Interface (computer science)|Interfaces]]''' are important C++ classes that the engine will access when your mod is running. To use an interface you inherit from it, then cast back in a global [[pointer]] with a predefined name. | '''[[Wikipedia:Interface (computer science)|Interfaces]]''' are important C++ classes that the engine will access when your mod is running. To use an interface you inherit from it, then cast back in a global [[pointer]] with a predefined name. | ||
{{note|If you try to construct an interface directly, your mod will crash. This is done deliberately.}} | |||
{{warning|It is important to create ''all'' objects listed in these articles when exposing an interface, even if your mod can be compiled and run without one or another of them. If you try to cut corners you are likely to encounter weird, almost impossible to debug errors either today or after a future engine update!}} | {{warning|It is important to create ''all'' objects listed in these articles when exposing an interface, even if your mod can be compiled and run without one or another of them. If you try to cut corners you are likely to encounter weird, almost impossible to debug errors either today or after a future engine update!}} |
Revision as of 03:51, 7 August 2009
Interfaces are important C++ classes that the engine will access when your mod is running. To use an interface you inherit from it, then cast back in a global pointer with a predefined name.



Example
static CInput g_Input;
IInput* input = (IInput*)&g_Input;
This creates the IInput* input
and g_Input
objects the engine expects, placing behind them Valve's basic input code from CInput
.
You are free to modify CInput
, or to create your own inherited class and use that instead; just remember that only the members of IInput
will be accessed by the engine.
Subcategories
This category has the following 5 subcategories, out of 5 total.
I
- IScheme (1 P)
- ISchemeManager (1 P)
- ISystem (1 P)
- ITextureRegenerator (2 P)
Pages in category "Interfaces"
The following 26 pages are in this category, out of 26 total.