forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
29
Kha/Sources/kha/arrays/Uint8Array.hx
Normal file
29
Kha/Sources/kha/arrays/Uint8Array.hx
Normal file
@ -0,0 +1,29 @@
|
||||
package kha.arrays;
|
||||
|
||||
@:forward
|
||||
abstract Uint8Array(ByteArray) from ByteArray to ByteArray {
|
||||
public var length(get, never): Int;
|
||||
|
||||
inline function get_length(): Int {
|
||||
return this.byteLength;
|
||||
}
|
||||
|
||||
public function new(elements: Int) {
|
||||
this = ByteArray.make(elements);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function get(k: Int): Int {
|
||||
return this.getUint8(k);
|
||||
}
|
||||
|
||||
@:arrayAccess
|
||||
public inline function set(k: Int, v: Int): Int {
|
||||
this.setUint8(k, v);
|
||||
return get(k);
|
||||
}
|
||||
|
||||
public inline function subarray(start: Int, ?end: Int): Uint8Array {
|
||||
return this.subarray(start, end);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user