프로젝트
GitHub에서 보기
proletariatgames/unreal.hx
소개
Unreal.hx: Unreal용 Haxe 통합
게임 및 에뮬레이션What you can do
- Haxe compiles directly to C++, for high runtime performance.
- Full access to the entire Unreal C++ API - including delegates and lambdas.
- Full support for UCLASS creation, subclassing, and Blueprints.
- Very fast compilation using hxcpp's virtual machine, cppia
측정된 스타 증가
- in 24h
- 0
- in 7 days
- 0
- in 15 days
- 0
- in 1 month
- 기록 수집 중
서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.
README.md
OriginalUnreal.hx
Unreal.hx is a plugin for Unreal Engine 4 that allows you to write code in the Haxe programming language. Haxe is a modern, high-level, type-safe programming language that offers high performance critical for game development.
Main Features
- Haxe compiles directly to C++, for high runtime performance.
- Full access to the entire Unreal C++ API - including delegates and lambdas.
- Full support for
UCLASScreation, subclassing, and Blueprints. - Very fast compilation using hxcpp's virtual machine, cppia
Haxe Features
- Familiar C/Java-style syntax.
- Memory management via garbage collection.
- Strict type safety, with a powerful type inference engine.
- Many modern features such as lambdas/closures, generics, abstract data types (GADT's), reflection, metadata, and a powerful macro system for language extension.
Setup
- Make sure you've got a working
haxeinstallation, and have thehxcppandhxcshaxelibs installed - Clone this library or add it as a submodule to your Unreal project in the
Plugins/UnrealHxdirectory - Change your
Build.csfile to extendHaxeModuleRulesinstead ofModuleRules - Build your project the same way you'd build it before
- A new directory,
Haxe, will be created at the root of your project. Add any class to be compiled toHaxe/StaticorHaxe/Scripts, and you may add new compiler arguments to thearguments.hxmlfile - After the first build, you may call
haxe gen-build-script.hxmlinside theHaxedirectory to compile the Scripts without having to do a full C++ build (see our wiki) - For the latest development, Haxe 3.4.x, 4.0.0-preview1 are supported, and Unreal version 4.19 is supported
Examples
package mygame;
import unreal.*;
@:uclass
class AMyActor extends AActor {
// make a property that is editable in the editor.
@:uproperty(EditDefaultsOnly, Category=Inventory)
var items:TArray<AActor>;
// make a function that is callable from C++/Blueprints
@:ufunction(BlueprintCallable, Category=Inventory)
public function addToInventory(item:AActor) {
items.push(item);
}
// override native C++ function
override function Tick(deltaTime:Float32) : Void {
super.Tick(deltaTime); // call super functions
trace('Hello, World!'); // all traces are redirected to Unreal's Log
trace('Warning', 'Some Warning'); // and it supports Warning, Error and Fatal as well
}
// tell Unreal to call our Tick function
public function new(wrapped) {
super(wrapped);
this.PrimaryActorTick.bCanEverTick = true;
}
}
package mygame;
import unreal.*;
@:uclass
class AMyGameMode extends AGameMode {
@:uproperty(BlueprintReadWrite)
public var playerName:FString;
@:ufunction(BlueprintCallable)
public function makeExternalRequest(data:String) {
// use Unreal C++ API to make an HTTP Request
var httpRequest = FHttpModule.Get().CreateRequest();
httpRequest.SetVerb("GET");
httpRequest.SetHeader("Content-Type", "application/json");
httpRequest.SetURL("www.mygame.com/players");
// use Haxe JSON library to encode data.
var json = {
name: this.playerName,
playerData: data,
};
httpRequest.SetContentAsString(haxe.Json.stringify(json));
// Receive a callback when the response is received.
httpRequest.OnProcessRequestComplete.BindLambda(function (request, response, success) {
trace('response received: ${response.GetContentAsString()}');
});
httpRequest.ProcessRequest();
}
}
For a complete example project, check out https://github.com/waneck/HaxePlatformerGame , which is a port of Unreal's Platformer Game demo to Haxe 3.3/Unreal 4.11
More information is available on the Wiki
관련 프로젝트 살펴보기
불러오는 중…