Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
99 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Proletariat Inc. | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy of | ||
this software and associated documentation files (the "Software"), to deal in | ||
the Software without restriction, including without limitation the rights to | ||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of | ||
the Software, and to permit persons to whom the Software is furnished to do so, | ||
subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS | ||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR | ||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER | ||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
# Unreal.hx | ||
|
||
Unreal.hx is a plugin for Unreal Engine 4 that allows you to write code in the [Haxe](haxe.org) 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. | ||
- Full support for `UCLASS` creation, subclassing, and Blueprints. | ||
|
||
### 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 | ||
|
||
TODO | ||
|
||
### Examples | ||
|
||
```haxe | ||
package; | ||
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) | ||
public function addToInventory(item:AActor) { | ||
items.push(item); | ||
} | ||
// override native C++ function | ||
override function Tick(deltaTime:Float32) : Void { | ||
} | ||
} | ||
``` | ||
|
||
|
||
```haxe | ||
package; | ||
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(); | ||
} | ||
} | ||
``` | ||
|
||
More information is available on the [Wiki](https://github.com/proletariatgames/ue4hx/wiki) |