This article's documentation is for the "GoldSrc" engine. Click here for more information.
This article's documentation is for anything that uses the Source engine. Click here for more information.

LINK ENTITY TO CLASS(): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
 
(Is it a function? Is it a method? Does it matter?)
Tag: Removed redirect
Line 1: Line 1:
#redirect [[Authoring a Logical Entity#Linking the class to an entity name]]
{{this is a|C++ function|name=LINK_ENTITY_TO_CLASS()|engine=Source|engine1=GoldSrc}}
It is used to link a [[classname]] to a C++ class.
 
== Syntax ==
In the standard {{srcsdk|2}} and {{hlsdk|2}}, the syntax is as such:
<syntaxhighlight lang=cpp>
LINK_ENTITY_TO_CLASS(editor_classname, CPPClassName)
</syntaxhighlight>
This will usually look like so:
<syntaxhighlight lang=cpp>
LINK_ENTITY_TO_CLASS(info_null, CNullEntity)
</syntaxhighlight>
 
=== ReGameDLL_CS ===
[[ReGameDLL_CS]] uses a modified syntax, adding an additional C++ class for server plugins:
<syntaxhighlight lang=cpp>
LINK_ENTITY_TO_CLASS(editor_classname, CPPClassName, APIClassName)
</syntaxhighlight>
This will usually look like so:
<syntaxhighlight lang=cpp>
LINK_ENTITY_TO_CLASS(info_null, CNullEntity, CCSNullEntity)
</syntaxhighlight>
 
== See also ==
* [[Authoring a Logical Entity#Linking the class to an entity name]]

Revision as of 16:50, 24 April 2025

LINK_ENTITY_TO_CLASS() is a C++ function available in all Source Source and GoldSrc GoldSrc games. It is used to link a classname to a C++ class.

Syntax

In the standard Source SDK Source SDK and Half-Life SDK Half-Life SDK, the syntax is as such:

LINK_ENTITY_TO_CLASS(editor_classname, CPPClassName)

This will usually look like so:

LINK_ENTITY_TO_CLASS(info_null, CNullEntity)

ReGameDLL_CS

ReGameDLL_CS uses a modified syntax, adding an additional C++ class for server plugins:

LINK_ENTITY_TO_CLASS(editor_classname, CPPClassName, APIClassName)

This will usually look like so:

LINK_ENTITY_TO_CLASS(info_null, CNullEntity, CCSNullEntity)

See also