zoukankan      html  css  js  c++  java
  • UnrealScript中的Cpptext{}段落

    http://wiki.beyondunreal.com/Cpptext

    在UScript发现了Cpptext{}的段落,很神奇,还以为是类似查了Wiki,这是一种脚本中的CPP预声明,

    引用如下

    Unreal Script可以内嵌汇编的,但是只能用在cpptext里面做为C++生成函数的一部分。
    如果是其它地方,目前尚不支持,因为支持也没有意义,因为就算能内嵌汇编,你也只能内嵌UnrealScript虚拟机的虚拟指令,然而这些指令是很危险的。
    况且内嵌虚拟机的指令并不能带来效率上的优势。

    Cpptext

    From Unreal Wiki, The Unreal Engine Documentation Site

    Jump to: navigation, search

    Starting with Unreal Engine 2 UnrealScript classes/structs support cpptext(prefix for C++text) block declarations. The cpptext is 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 class prefixClasses.h file when compiled.

    Note: structs use cppstruct instead and starting with Unreal Engine 3 it was renamed to structcpptext.

    Example

    Taken from Canvas.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 exports DrawTile into class UCanvas in file EngineClasses.h e.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 to be able to call a function from within UnrealScript.

    See also

  • 相关阅读:
    npm安装Vue及配置
    Node.js安装
    代码优化总结
    Java 读取文件指定行数的数据
    Navicat Premium 15 v15.0.17 数据库开发工具 安装激活详解
    发现了一个关于 gin 1.3.0 框架的 bug
    802.1X 账号密码+设备信息双重认证
    Vue项目入门(一)
    WPF登录界面
    使用“user32.dll”控制窗体
  • 原文地址:https://www.cnblogs.com/Zephyroal/p/2360245.html
Copyright © 2011-2022 走看看