Cpptext {} section in UnrealScript

Source: Internet
Author: User
Http://wiki.beyondunreal.com/Cpptext

The Section Cpptext {} was found in UScript, which is amazing. I thought it was similar to querying Wiki. This is a pre-declaration of CPP in the script,

Reference:

"

Unreal Script can be embedded in assembly, but can only be used in cpptext as part of the C ++ generation function.
If it is elsewhere, it is not yet supported, because it does not make sense to support it, because even if compilation can be embedded, you can only embed virtual commands of UnrealScript virtual machines, but these commands are very dangerous.
Moreover, commands embedded with virtual machines cannot bring efficiency advantages.

"

CpptextFrom Unreal Wiki, The Unreal Engine Documentation SiteJump to: navigation, search

Starting with Unreal Engine 2 UnrealScript classes/structs supportCpptext(Prefix for C ++ text) block declarations.CpptextIs a block declaration where programmers can implement C ++ functions it also can only be declared in native classes, any text within this block will then be exported to the corresponding native classprefixClasses.hFile when compiled.

Note:Structs useCppstructInstead and starting with Unreal Engine 3 it was renamedStructcpptext.

Example

Taken fromCanvas.uc.

cpptext{    //...    void DrawTile(UTexture* Tex, FLOAT X, FLOAT Y, FLOAT XL, FLOAT YL, FLOAT U, FLOAT V, FLOAT UL, FLOAT VL, const FLinearColor& Color);    //...}

This exportsDrawTileInto classUCanvasIn fileEngineClasses.hE.g.

class UCanvas : public UObject{    //...    void DrawTile(UTexture* Tex, FLOAT X, FLOAT Y, FLOAT XL, FLOAT YL, FLOAT U, FLOAT V, FLOAT UL, FLOAT VL, const FLinearColor& Color);    //...};
Why use cpptext over native functions

Even though you can just make a native UnrealScript function that will also get exported the same way but then translated to C ++, it doesn't support all formats thus in that case the native coder can implement functions that cannot be declared in UnrealScript but also because the native coder might not want you can be able to call a function from within UnrealScript.

See also
  • Native Coding
  • Native-only classes

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.