forked from LeenkxTeam/LNXSDK
Update Files
This commit is contained in:
3
Kha/Backends/WPF/kha/Blob.hx
Normal file
3
Kha/Backends/WPF/kha/Blob.hx
Normal file
@ -0,0 +1,3 @@
|
||||
package kha;
|
||||
|
||||
typedef Blob = kha.internal.BytesBlob;
|
3
Kha/Backends/WPF/kha/Font.hx
Normal file
3
Kha/Backends/WPF/kha/Font.hx
Normal file
@ -0,0 +1,3 @@
|
||||
package kha;
|
||||
|
||||
typedef Font = kha.Kravur;
|
196
Kha/Backends/WPF/kha/Image.hx
Normal file
196
Kha/Backends/WPF/kha/Image.hx
Normal file
@ -0,0 +1,196 @@
|
||||
package kha;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import kha.graphics4.TextureFormat;
|
||||
import kha.graphics4.Usage;
|
||||
import kha.wpf.Painter;
|
||||
import system.windows.media.DrawingVisual;
|
||||
import system.windows.media.ImageBrush;
|
||||
import system.windows.media.imaging.BitmapSource;
|
||||
|
||||
class Image implements Resource {
|
||||
var myWidth: Int;
|
||||
var myHeight: Int;
|
||||
var myFormat: TextureFormat;
|
||||
var painter: Painter;
|
||||
|
||||
public var image: BitmapSource;
|
||||
public var brush: ImageBrush;
|
||||
|
||||
public static function create(width: Int, height: Int, format: TextureFormat = null, usage: Usage = null): Image {
|
||||
return new Image(width, height, format == null ? TextureFormat.RGBA32 : format);
|
||||
}
|
||||
|
||||
public static function create3D(width: Int, height: Int, depth: Int, format: TextureFormat = null, usage: Usage = null): Image {
|
||||
return null;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
global::System.Windows.Media.Imaging.RenderTargetBitmap image = new global::System.Windows.Media.Imaging.RenderTargetBitmap(width, height, 96, 96, global::System.Windows.Media.PixelFormats.Pbgra32);
|
||||
return fromImage(image, image.PixelWidth, image.PixelHeight);
|
||||
')
|
||||
public static function createRenderTarget(width: Int, height: Int, format: TextureFormat = null, depthStencil: Bool = false,
|
||||
antiAliasingSamples: Int = 1): Image {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function fromBytes(bytes: Bytes, width: Int, height: Int, format: TextureFormat = null, usage: Usage = null): Image {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function fromBytes3D(bytes: Bytes, width: Int, height: Int, depth: Int, format: TextureFormat = null, usage: Usage = null): Image {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function new(width: Int, height: Int, format: TextureFormat) {
|
||||
myWidth = width;
|
||||
myHeight = height;
|
||||
myFormat = format;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
global::System.Windows.Media.Imaging.BitmapImage image = new global::System.Windows.Media.Imaging.BitmapImage(new global::System.Uri(filename, global::System.UriKind.Relative));
|
||||
return fromImage(image, image.PixelWidth, image.PixelHeight);
|
||||
')
|
||||
public static function fromFilename(filename: String): Image {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static function fromImage(image: Dynamic, width: Int, height: Int): Image {
|
||||
var img = new Image(width, height, TextureFormat.RGBA32);
|
||||
img.image = image;
|
||||
img.brush = new ImageBrush(image);
|
||||
return img;
|
||||
}
|
||||
|
||||
public var g2(get, never): kha.graphics2.Graphics;
|
||||
|
||||
function get_g2(): kha.graphics2.Graphics {
|
||||
if (painter == null) {
|
||||
painter = new Painter(width, height);
|
||||
painter.image = image;
|
||||
painter.visual = new DrawingVisual();
|
||||
}
|
||||
return painter;
|
||||
}
|
||||
|
||||
public var g4(get, never): kha.graphics4.Graphics;
|
||||
|
||||
function get_g4(): kha.graphics4.Graphics {
|
||||
return null;
|
||||
}
|
||||
|
||||
public var width(get, never): Int;
|
||||
|
||||
function get_width(): Int {
|
||||
return myWidth;
|
||||
}
|
||||
|
||||
public var height(get, never): Int;
|
||||
|
||||
function get_height(): Int {
|
||||
return myHeight;
|
||||
}
|
||||
|
||||
public var depth(get, never): Int;
|
||||
|
||||
function get_depth(): Int {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public var format(get, never): TextureFormat;
|
||||
|
||||
function get_format(): TextureFormat {
|
||||
return myFormat;
|
||||
}
|
||||
|
||||
public var realWidth(get, never): Int;
|
||||
|
||||
function get_realWidth(): Int {
|
||||
return width;
|
||||
}
|
||||
|
||||
public var realHeight(get, never): Int;
|
||||
|
||||
function get_realHeight(): Int {
|
||||
return height;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
if (x < 0 || y < 0 || x >= image.PixelWidth || y >= image.PixelHeight)
|
||||
return false;
|
||||
|
||||
byte[] pixels = new byte[8];
|
||||
image.CopyPixels(new global::System.Windows.Int32Rect(x, y, 1, 1), pixels, image.PixelWidth * 4, 0);
|
||||
return pixels[3] > 0;
|
||||
')
|
||||
public function isOpaque(x: Int, y: Int): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function at(x: Int, y: Int): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function unload(): Void {
|
||||
image = null;
|
||||
}
|
||||
|
||||
// public function getTexture(): Texture {
|
||||
// return null;
|
||||
// }
|
||||
// public function setTexture(texture: Texture): Void {
|
||||
//
|
||||
// }
|
||||
public var bytes: Bytes;
|
||||
|
||||
public function lock(level: Int = 0): Bytes {
|
||||
bytes = Bytes.alloc(myFormat == TextureFormat.RGBA32 ? 4 * width * height : width * height);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
global::System.Windows.Media.PixelFormat pf = global::System.Windows.Media.PixelFormats.Bgra32;
|
||||
int rawStride = (myWidth * pf.BitsPerPixel + 7) / 8;
|
||||
var bgra = new byte[myWidth * myHeight * 4];
|
||||
for (int y = 0; y < myHeight; ++y) {
|
||||
for (int x = 0; x < myWidth; ++x) {
|
||||
bgra[y * myWidth * 4 + x * 4 + 0] = 0;
|
||||
bgra[y * myWidth * 4 + x * 4 + 1] = 0;
|
||||
bgra[y * myWidth * 4 + x * 4 + 2] = 0;
|
||||
bgra[y * myWidth * 4 + x * 4 + 3] = bytes.b[y * myWidth + x];
|
||||
}
|
||||
}
|
||||
image = global::System.Windows.Media.Imaging.BitmapSource.Create(myWidth, myHeight, 96, 96, pf, null, bgra, rawStride);
|
||||
brush = new global::System.Windows.Media.ImageBrush(image);
|
||||
')
|
||||
public function unlock(): Void {}
|
||||
|
||||
public function getPixels(): Bytes {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function generateMipmaps(levels: Int): Void {}
|
||||
|
||||
public function setMipmaps(mipmaps: Array<Image>): Void {}
|
||||
|
||||
public function setDepthStencilFrom(image: Image): Void {}
|
||||
|
||||
public function clear(x: Int, y: Int, z: Int, width: Int, height: Int, depth: Int, color: Color): Void {}
|
||||
|
||||
public static var maxSize(get, never): Int;
|
||||
|
||||
static function get_maxSize(): Int {
|
||||
return 4096;
|
||||
}
|
||||
|
||||
public static var nonPow2Supported(get, never): Bool;
|
||||
|
||||
static function get_nonPow2Supported(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function renderTargetsInvertedY(): Bool {
|
||||
return true;
|
||||
}
|
||||
}
|
78
Kha/Backends/WPF/kha/LoaderImpl.hx
Normal file
78
Kha/Backends/WPF/kha/LoaderImpl.hx
Normal file
@ -0,0 +1,78 @@
|
||||
package kha;
|
||||
|
||||
import haxe.CallStack;
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.BytesData;
|
||||
import haxe.Json;
|
||||
import kha.Blob;
|
||||
import kha.FontStyle;
|
||||
import kha.Kravur;
|
||||
import system.io.File;
|
||||
import system.windows.FrameworkElement;
|
||||
import system.windows.input.Cursor;
|
||||
import system.windows.input.Cursors;
|
||||
import system.windows.input.Mouse;
|
||||
|
||||
class LoaderImpl {
|
||||
public static var path: String = "";
|
||||
public static var forceBusyCursor: Bool = false;
|
||||
static var savedCursor: Cursor;
|
||||
static var busyCursor: Bool = false;
|
||||
|
||||
public static function loadSoundFromDescription(desc: Dynamic, done: kha.Sound->Void, failed: AssetError->Void): Void {
|
||||
done(new kha.wpf.Sound(path + desc.files[0]));
|
||||
}
|
||||
|
||||
public static function getSoundFormats(): Array<String> {
|
||||
return ["wav"];
|
||||
}
|
||||
|
||||
public static function loadImageFromDescription(desc: Dynamic, done: kha.Image->Void, failed: AssetError->Void): Void {
|
||||
done(Image.fromFilename(path + desc.files[0]));
|
||||
}
|
||||
|
||||
public static function getImageFormats(): Array<String> {
|
||||
return ["png", "jpg"];
|
||||
}
|
||||
|
||||
public static function loadBlobFromDescription(desc: Dynamic, done: kha.Blob->Void, failed: AssetError->Void): Void {
|
||||
done(new Blob(Bytes.ofData(File.ReadAllBytes(path + desc.files[0]))));
|
||||
}
|
||||
|
||||
public static function loadVideoFromDescription(desc: Dynamic, done: kha.Video->Void, failed: AssetError->Void): Void {
|
||||
done(new kha.wpf.Video(path + desc.files[0]));
|
||||
}
|
||||
|
||||
public static function getVideoFormats(): Array<String> {
|
||||
return ["wmv"];
|
||||
}
|
||||
|
||||
public static function loadFontFromDescription(desc: Dynamic, done: kha.Font->Void, failed: AssetError->Void): Void {
|
||||
loadBlobFromDescription(desc, function(blob: Blob) {
|
||||
done(new Kravur(blob));
|
||||
}, failed);
|
||||
}
|
||||
|
||||
@:functionCode('global::System.Diagnostics.Process.Start(new global::System.Uri(url).AbsoluteUri);')
|
||||
public static function loadURL(url: String): Void {}
|
||||
|
||||
public static function setNormalCursor() {
|
||||
savedCursor = Cursors.Arrow;
|
||||
// if (!busyCursor && !forceBusyCursor) Starter.frameworkElement.Cursor = Cursors.Arrow;
|
||||
}
|
||||
|
||||
public static function setHandCursor() {
|
||||
savedCursor = Cursors.Hand;
|
||||
// if (!busyCursor && !forceBusyCursor) Starter.frameworkElement.Cursor = Cursors.Hand;
|
||||
}
|
||||
|
||||
public static function setCursorBusy(busy: Bool) {
|
||||
/*busyCursor = busy;
|
||||
if (busy || forceBusyCursor) {
|
||||
Starter.frameworkElement.Cursor = Cursors.Wait;
|
||||
}
|
||||
else {
|
||||
Starter.frameworkElement.Cursor = savedCursor;
|
||||
}*/
|
||||
}
|
||||
}
|
51
Kha/Backends/WPF/kha/Storage.hx
Normal file
51
Kha/Backends/WPF/kha/Storage.hx
Normal file
@ -0,0 +1,51 @@
|
||||
package kha;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
import haxe.io.Path;
|
||||
import haxe.Serializer;
|
||||
import haxe.Unserializer;
|
||||
import kha.Blob;
|
||||
import kha.StorageFile;
|
||||
import system.io.Directory;
|
||||
import system.io.File;
|
||||
|
||||
using StringTools;
|
||||
|
||||
class WPFStorageFile extends StorageFile {
|
||||
var file: Path;
|
||||
|
||||
public function new(filename: String) {
|
||||
this.file = new Path(filename);
|
||||
if (file.dir != null)
|
||||
Directory.CreateDirectory(file.dir);
|
||||
}
|
||||
|
||||
override public function read(): Blob {
|
||||
if (file == null)
|
||||
return null;
|
||||
if (!File.Exists(file.toString()))
|
||||
return null;
|
||||
return Blob.fromBytes(Bytes.ofData(File.ReadAllBytes(file.toString())));
|
||||
}
|
||||
|
||||
override public function write(data: Blob): Void {
|
||||
File.WriteAllBytes(file.toString(), data.toBytes().getData());
|
||||
}
|
||||
}
|
||||
|
||||
class Storage {
|
||||
public static function namedFile(name: String): StorageFile {
|
||||
name = name.replace("<", "-(");
|
||||
name = name.replace(">", ")-");
|
||||
name = name.replace(":", "_");
|
||||
name = name.replace("|", ")(");
|
||||
name = name.replace("?", "(Q)");
|
||||
name = name.replace("*", "(+)");
|
||||
name = name.replace("\"", "''");
|
||||
return new WPFStorageFile(name);
|
||||
}
|
||||
|
||||
public static function defaultFile(): StorageFile {
|
||||
return namedFile("default.kha");
|
||||
}
|
||||
}
|
498
Kha/Backends/WPF/kha/SystemImpl.hx
Normal file
498
Kha/Backends/WPF/kha/SystemImpl.hx
Normal file
@ -0,0 +1,498 @@
|
||||
package kha;
|
||||
|
||||
import kha.System.SystemOptions;
|
||||
import kha.input.Mouse;
|
||||
import kha.wpf.Graphics;
|
||||
import system.diagnostics.Stopwatch;
|
||||
import kha.input.Keyboard;
|
||||
import system.windows.controls.Canvas;
|
||||
import system.windows.FrameworkElement;
|
||||
|
||||
@:classCode('
|
||||
protected override void OnRender(global::System.Windows.Media.DrawingContext drawingContext) {
|
||||
base.OnRender(drawingContext);
|
||||
|
||||
if (kha.SystemImpl.painter != null) {
|
||||
kha.SystemImpl.painter.context = drawingContext;
|
||||
//Starter.painter.begin();
|
||||
System.render(0, SystemImpl.framebuffer);
|
||||
//if (drawMousePos) {
|
||||
// Starter.painter.setColor(unchecked((int)0xFFFFFFFF));
|
||||
// Starter.painter.fillRect(mousePosX - 5, mousePosY - 5, 10, 10);
|
||||
// Starter.painter.setColor(unchecked((int)0xFF000000));
|
||||
// Starter.painter.drawRect(mousePosX - 5, mousePosY - 5, 10, 10, default(global::haxe.lang.Null<double>));
|
||||
//}
|
||||
//Starter.painter.end();
|
||||
}
|
||||
//global::System.GC.Collect();
|
||||
}
|
||||
')
|
||||
class StoryPublishCanvas extends system.windows.controls.Canvas {
|
||||
var mousePosX: Int;
|
||||
var mousePosY: Int;
|
||||
|
||||
public var drawMousePos: Bool;
|
||||
|
||||
public function setMousePos(posX: Int, posY: Int): Void {
|
||||
mousePosX = posX;
|
||||
mousePosY = posY;
|
||||
}
|
||||
}
|
||||
|
||||
@:classCode('
|
||||
private global::System.Collections.Generic.HashSet<global::System.Windows.Input.Key> pressedKeys = new global::System.Collections.Generic.HashSet<global::System.Windows.Input.Key>();
|
||||
|
||||
void CompositionTarget_Rendering(object sender, global::System.EventArgs e) {
|
||||
double widthTransform = canvas.ActualWidth / kha.System.windowWidth(new global::haxe.lang.Null<int>(0, true));
|
||||
double heightTransform = canvas.ActualHeight / kha.System.windowHeight(new global::haxe.lang.Null<int>(0, true));
|
||||
double transform = global::System.Math.Min(widthTransform, heightTransform);
|
||||
canvas.RenderTransform = new global::System.Windows.Media.ScaleTransform(transform, transform);
|
||||
Scheduler.executeFrame(); // Main loop
|
||||
canvas.InvalidateVisual();
|
||||
InvalidateVisual();
|
||||
}
|
||||
|
||||
protected override void OnTextInput(global::System.Windows.Input.TextCompositionEventArgs e) {
|
||||
base.OnTextInput(e);
|
||||
kha.SystemImpl.OnTextInput(e);
|
||||
}
|
||||
|
||||
protected override void OnKeyDown(global::System.Windows.Input.KeyEventArgs e) {
|
||||
base.OnKeyDown(e);
|
||||
kha.SystemImpl.OnKeyDown(e);
|
||||
}
|
||||
|
||||
protected override void OnKeyUp(global::System.Windows.Input.KeyEventArgs e) {
|
||||
base.OnKeyUp(e);
|
||||
kha.SystemImpl.OnKeyUp(e);
|
||||
}
|
||||
|
||||
protected override void OnClosed(global::System.EventArgs e) {
|
||||
base.OnClosed(e);
|
||||
|
||||
//Game.the.onPause();
|
||||
//Game.the.onBackground();
|
||||
//Game.the.onShutdown();
|
||||
}
|
||||
|
||||
protected override void OnMouseDown(global::System.Windows.Input.MouseButtonEventArgs e) {
|
||||
base.OnMouseDown(e);
|
||||
kha.SystemImpl.OnMouseDown(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseUp(global::System.Windows.Input.MouseButtonEventArgs e) {
|
||||
base.OnMouseUp(e);
|
||||
kha.SystemImpl.OnMouseUp(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseMove(global::System.Windows.Input.MouseEventArgs e) {
|
||||
base.OnMouseMove(e);
|
||||
kha.SystemImpl.OnMouseMove(e);
|
||||
}
|
||||
|
||||
protected override void OnMouseWheel(global::System.Windows.Input.MouseWheelEventArgs e) {
|
||||
base.OnMouseWheel(e);
|
||||
kha.SystemImpl.OnMouseWheel(e);
|
||||
}
|
||||
')
|
||||
class MainWindow extends system.windows.Window {
|
||||
public var canvas: StoryPublishCanvas;
|
||||
|
||||
@:functionCode('
|
||||
canvas = new StoryPublishCanvas();
|
||||
AddChild(canvas);
|
||||
|
||||
Title = title;
|
||||
resize(width, height);
|
||||
|
||||
// Go fullscreen
|
||||
//WindowStyle = global::System.Windows.WindowStyle.None;
|
||||
//WindowState = global::System.Windows.WindowState.Maximized;
|
||||
|
||||
Background = new global::System.Windows.Media.SolidColorBrush(global::System.Windows.Media.Color.FromArgb(0, 0, 0, 0));
|
||||
global::System.Windows.Media.CompositionTarget.Rendering += new global::System.EventHandler(CompositionTarget_Rendering);
|
||||
')
|
||||
public function new(title: String, width: Int, height: Int) {}
|
||||
|
||||
@:functionCode('
|
||||
Width = width + (global::System.Windows.SystemParameters.ResizeFrameVerticalBorderWidth * 2);
|
||||
Height = height + global::System.Windows.SystemParameters.WindowCaptionHeight + (global::System.Windows.SystemParameters.ResizeFrameHorizontalBorderHeight * 2);
|
||||
')
|
||||
public function resize(width: Int, height: Int): Void {}
|
||||
}
|
||||
|
||||
@:classCode('
|
||||
private static global::System.Collections.Generic.HashSet<global::System.Windows.Input.Key> pressedKeys = new global::System.Collections.Generic.HashSet<global::System.Windows.Input.Key>();
|
||||
|
||||
public static void OnTextInput(global::System.Windows.Input.TextCompositionEventArgs e) {
|
||||
if (!global::System.String.IsNullOrEmpty(e.Text)) {
|
||||
// Used for text input since KeyEventArgs does not provide a string representation
|
||||
// Printable characters only
|
||||
if (e.Text != "") {
|
||||
char[] chararray = e.Text.ToCharArray();
|
||||
int c = global::System.Convert.ToInt32((char)chararray[0]);
|
||||
if (c >= 32) {
|
||||
keyboard.sendDownEvent(Key.CHAR, e.Text);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnKeyDown(global::System.Windows.Input.KeyEventArgs e) {
|
||||
if (pressedKeys.Contains(e.Key)) return;
|
||||
pressedKeys.Add(e.Key);
|
||||
|
||||
switch (e.Key) {
|
||||
case global::System.Windows.Input.Key.Back:
|
||||
keyboard.sendDownEvent(Key.BACKSPACE, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Enter:
|
||||
keyboard.sendDownEvent(Key.ENTER, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Escape:
|
||||
keyboard.sendDownEvent(Key.ESC, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Delete:
|
||||
keyboard.sendDownEvent(Key.DEL, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Up:
|
||||
keyboard.sendDownEvent(Key.UP, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Down:
|
||||
keyboard.sendDownEvent(Key.DOWN, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Left:
|
||||
keyboard.sendDownEvent(Key.LEFT, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Right:
|
||||
keyboard.sendDownEvent(Key.RIGHT, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnKeyDown(Key key, string c) {
|
||||
//Game.the.keyDown(key, c);
|
||||
}
|
||||
|
||||
public static void OnKeyUp(global::System.Windows.Input.KeyEventArgs e) {
|
||||
pressedKeys.Remove(e.Key);
|
||||
|
||||
switch (e.Key) {
|
||||
case global::System.Windows.Input.Key.Back:
|
||||
keyboard.sendUpEvent(Key.BACKSPACE, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Enter:
|
||||
keyboard.sendUpEvent(Key.ENTER, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Escape:
|
||||
keyboard.sendUpEvent(Key.ESC, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Delete:
|
||||
keyboard.sendUpEvent(Key.DEL, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Up:
|
||||
keyboard.sendUpEvent(Key.UP, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Down:
|
||||
keyboard.sendUpEvent(Key.DOWN, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Left:
|
||||
keyboard.sendUpEvent(Key.LEFT, null);
|
||||
break;
|
||||
case global::System.Windows.Input.Key.Right:
|
||||
keyboard.sendUpEvent(Key.RIGHT, null);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnMouseDown(global::System.Windows.Input.MouseButtonEventArgs e) {
|
||||
if (e.ChangedButton == global::System.Windows.Input.MouseButton.Left) {
|
||||
kha.SystemImpl.mouseDown((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y);
|
||||
}
|
||||
else if (e.ChangedButton == global::System.Windows.Input.MouseButton.Right) {
|
||||
kha.SystemImpl.rightMouseDown((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static void OnMouseUp(global::System.Windows.Input.MouseButtonEventArgs e) {
|
||||
if (e.ChangedButton == global::System.Windows.Input.MouseButton.Left) {
|
||||
kha.SystemImpl.mouseUp((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y);
|
||||
}
|
||||
else if (e.ChangedButton == global::System.Windows.Input.MouseButton.Right) {
|
||||
kha.SystemImpl.rightMouseUp((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y);
|
||||
}
|
||||
}
|
||||
|
||||
public static void OnMouseMove(global::System.Windows.Input.MouseEventArgs e) {
|
||||
kha.SystemImpl.mouseMove((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y);
|
||||
}
|
||||
|
||||
public static void OnMouseWheel(global::System.Windows.Input.MouseWheelEventArgs e) {
|
||||
kha.SystemImpl.mouseWheel((int)e.GetPosition(frameworkElement).X, (int)e.GetPosition(frameworkElement).Y, e.Delta / 120);
|
||||
}
|
||||
')
|
||||
class SystemImpl {
|
||||
static var watch: Stopwatch;
|
||||
|
||||
public static var graphics(default, null): kha.wpf.Graphics;
|
||||
|
||||
public static var screenRotation: ScreenRotation = ScreenRotation.RotationNone;
|
||||
|
||||
public static function init2(): Void {
|
||||
graphics = new Graphics();
|
||||
watch = new Stopwatch();
|
||||
watch.Start();
|
||||
}
|
||||
|
||||
public static function getMouse(num: Int): Mouse {
|
||||
if (num != 0)
|
||||
return null;
|
||||
return mouse;
|
||||
}
|
||||
|
||||
public static function getKeyboard(num: Int): Keyboard {
|
||||
if (num != 0)
|
||||
return null;
|
||||
return keyboard;
|
||||
}
|
||||
|
||||
static var mainWindow: MainWindow;
|
||||
static var openWindow: Bool = true;
|
||||
static var autostartGame: Bool = true;
|
||||
static var showMousePos: Bool = false;
|
||||
static var painter: kha.wpf.Painter;
|
||||
static var framebuffer: Framebuffer;
|
||||
static var keyboard: Keyboard;
|
||||
static var mouse: kha.input.Mouse;
|
||||
static var title: String;
|
||||
public static var frameworkElement: StoryPublishCanvas;
|
||||
|
||||
public static function init(options: SystemOptions, callback: Window->Void) {
|
||||
title = options.title;
|
||||
keyboard = new Keyboard();
|
||||
mouse = new kha.input.Mouse();
|
||||
init2();
|
||||
Scheduler.init();
|
||||
|
||||
if (openWindow) {
|
||||
mainWindow = new MainWindow(title, options.width, options.height);
|
||||
frameworkElement = mainWindow.canvas;
|
||||
}
|
||||
else {
|
||||
frameworkElement.Width = options.width;
|
||||
frameworkElement.Height = options.height;
|
||||
}
|
||||
painter = new kha.wpf.Painter(options.width, options.height);
|
||||
framebuffer = new Framebuffer(0, null, painter, null);
|
||||
Scheduler.start();
|
||||
// if (autostartGame) gameToStart.loadFinished();
|
||||
|
||||
callback(null);
|
||||
|
||||
if (openWindow) {
|
||||
startWindow();
|
||||
}
|
||||
else if (frameworkElement != null) {
|
||||
frameworkElement.drawMousePos = SystemImpl.showMousePos;
|
||||
}
|
||||
}
|
||||
|
||||
public static function initEx(title: String, options: Array<WindowOptions>, windowCallback: Int->Void, callback: Window->Void) {
|
||||
trace('initEx is not supported on the WPF target, running init() with first window options');
|
||||
|
||||
init({title: title, width: options[0].width, height: options[0].height}, callback);
|
||||
|
||||
if (windowCallback != null) {
|
||||
windowCallback(0);
|
||||
}
|
||||
}
|
||||
|
||||
public static function configure(path: String, openWindow: Bool, autostartGame: Bool, showMousePos: Bool, forceBusyCursor: Bool) {
|
||||
SystemImpl.openWindow = openWindow;
|
||||
SystemImpl.autostartGame = autostartGame;
|
||||
SystemImpl.showMousePos = showMousePos;
|
||||
LoaderImpl.path = path;
|
||||
LoaderImpl.forceBusyCursor = forceBusyCursor;
|
||||
}
|
||||
|
||||
@:functionCode('global::System.Windows.MessageBox.Show(msg, "Exeption", global::System.Windows.MessageBoxButton.OK, global::System.Windows.MessageBoxImage.Error);')
|
||||
static function displayErrorMessage(msg: String) {}
|
||||
|
||||
public static function lockMouse(): Void {}
|
||||
|
||||
public static function unlockMouse(): Void {}
|
||||
|
||||
public static function canLockMouse(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function isMouseLocked(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function notifyOfMouseLockChange(func: Void->Void, error: Void->Void): Void {}
|
||||
|
||||
public static function removeFromMouseLockChange(func: Void->Void, error: Void->Void): Void {}
|
||||
|
||||
@:functionCode('
|
||||
if (global::System.Windows.Application.Current == null) {
|
||||
new global::System.Windows.Application().Run(mainWindow);
|
||||
}
|
||||
')
|
||||
static function startWindow(): Void {}
|
||||
|
||||
public static var mouseX: Int;
|
||||
public static var mouseY: Int;
|
||||
|
||||
public static function mouseDown(x: Int, y: Int): Void {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendDownEvent(0, 0, x, y);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
public static function mouseUp(x: Int, y: Int): Void {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendUpEvent(0, 0, x, y);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
public static function rightMouseDown(x: Int, y: Int): Void {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendDownEvent(0, 1, x, y);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
public static function rightMouseUp(x: Int, y: Int): Void {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendUpEvent(0, 1, x, y);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
public static function mouseMove(x: Int, y: Int): Void {
|
||||
var movementX = x - mouseX;
|
||||
var movementY = y - mouseY;
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendMoveEvent(0, x, y, movementX, movementY);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
public static function mouseWheel(x: Int, y: Int, delta: Int): Void {
|
||||
mouseX = x;
|
||||
mouseY = y;
|
||||
mouse.sendWheelEvent(0, delta);
|
||||
frameworkElement.setMousePos(x, y);
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
return watch.ElapsedMilliseconds / 1000.0;
|
||||
')
|
||||
public static function getTime(): Float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function getVsync(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function getRefreshRate(): Int {
|
||||
return 60;
|
||||
}
|
||||
|
||||
public static function getScreenRotation(): ScreenRotation {
|
||||
return ScreenRotation.RotationNone;
|
||||
}
|
||||
|
||||
@:functionCode('return mainWindow == null ? (int)frameworkElement.Width : (int)mainWindow.canvas.ActualWidth;')
|
||||
public static function windowWidth(windowId: Int = 0): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@:functionCode('return mainWindow == null ? (int)frameworkElement.Height : (int)mainWindow.canvas.ActualHeight;')
|
||||
public static function windowHeight(windowId: Int = 0): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static function screenDpi(): Int {
|
||||
return 96;
|
||||
}
|
||||
|
||||
public static function getSystemId(): String {
|
||||
return "WPF";
|
||||
}
|
||||
|
||||
public static function vibrate(ms: Int): Void {}
|
||||
|
||||
public static function getLanguage(): String {
|
||||
final lang = cs.system.globalization.CultureInfo.CurrentCulture.Name;
|
||||
return lang.substr(0, 2).toLowerCase();
|
||||
}
|
||||
|
||||
@:functionCode('global::System.Windows.Application.Current.Shutdown(); return true;')
|
||||
public static function requestShutdown(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function canSwitchFullscreen(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function isFullscreen(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function requestFullscreen(): Void {}
|
||||
|
||||
public static function exitFullscreen(): Void {}
|
||||
|
||||
public static function notifyOfFullscreenChange(func: Void->Void, error: Void->Void): Void {}
|
||||
|
||||
public static function removeFromFullscreenChange(func: Void->Void, error: Void->Void): Void {}
|
||||
|
||||
// @:functionCode('mainWindow.resize(width, height);')
|
||||
public static function changeResolution(width: Int, height: Int): Void {
|
||||
painter.width = width;
|
||||
painter.height = height;
|
||||
}
|
||||
|
||||
public static function setKeepScreenOn(on: Bool): Void {}
|
||||
|
||||
public static function loadUrl(url: String): Void {}
|
||||
|
||||
public static function getGamepadId(index: Int): String {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
public static function getGamepadVendor(index: Int): String {
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
public static function setGamepadRumble(index: Int, leftAmount: Float, rightAmount: Float): Void {}
|
||||
|
||||
public static function safeZone(): Float {
|
||||
return 1.0;
|
||||
}
|
||||
|
||||
public static function waitingForLogin(): Bool {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function disallowUserChange(): Void {}
|
||||
|
||||
public static function allowUserChange(): Void {}
|
||||
|
||||
public static function automaticSafeZone(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public static function setSafeZone(value: Float): Void {}
|
||||
|
||||
public static function unlockAchievement(id: Int): Void {}
|
||||
|
||||
public static function login(): Void {}
|
||||
}
|
11
Kha/Backends/WPF/kha/audio1/Audio.hx
Normal file
11
Kha/Backends/WPF/kha/audio1/Audio.hx
Normal file
@ -0,0 +1,11 @@
|
||||
package kha.audio1;
|
||||
|
||||
class Audio {
|
||||
public static function play(sound: Sound, loop: Bool = false, stream: Bool = false): kha.audio1.AudioChannel {
|
||||
return new WpfAudioChannel(cast(sound, kha.wpf.Sound).filename);
|
||||
}
|
||||
|
||||
public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel {
|
||||
return new WpfAudioChannel(cast(sound, kha.wpf.Sound).filename);
|
||||
}
|
||||
}
|
80
Kha/Backends/WPF/kha/audio1/WpfAudioChannel.hx
Normal file
80
Kha/Backends/WPF/kha/audio1/WpfAudioChannel.hx
Normal file
@ -0,0 +1,80 @@
|
||||
package kha.audio1;
|
||||
|
||||
import system.io.Path;
|
||||
import system.Uri;
|
||||
import system.UriKind;
|
||||
import system.windows.controls.MediaElement;
|
||||
import system.windows.controls.MediaState;
|
||||
|
||||
class WpfAudioChannel implements kha.audio1.AudioChannel {
|
||||
var player: MediaElement;
|
||||
var hasFinished: Bool = false;
|
||||
|
||||
public function new(filename: String) {
|
||||
this.player = new MediaElement();
|
||||
addEventHandlers();
|
||||
player.LoadedBehavior = MediaState.Manual;
|
||||
player.UnloadedBehavior = MediaState.Manual;
|
||||
// MediaElement needs Absolute URI. Relative won't work
|
||||
player.Source = new Uri(Path.GetFullPath(filename), UriKind.Absolute);
|
||||
// TODO: perhaps files should be checked for validity?
|
||||
|
||||
play();
|
||||
}
|
||||
|
||||
public function play(): Void {
|
||||
hasFinished = false;
|
||||
player.Play();
|
||||
}
|
||||
|
||||
public function pause(): Void {
|
||||
player.Pause();
|
||||
}
|
||||
|
||||
public function stop(): Void {
|
||||
hasFinished = true;
|
||||
player.Stop();
|
||||
}
|
||||
|
||||
public var length(get, never): Float;
|
||||
|
||||
@:functionCode('
|
||||
if (player.NaturalDuration.HasTimeSpan) return player.NaturalDuration.TimeSpan.TotalMilliseconds * 1000.0;
|
||||
else return float.MaxValue;
|
||||
')
|
||||
function get_length(): Float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public var position(get, never): Float; // Seconds
|
||||
|
||||
@:functionCode('return Math.round(player.Position.TotalMilliseconds) * 1000.0;')
|
||||
function get_position(): Float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public var volume(get, set): Float;
|
||||
|
||||
function get_volume(): Float {
|
||||
return player.Volume;
|
||||
}
|
||||
|
||||
function set_volume(value: Float): Float {
|
||||
return player.Volume = value;
|
||||
}
|
||||
|
||||
public var finished(get, never): Bool;
|
||||
|
||||
function get_finished(): Bool {
|
||||
return hasFinished;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
player.MediaEnded += OnMediaEnded;
|
||||
')
|
||||
function addEventHandlers() {}
|
||||
|
||||
function OnMediaEnded(obj: Dynamic, e: RoutedEventArgs) {
|
||||
hasFinished = true;
|
||||
}
|
||||
}
|
21
Kha/Backends/WPF/kha/audio1/WpfMusicChannel.hx
Normal file
21
Kha/Backends/WPF/kha/audio1/WpfMusicChannel.hx
Normal file
@ -0,0 +1,21 @@
|
||||
package kha.audio1;
|
||||
|
||||
import system.windows.controls.MediaElement;
|
||||
|
||||
class WpfMusicChannel extends WpfSoundChannel implements kha.audio1.MusicChannel {
|
||||
var looping: Bool = false;
|
||||
|
||||
public function new(filename: String, looping: Bool) {
|
||||
super(filename);
|
||||
this.looping = looping;
|
||||
}
|
||||
|
||||
override function OnMediaEnded(obj: Dynamic, e: RoutedEventArgs): Void {
|
||||
if (looping) {
|
||||
play();
|
||||
}
|
||||
else {
|
||||
hasFinished = true;
|
||||
}
|
||||
}
|
||||
}
|
47
Kha/Backends/WPF/kha/graphics4/CubeMap.hx
Normal file
47
Kha/Backends/WPF/kha/graphics4/CubeMap.hx
Normal file
@ -0,0 +1,47 @@
|
||||
package kha.graphics4;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
|
||||
class CubeMap implements Canvas implements Resource {
|
||||
public static function createRenderTarget(size: Int, format: TextureFormat = null, depthStencil: DepthStencilFormat = null): CubeMap {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function unload(): Void {}
|
||||
|
||||
public function lock(level: Int = 0): Bytes {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function unlock(): Void {}
|
||||
|
||||
public var width(get, never): Int;
|
||||
|
||||
function get_width(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public var height(get, never): Int;
|
||||
|
||||
function get_height(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public var g1(get, never): kha.graphics1.Graphics;
|
||||
|
||||
function get_g1(): kha.graphics1.Graphics {
|
||||
return null;
|
||||
}
|
||||
|
||||
public var g2(get, never): kha.graphics2.Graphics;
|
||||
|
||||
function get_g2(): kha.graphics2.Graphics {
|
||||
return null;
|
||||
}
|
||||
|
||||
public var g4(get, never): kha.graphics4.Graphics;
|
||||
|
||||
function get_g4(): kha.graphics4.Graphics {
|
||||
return null;
|
||||
}
|
||||
}
|
7
Kha/Backends/WPF/kha/graphics4/FragmentShader.hx
Normal file
7
Kha/Backends/WPF/kha/graphics4/FragmentShader.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package kha.graphics4;
|
||||
|
||||
import kha.Blob;
|
||||
|
||||
class FragmentShader {
|
||||
public function new(source: Blob) {}
|
||||
}
|
17
Kha/Backends/WPF/kha/graphics4/IndexBuffer.hx
Normal file
17
Kha/Backends/WPF/kha/graphics4/IndexBuffer.hx
Normal file
@ -0,0 +1,17 @@
|
||||
package kha.graphics4;
|
||||
|
||||
class IndexBuffer {
|
||||
public function new(indexCount: Int, usage: Usage, canRead: Bool = false) {}
|
||||
|
||||
public function lock(?start: Int, ?count: Int): Array<Int> {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function unlock(?count: Int): Void {}
|
||||
|
||||
public function set(): Void {}
|
||||
|
||||
public function count(): Int {
|
||||
return 0;
|
||||
}
|
||||
}
|
17
Kha/Backends/WPF/kha/graphics4/PipelineState.hx
Normal file
17
Kha/Backends/WPF/kha/graphics4/PipelineState.hx
Normal file
@ -0,0 +1,17 @@
|
||||
package kha.graphics4;
|
||||
|
||||
class PipelineState extends PipelineStateBase {
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
|
||||
public function compile(): Void {}
|
||||
|
||||
public function getConstantLocation(name: String): ConstantLocation {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function getTextureUnit(name: String): TextureUnit {
|
||||
return null;
|
||||
}
|
||||
}
|
21
Kha/Backends/WPF/kha/graphics4/VertexBuffer.hx
Normal file
21
Kha/Backends/WPF/kha/graphics4/VertexBuffer.hx
Normal file
@ -0,0 +1,21 @@
|
||||
package kha.graphics4;
|
||||
|
||||
import haxe.io.Float32Array;
|
||||
|
||||
class VertexBuffer {
|
||||
public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, canRead: Bool = false) {}
|
||||
|
||||
public function lock(?start: Int, ?count: Int): Float32Array {
|
||||
return null;
|
||||
}
|
||||
|
||||
public function unlock(?count: Int): Void {}
|
||||
|
||||
public function count(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function stride(): Int {
|
||||
return 1;
|
||||
}
|
||||
}
|
7
Kha/Backends/WPF/kha/graphics4/VertexShader.hx
Normal file
7
Kha/Backends/WPF/kha/graphics4/VertexShader.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package kha.graphics4;
|
||||
|
||||
import kha.Blob;
|
||||
|
||||
class VertexShader {
|
||||
public function new(source: Blob) {}
|
||||
}
|
10
Kha/Backends/WPF/kha/network/Http.hx
Normal file
10
Kha/Backends/WPF/kha/network/Http.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package kha.network;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
|
||||
class Http {
|
||||
public static function request(url: String, path: String, data: String, port: Int, secure: Bool, method: HttpMethod, contentType: String,
|
||||
callback: Int->Int->String->Void /*error, response, body*/): Void {
|
||||
callback(418, 418, null);
|
||||
}
|
||||
}
|
11
Kha/Backends/WPF/kha/network/Network.hx
Normal file
11
Kha/Backends/WPF/kha/network/Network.hx
Normal file
@ -0,0 +1,11 @@
|
||||
package kha.network;
|
||||
|
||||
import haxe.io.Bytes;
|
||||
|
||||
class Network {
|
||||
public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) {}
|
||||
|
||||
public function send(bytes: Bytes, mandatory: Bool): Void {}
|
||||
|
||||
public function listen(listener: Bytes->Void): Void {}
|
||||
}
|
73
Kha/Backends/WPF/kha/wpf/Font.hx
Normal file
73
Kha/Backends/WPF/kha/wpf/Font.hx
Normal file
@ -0,0 +1,73 @@
|
||||
package kha.wpf;
|
||||
|
||||
import kha.FontStyle;
|
||||
|
||||
@:classCode('
|
||||
private System.Windows.Media.FormattedText getFormat(string text = "ABC") {
|
||||
System.Windows.Media.FormattedText fText = new System.Windows.Media.FormattedText(text,
|
||||
System.Globalization.CultureInfo.GetCultureInfo("en-us"), System.Windows.FlowDirection.LeftToRight,
|
||||
new System.Windows.Media.Typeface(get_name()), get_size(), System.Windows.Media.Brushes.Black);
|
||||
if (get_style().getBold()) fText.SetFontWeight(System.Windows.FontWeights.Bold);
|
||||
if (get_style().getItalic()) fText.SetFontStyle(System.Windows.FontStyles.Italic);
|
||||
if (get_style().getUnderlined()) fText.SetTextDecorations(System.Windows.TextDecorations.Underline);
|
||||
return fText;
|
||||
}
|
||||
')
|
||||
class Font implements Resource {
|
||||
public var myName: String;
|
||||
public var myStyle: FontStyle;
|
||||
public var mySize: Float;
|
||||
|
||||
public function new(name: String, style: FontStyle, size: Float) {
|
||||
myName = name;
|
||||
myStyle = style;
|
||||
mySize = size;
|
||||
}
|
||||
|
||||
public var name(get, never): String;
|
||||
|
||||
function get_name(): String {
|
||||
return myName;
|
||||
}
|
||||
|
||||
public var style(get, never): FontStyle;
|
||||
|
||||
function get_style(): FontStyle {
|
||||
return myStyle;
|
||||
}
|
||||
|
||||
public var size(get, never): Float;
|
||||
|
||||
function get_size(): Float {
|
||||
return mySize;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
return getFormat().Height;
|
||||
')
|
||||
public function getHeight(): Float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public function charWidth(ch: String): Float {
|
||||
return stringWidth(ch);
|
||||
}
|
||||
|
||||
public function charsWidth(ch: String, offset: Int, length: Int): Float {
|
||||
return stringWidth(ch.substr(offset, length));
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
return getFormat(str).WidthIncludingTrailingWhitespace;
|
||||
')
|
||||
public function stringWidth(str: String): Float {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
return getFormat().Baseline;
|
||||
')
|
||||
public function getBaselinePosition(): Float {
|
||||
return 0;
|
||||
}
|
||||
}
|
21
Kha/Backends/WPF/kha/wpf/Graphics.hx
Normal file
21
Kha/Backends/WPF/kha/wpf/Graphics.hx
Normal file
@ -0,0 +1,21 @@
|
||||
package kha.wpf;
|
||||
|
||||
class Graphics {
|
||||
public function new() {}
|
||||
|
||||
// public function createTexture(width: Int, height: Int, format: TextureFormat, usage: Usage): Image {
|
||||
// return new Image(width, height, format);
|
||||
// }
|
||||
|
||||
public function maxTextureSize(): Int {
|
||||
return 4096;
|
||||
}
|
||||
|
||||
public function vsynced(): Bool {
|
||||
return true;
|
||||
}
|
||||
|
||||
public function refreshRate(): Int {
|
||||
return 60;
|
||||
}
|
||||
}
|
7
Kha/Backends/WPF/kha/wpf/Mouse.hx
Normal file
7
Kha/Backends/WPF/kha/wpf/Mouse.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package kha.wpf;
|
||||
|
||||
class Mouse extends kha.Mouse {
|
||||
public function new() {
|
||||
super();
|
||||
}
|
||||
}
|
17
Kha/Backends/WPF/kha/wpf/Music.hx
Normal file
17
Kha/Backends/WPF/kha/wpf/Music.hx
Normal file
@ -0,0 +1,17 @@
|
||||
package kha.wpf;
|
||||
|
||||
import kha.audio1.MusicChannel;
|
||||
import system.io.Path;
|
||||
import system.Uri;
|
||||
import system.UriKind;
|
||||
import system.windows.controls.MediaElement;
|
||||
import system.windows.controls.MediaState;
|
||||
|
||||
class Music extends kha.Music {
|
||||
public var filename: String;
|
||||
|
||||
public function new(filename: String): Void {
|
||||
super();
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
181
Kha/Backends/WPF/kha/wpf/Painter.hx
Normal file
181
Kha/Backends/WPF/kha/wpf/Painter.hx
Normal file
@ -0,0 +1,181 @@
|
||||
package kha.wpf;
|
||||
|
||||
import kha.FontStyle;
|
||||
import kha.Image;
|
||||
import kha.Kravur;
|
||||
import kha.math.FastMatrix3;
|
||||
import kha.math.Matrix3;
|
||||
import kha.Rotation;
|
||||
import system.windows.media.Color;
|
||||
import system.windows.media.DrawingContext;
|
||||
import system.windows.media.DrawingVisual;
|
||||
import system.windows.media.imaging.BitmapSource;
|
||||
import system.windows.media.ImageBrush;
|
||||
import system.windows.media.MatrixTransform;
|
||||
|
||||
class Painter extends kha.graphics2.Graphics {
|
||||
public var context: DrawingContext;
|
||||
public var visual: DrawingVisual;
|
||||
public var image: BitmapSource;
|
||||
|
||||
var myColor: Color;
|
||||
var myKhaColor: kha.Color;
|
||||
var myFont: Kravur;
|
||||
var tx: Float;
|
||||
var ty: Float;
|
||||
|
||||
public var width: Int;
|
||||
public var height: Int;
|
||||
|
||||
static var garbageCounter: Int = 0;
|
||||
|
||||
public function new(width: Int, height: Int) {
|
||||
super();
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
tx = 0;
|
||||
ty = 0;
|
||||
// font = new Font("Arial", new FontStyle(false, false, false), 20);
|
||||
}
|
||||
|
||||
override public function begin(clear: Bool = true, clearColor: kha.Color = null): Void {
|
||||
if (visual != null)
|
||||
context = visual.RenderOpen();
|
||||
context.PushTransform(new MatrixTransform(transformation._00, transformation._01, transformation._10, transformation._11, transformation._20,
|
||||
transformation._21));
|
||||
if (clear)
|
||||
this.clear(clearColor);
|
||||
}
|
||||
|
||||
override public function clear(color: kha.Color = null): Void {
|
||||
var prevColor = myKhaColor;
|
||||
this.color = color == null ? Color.Black : color;
|
||||
fillRect(0, 0, width, height);
|
||||
this.color = prevColor;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
if (visual != null) {
|
||||
context.Close();
|
||||
((global::System.Windows.Media.Imaging.RenderTargetBitmap) image).Render(visual);
|
||||
++garbageCounter;
|
||||
if (garbageCounter > 30) {
|
||||
global::System.GC.Collect(); // Because rendering into an image is a really really bad thing in WPF
|
||||
}
|
||||
}
|
||||
')
|
||||
override public function end(): Void {}
|
||||
|
||||
override public function setTransformation(transformation: FastMatrix3): Void {
|
||||
context.Pop();
|
||||
context.PushTransform(new MatrixTransform(transformation._00, transformation._01, transformation._10, transformation._11, transformation._20,
|
||||
transformation._21));
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
var img = (Image)image;
|
||||
context.DrawImage(img.image, new global::System.Windows.Rect(tx + x, ty + y, img.get_width(), img.get_height()));
|
||||
')
|
||||
override public function drawImage(image: Image, x: Float, y: Float): Void {}
|
||||
|
||||
@:functionCode('
|
||||
var img = (Image)image;
|
||||
//var cropped = new System.Windows.Media.Imaging.CroppedBitmap(img.image, new System.Windows.Int32Rect((int)sx, (int)sy, (int)sw, (int)sh));
|
||||
//context.DrawImage(cropped, new System.Windows.Rect(tx + dx, ty + dy, dw, dh)); //super slow
|
||||
img.brush.Viewbox = new global::System.Windows.Rect(sx / img.get_width(), sy / img.get_height(), sw / img.get_width(), sh / img.get_height());
|
||||
context.DrawRectangle(img.brush, null, new global::System.Windows.Rect(tx + dx, ty + dy, dw, dh));
|
||||
')
|
||||
override public function drawScaledSubImage(image: kha.Image, sx: Float, sy: Float, sw: Float, sh: Float, dx: Float, dy: Float, dw: Float,
|
||||
dh: Float): Void {}
|
||||
|
||||
/*@:functionCode('
|
||||
if (text != null) {
|
||||
text.Replace(\' \', (char)160); // Non-breaking space
|
||||
System.Windows.Media.FormattedText fText = new System.Windows.Media.FormattedText(text,
|
||||
System.Globalization.CultureInfo.GetCultureInfo("en-us"), System.Windows.FlowDirection.LeftToRight,
|
||||
new System.Windows.Media.Typeface(font.get_name()), font.get_size(), new System.Windows.Media.SolidColorBrush(color));
|
||||
if (font.get_style().getBold()) fText.SetFontWeight(System.Windows.FontWeights.Bold);
|
||||
if (font.get_style().getItalic()) fText.SetFontStyle(System.Windows.FontStyles.Italic);
|
||||
if (font.get_style().getUnderlined()) fText.SetTextDecorations(System.Windows.TextDecorations.Underline);
|
||||
context.DrawText(fText, new System.Windows.Point(tx + x, ty + y));
|
||||
}
|
||||
')
|
||||
override public function drawString(text : String, x : Float, y : Float) : Void {
|
||||
|
||||
}*/
|
||||
@:functionCode('
|
||||
var img = (Image)myFont._get(myFontSize, null).getTexture();
|
||||
var xpos = tx + x;
|
||||
var ypos = ty + y;
|
||||
for (int i = 0; i < text.Length; ++i) {
|
||||
var q = myFont._get(myFontSize, null).getBakedQuad(text[i] - 32, xpos, ypos);
|
||||
if (q != null) {
|
||||
var brush = new global::System.Windows.Media.ImageBrush(img.image);
|
||||
brush.Viewbox = new global::System.Windows.Rect(q.s0, q.t0, q.s1 - q.s0, q.t1 - q.t0);
|
||||
context.PushOpacityMask(brush);
|
||||
context.DrawRectangle(new global::System.Windows.Media.SolidColorBrush(myColor), null, new global::System.Windows.Rect(q.x0, q.y0, q.x1 - q.x0, q.y1 - q.y0));
|
||||
context.Pop();
|
||||
xpos += q.xadvance;
|
||||
}
|
||||
}
|
||||
')
|
||||
override public function drawString(text: String, x: Float, y: Float): Void {}
|
||||
|
||||
override function get_color(): kha.Color {
|
||||
return myKhaColor;
|
||||
}
|
||||
|
||||
override function set_color(color: kha.Color): kha.Color {
|
||||
setColorInternal(color.Ab, color.Rb, color.Gb, color.Bb);
|
||||
return myKhaColor = color;
|
||||
}
|
||||
|
||||
override function get_font(): kha.Font {
|
||||
return myFont;
|
||||
}
|
||||
|
||||
override function set_font(font: kha.Font): kha.Font {
|
||||
return this.myFont = cast(font, Kravur);
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
myColor = global::System.Windows.Media.Color.FromArgb((byte)a, (byte)r, (byte)g, (byte)b);
|
||||
')
|
||||
function setColorInternal(a: Int, r: Int, g: Int, b: Int): Void {}
|
||||
|
||||
@:functionCode('
|
||||
if (width < 0.0) {
|
||||
x += width;
|
||||
width = -width;
|
||||
}
|
||||
if (height < 0.0) {
|
||||
y += height;
|
||||
height = -height;
|
||||
}
|
||||
context.DrawRectangle(null, new global::System.Windows.Media.Pen(new global::System.Windows.Media.SolidColorBrush(myColor), strength.value), new global::System.Windows.Rect(tx + x, ty + y, width, height));
|
||||
')
|
||||
override public function drawRect(x: Float, y: Float, width: Float, height: Float, strength: Float = 1.0): Void {}
|
||||
|
||||
@:functionCode('
|
||||
if (width < 0.0) {
|
||||
x += width;
|
||||
width = -width;
|
||||
}
|
||||
if (height < 0.0) {
|
||||
y += height;
|
||||
height = -height;
|
||||
}
|
||||
context.DrawRectangle(new global::System.Windows.Media.SolidColorBrush(myColor), new global::System.Windows.Media.Pen(), new global::System.Windows.Rect(tx + x, ty + y, width, height));
|
||||
')
|
||||
override public function fillRect(x: Float, y: Float, width: Float, height: Float): Void {}
|
||||
|
||||
@:functionCode('
|
||||
context.DrawLine(new global::System.Windows.Media.Pen(new global::System.Windows.Media.SolidColorBrush(myColor), 1), new global::System.Windows.Point(tx + x1, ty + y1), new global::System.Windows.Point(tx + x2, ty + y2));
|
||||
')
|
||||
override function drawLine(x1: Float, y1: Float, x2: Float, y2: Float, strength: Float = 1.0): Void {}
|
||||
|
||||
@:functionCode('
|
||||
context.DrawVideo(((Video)video).getPlayer(), new global::System.Windows.Rect(tx + x, ty + y, width, height));
|
||||
')
|
||||
override function drawVideo(video: kha.Video, x: Float, y: Float, width: Float, height: Float): Void {}
|
||||
}
|
19
Kha/Backends/WPF/kha/wpf/Sound.hx
Normal file
19
Kha/Backends/WPF/kha/wpf/Sound.hx
Normal file
@ -0,0 +1,19 @@
|
||||
package kha.wpf;
|
||||
|
||||
import kha.audio1.AudioChannel;
|
||||
import system.io.Path;
|
||||
import system.Uri;
|
||||
import system.UriKind;
|
||||
import system.windows.controls.MediaElement;
|
||||
import system.windows.controls.MediaState;
|
||||
|
||||
class Sound extends kha.Sound {
|
||||
public var filename: String;
|
||||
|
||||
var channel: AudioChannel;
|
||||
|
||||
public function new(filename: String): Void {
|
||||
super();
|
||||
this.filename = filename;
|
||||
}
|
||||
}
|
60
Kha/Backends/WPF/kha/wpf/Video.hx
Normal file
60
Kha/Backends/WPF/kha/wpf/Video.hx
Normal file
@ -0,0 +1,60 @@
|
||||
package kha.wpf;
|
||||
|
||||
import system.io.Path;
|
||||
import system.Uri;
|
||||
import system.UriKind;
|
||||
import system.windows.media.MediaPlayer;
|
||||
|
||||
class Video extends kha.Video {
|
||||
var player: MediaPlayer;
|
||||
|
||||
public function new(filename: String): Void {
|
||||
super();
|
||||
player = new MediaPlayer();
|
||||
player.Open(new Uri(Path.GetFullPath(filename), UriKind.Absolute));
|
||||
}
|
||||
|
||||
public function getPlayer(): MediaPlayer {
|
||||
return player;
|
||||
}
|
||||
|
||||
public override function play(loop: Bool = false): Void {
|
||||
player.Play();
|
||||
}
|
||||
|
||||
public override function pause(): Void {
|
||||
player.Pause();
|
||||
}
|
||||
|
||||
public override function stop(): Void {
|
||||
player.Stop();
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
if (player.NaturalDuration.HasTimeSpan)
|
||||
return Math.round(player.NaturalDuration.TimeSpan.TotalMilliseconds);
|
||||
else return int.MaxValue;
|
||||
')
|
||||
public override function getLength(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@:functionCode('
|
||||
return Math.round(player.Position.TotalMilliseconds);
|
||||
')
|
||||
public override function getCurrentPos(): Int {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public override function getVolume(): Float {
|
||||
return player.Volume;
|
||||
}
|
||||
|
||||
public override function setVolume(volume: Float): Void {
|
||||
player.Volume = volume;
|
||||
}
|
||||
|
||||
public override function unload(): Void {
|
||||
player = null;
|
||||
}
|
||||
}
|
6
Kha/Backends/WPF/system/Uri.hx
Normal file
6
Kha/Backends/WPF/system/Uri.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system;
|
||||
|
||||
@:native("System.Uri")
|
||||
extern class Uri {
|
||||
function new(filename: String, kind: UriKind): Void;
|
||||
}
|
8
Kha/Backends/WPF/system/UriKind.hx
Normal file
8
Kha/Backends/WPF/system/UriKind.hx
Normal file
@ -0,0 +1,8 @@
|
||||
package system;
|
||||
|
||||
@:native("System.UriKind")
|
||||
extern enum UriKind {
|
||||
RelativeOrAbsolute;
|
||||
Absolute;
|
||||
Relative;
|
||||
}
|
10
Kha/Backends/WPF/system/diagnostics/Stopwatch.hx
Normal file
10
Kha/Backends/WPF/system/diagnostics/Stopwatch.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package system.diagnostics;
|
||||
|
||||
import haxe.Int64;
|
||||
|
||||
@:native("System.Diagnostics.Stopwatch")
|
||||
extern class Stopwatch {
|
||||
public function new(): Void;
|
||||
public function Start(): Void;
|
||||
public var ElapsedMilliseconds: Int64;
|
||||
}
|
6
Kha/Backends/WPF/system/io/Directory.hx
Normal file
6
Kha/Backends/WPF/system/io/Directory.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.io;
|
||||
|
||||
@:native("System.IO.Directory")
|
||||
extern class Directory {
|
||||
public static function CreateDirectory(path: String): DirectoryInfo;
|
||||
}
|
4
Kha/Backends/WPF/system/io/DirectoryInfo.hx
Normal file
4
Kha/Backends/WPF/system/io/DirectoryInfo.hx
Normal file
@ -0,0 +1,4 @@
|
||||
package system.io;
|
||||
|
||||
@:native("System.IO.DirectoryInfo")
|
||||
extern class DirectoryInfo {}
|
13
Kha/Backends/WPF/system/io/File.hx
Normal file
13
Kha/Backends/WPF/system/io/File.hx
Normal file
@ -0,0 +1,13 @@
|
||||
package system.io;
|
||||
|
||||
import haxe.io.BytesData;
|
||||
|
||||
@:native("System.IO.File")
|
||||
extern class File {
|
||||
public static function AppendAllText(path: String, contents: String): Void;
|
||||
public static function ReadAllText(filename: String): String;
|
||||
public static function WriteAllText(path: String, contents: String): Void;
|
||||
public static function ReadAllBytes(path: String): BytesData;
|
||||
public static function WriteAllBytes(path: String, bytes: BytesData): Void;
|
||||
public static function Exists(path: String): Bool;
|
||||
}
|
6
Kha/Backends/WPF/system/io/Path.hx
Normal file
6
Kha/Backends/WPF/system/io/Path.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.io;
|
||||
|
||||
@:native("System.IO.Path")
|
||||
extern class Path {
|
||||
public static function GetFullPath(path: String): String;
|
||||
}
|
10
Kha/Backends/WPF/system/windows/FrameworkElement.hx
Normal file
10
Kha/Backends/WPF/system/windows/FrameworkElement.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package system.windows;
|
||||
|
||||
import system.windows.input.Cursor;
|
||||
|
||||
@:native("System.Windows.FrameworkElement")
|
||||
extern class FrameworkElement {
|
||||
public var Cursor: Cursor;
|
||||
public var Width: Float;
|
||||
public var Height: Float;
|
||||
}
|
6
Kha/Backends/WPF/system/windows/Window.hx
Normal file
6
Kha/Backends/WPF/system/windows/Window.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.windows;
|
||||
|
||||
@:native("System.Windows.Window")
|
||||
extern class Window extends FrameworkElement {
|
||||
public function AddChild(child: FrameworkElement): Void;
|
||||
}
|
8
Kha/Backends/WPF/system/windows/controls/Canvas.hx
Normal file
8
Kha/Backends/WPF/system/windows/controls/Canvas.hx
Normal file
@ -0,0 +1,8 @@
|
||||
package system.windows.controls;
|
||||
|
||||
import system.windows.FrameworkElement;
|
||||
|
||||
@:native("System.Windows.Controls.Canvas")
|
||||
extern class Canvas extends FrameworkElement {
|
||||
public function new(): Void;
|
||||
}
|
24
Kha/Backends/WPF/system/windows/controls/MediaElement.hx
Normal file
24
Kha/Backends/WPF/system/windows/controls/MediaElement.hx
Normal file
@ -0,0 +1,24 @@
|
||||
package system.windows.controls;
|
||||
|
||||
import system.Uri;
|
||||
|
||||
@:native("System.Windows.Controls.MediaElement")
|
||||
extern class MediaElement {
|
||||
public var Volume: Float;
|
||||
public var Source: Uri;
|
||||
public var LoadedBehavior: MediaState;
|
||||
public var UnloadedBehavior: MediaState;
|
||||
|
||||
public var MediaOpened: Dynamic;
|
||||
|
||||
public function new(): Void {}
|
||||
|
||||
public function Play(): Void {}
|
||||
|
||||
public function Pause(): Void {}
|
||||
|
||||
public function Stop(): Void {}
|
||||
}
|
||||
|
||||
@:native("System.Windows.RoutedEventArgs")
|
||||
extern class RoutedEventArgs {}
|
10
Kha/Backends/WPF/system/windows/controls/MediaState.hx
Normal file
10
Kha/Backends/WPF/system/windows/controls/MediaState.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package system.windows.controls;
|
||||
|
||||
@:native("System.Windows.Controls.MediaState")
|
||||
extern enum MediaState {
|
||||
Manual;
|
||||
Play;
|
||||
Close;
|
||||
Pause;
|
||||
Stop;
|
||||
}
|
4
Kha/Backends/WPF/system/windows/input/Cursor.hx
Normal file
4
Kha/Backends/WPF/system/windows/input/Cursor.hx
Normal file
@ -0,0 +1,4 @@
|
||||
package system.windows.input;
|
||||
|
||||
@:native("System.Windows.Input.Cursor")
|
||||
extern class Cursor {}
|
8
Kha/Backends/WPF/system/windows/input/Cursors.hx
Normal file
8
Kha/Backends/WPF/system/windows/input/Cursors.hx
Normal file
@ -0,0 +1,8 @@
|
||||
package system.windows.input;
|
||||
|
||||
@:native("System.Windows.Input.Cursors")
|
||||
extern class Cursors {
|
||||
public static var Arrow: Cursor;
|
||||
public static var Hand: Cursor;
|
||||
public static var Wait: Cursor;
|
||||
}
|
6
Kha/Backends/WPF/system/windows/input/Mouse.hx
Normal file
6
Kha/Backends/WPF/system/windows/input/Mouse.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.windows.input;
|
||||
|
||||
@:native("System.Windows.Input.Mouse")
|
||||
extern class Mouse {
|
||||
public static var OverrideCursor: Cursor;
|
||||
}
|
4
Kha/Backends/WPF/system/windows/media/Color.hx
Normal file
4
Kha/Backends/WPF/system/windows/media/Color.hx
Normal file
@ -0,0 +1,4 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.Color")
|
||||
extern class Color {}
|
7
Kha/Backends/WPF/system/windows/media/DrawingContext.hx
Normal file
7
Kha/Backends/WPF/system/windows/media/DrawingContext.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.DrawingContext")
|
||||
extern class DrawingContext {
|
||||
public function PushTransform(transform: MatrixTransform): Void;
|
||||
public function Pop(): Void;
|
||||
}
|
7
Kha/Backends/WPF/system/windows/media/DrawingVisual.hx
Normal file
7
Kha/Backends/WPF/system/windows/media/DrawingVisual.hx
Normal file
@ -0,0 +1,7 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.DrawingVisual")
|
||||
extern class DrawingVisual {
|
||||
public function new();
|
||||
public function RenderOpen(): DrawingContext;
|
||||
}
|
10
Kha/Backends/WPF/system/windows/media/ImageBrush.hx
Normal file
10
Kha/Backends/WPF/system/windows/media/ImageBrush.hx
Normal file
@ -0,0 +1,10 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.ImageBrush")
|
||||
extern class ImageBrush {
|
||||
// public function new();
|
||||
public function new(source: ImageSource);
|
||||
public var ImageSource(get, set): ImageSource;
|
||||
function get_ImageSource(): ImageSource;
|
||||
function set_ImageSource(source: ImageSource): ImageSource;
|
||||
}
|
6
Kha/Backends/WPF/system/windows/media/ImageSource.hx
Normal file
6
Kha/Backends/WPF/system/windows/media/ImageSource.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.ImageSource")
|
||||
extern class ImageSource {
|
||||
public function new() {}
|
||||
}
|
6
Kha/Backends/WPF/system/windows/media/MatrixTransform.hx
Normal file
6
Kha/Backends/WPF/system/windows/media/MatrixTransform.hx
Normal file
@ -0,0 +1,6 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.MatrixTransform")
|
||||
extern class MatrixTransform {
|
||||
public function new(m11: Float, m12: Float, m21: Float, m22: Float, offsetX: Float, offsetY: Float);
|
||||
}
|
16
Kha/Backends/WPF/system/windows/media/MediaPlayer.hx
Normal file
16
Kha/Backends/WPF/system/windows/media/MediaPlayer.hx
Normal file
@ -0,0 +1,16 @@
|
||||
package system.windows.media;
|
||||
|
||||
@:native("System.Windows.Media.MediaPlayer")
|
||||
extern class MediaPlayer {
|
||||
public var Volume: Float;
|
||||
|
||||
public function new(): Void;
|
||||
|
||||
public function Open(uri: Uri): Void;
|
||||
|
||||
public function Play(): Void;
|
||||
|
||||
public function Pause(): Void;
|
||||
|
||||
public function Stop(): Void;
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
package system.windows.media.imaging;
|
||||
|
||||
@:native("System.Windows.Media.Imaging.BitmapSource")
|
||||
extern class BitmapSource {}
|
Reference in New Issue
Block a user