Category:Interfaces: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(explained interfaces)
mNo edit summary
Line 1: Line 1:
'''[[Wikipedia:Interface (computer science)|Interfaces]]''' are important C++ classes that are accessed by the engine. To use an interface you create or modify an inherited class, then cast back to the interface class 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.


{{warning|'''''Never, ever''''' modify an interface class itself. You should always inherit then cast back.}}
{{warning|'''''Never, ever''''' modify an interface class itself. You should always inherit then cast back.}}

Revision as of 14:47, 2 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.

Warning.pngWarning:Never, ever modify an interface class itself. You should always inherit then cast back.

Example

IInput* input = new CInput;

This creates the IInput* input object the engine expects, placing behind it 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 are known to the engine.

Subcategories

This category has the following 5 subcategories, out of 5 total.

I