Skip to content

Commit

Permalink
Fix Haxe 4.3 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RblSb committed Jul 30, 2023
1 parent fc26fd0 commit 3e22af9
Show file tree
Hide file tree
Showing 30 changed files with 176 additions and 177 deletions.
18 changes: 9 additions & 9 deletions Backends/HTML5/kha/SystemImpl.hx
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
package kha;

import js.Syntax;
import js.html.webgl.GL;
import js.html.WheelEvent;
import js.Browser;
import js.html.WebSocket;
import js.Syntax;
import js.html.CanvasElement;
import js.html.ClipboardEvent;
import js.html.DeviceMotionEvent;
import js.html.DeviceOrientationEvent;
import js.html.KeyboardEvent;
import js.html.MouseEvent;
import js.html.Touch;
import js.html.TouchEvent;
import js.html.ClipboardEvent;
import js.html.DeviceMotionEvent;
import js.html.DeviceOrientationEvent;
import js.html.WebSocket;
import js.html.WheelEvent;
import js.html.webgl.GL;
import kha.System;
import kha.graphics4.TextureFormat;
import kha.input.Gamepad;
import kha.input.Keyboard;
import kha.input.KeyCode;
import kha.input.Keyboard;
import kha.input.Mouse;
import kha.input.Sensor;
import kha.input.Surface;
import kha.js.AudioElementAudio;
import kha.js.CanvasGraphics;
import kha.js.MobileWebAudio;
import kha.js.vr.VrInterface;
import kha.System;

using StringTools;

Expand Down
3 changes: 1 addition & 2 deletions Sources/kha/WindowMode.hx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package kha;

@:enum
abstract WindowMode(Int) {
enum abstract WindowMode(Int) {
var Windowed = 0; // Use an ordinary window
var Fullscreen = 1; // Regular fullscreen mode
var ExclusiveFullscreen = 2; // Exclusive fullscreen mode (switches monitor resolution, Windows only)
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/WindowOptions.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha;

@:enum abstract WindowFeatures(Int) to Int {
enum abstract WindowFeatures(Int) to Int {
var None = 0;
var FeatureResizable = 1;
var FeatureMinimizable = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/BlendingFactor.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract BlendingFactor(Int) to Int {
enum abstract BlendingFactor(Int) to Int {
var Undefined = 0;
var BlendOne = 1;
var BlendZero = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/BlendingOperation.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract BlendingOperation(Int) to Int {
enum abstract BlendingOperation(Int) to Int {
var Add = 0;
var Subtract = 1;
var ReverseSubtract = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/CompareMode.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract CompareMode(Int) to Int {
enum abstract CompareMode(Int) to Int {
var Always = 0;
var Never = 1;
var Equal = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/CullMode.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract CullMode(Int) to Int {
enum abstract CullMode(Int) to Int {
var Clockwise = 0;
var CounterClockwise = 1;
var None = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/DepthStencilFormat.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract DepthStencilFormat(Int) to Int {
enum abstract DepthStencilFormat(Int) to Int {
var NoDepthAndStencil = 0;
var DepthOnly = 1;
var DepthAutoStencilAuto = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/MipMapFilter.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract MipMapFilter(Int) to Int {
enum abstract MipMapFilter(Int) to Int {
var NoMipFilter = 0;
var PointMipFilter = 1;
var LinearMipFilter = 2; // linear texture filter + linear mip filter -> trilinear filter
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/StencilAction.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract StencilAction(Int) to Int {
enum abstract StencilAction(Int) to Int {
var Keep = 0;
var Zero = 1;
var Replace = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/TexDir.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract TexDir(Int) to Int {
enum abstract TexDir(Int) to Int {
var U = 0;
var V = 1;
}
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/TextureAddressing.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract TextureAddressing(Int) to Int {
enum abstract TextureAddressing(Int) to Int {
var Repeat = 0;
var Mirror = 1;
var Clamp = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/TextureFilter.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract TextureFilter(Int) to Int {
enum abstract TextureFilter(Int) to Int {
var PointFilter = 0;
var LinearFilter = 1;
var AnisotropicFilter = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/TextureFormat.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract TextureFormat(Int) to Int {
enum abstract TextureFormat(Int) to Int {
var RGBA32 = 0;
var L8 = 1;
var RGBA128 = 2; // Floats
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/Usage.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract Usage(Int) to Int {
enum abstract Usage(Int) to Int {
var StaticUsage = 0;
var DynamicUsage = 1; // Just calling it Dynamic causes problems in C++
var ReadableUsage = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/graphics4/VertexData.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.graphics4;

@:enum abstract VertexData(Int) {
enum abstract VertexData(Int) {
var Float32_1X = 0;
var Float32_2X = 1;
var Float32_3X = 2;
Expand Down
2 changes: 1 addition & 1 deletion Sources/kha/input/KeyCode.hx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package kha.input;

@:enum abstract KeyCode(Int) to Int {
enum abstract KeyCode(Int) to Int {
var Unknown = 0;
var Back = 1; // Android
var Cancel = 3;
Expand Down
24 changes: 12 additions & 12 deletions Sources/kha/math/FastMatrix2.hx
Original file line number Diff line number Diff line change
Expand Up @@ -28,54 +28,54 @@ class FastMatrix2 {
public static function index(x: Int, y: Int): Int {
return y * width + x;
}*/
@:extern public inline function setFrom(m: FastMatrix2): Void {
extern public inline function setFrom(m: FastMatrix2): Void {
this._00 = m._00;
this._10 = m._10;
this._01 = m._01;
this._11 = m._11;
}

@:extern public static inline function empty(): FastMatrix2 {
extern public static inline function empty(): FastMatrix2 {
return new FastMatrix2(0, 0, 0, 0);
}

@:extern public static inline function identity(): FastMatrix2 {
extern public static inline function identity(): FastMatrix2 {
return new FastMatrix2(1, 0, 0, 1);
}

@:extern public static inline function scale(x: FastFloat, y: FastFloat): FastMatrix2 {
extern public static inline function scale(x: FastFloat, y: FastFloat): FastMatrix2 {
return new FastMatrix2(x, 0, 0, y);
}

@:extern public static inline function rotation(alpha: FastFloat): FastMatrix2 {
extern public static inline function rotation(alpha: FastFloat): FastMatrix2 {
return new FastMatrix2(Math.cos(alpha), -Math.sin(alpha), Math.sin(alpha), Math.cos(alpha));
}

@:extern public inline function add(m: FastMatrix2): FastMatrix2 {
extern public inline function add(m: FastMatrix2): FastMatrix2 {
return new FastMatrix2(_00 + m._00, _10 + m._10, _01 + m._01, _11 + m._11);
}

@:extern public inline function sub(m: FastMatrix2): FastMatrix2 {
extern public inline function sub(m: FastMatrix2): FastMatrix2 {
return new FastMatrix2(_00 - m._00, _10 - m._10, _01 - m._01, _11 - m._11);
}

@:extern public inline function mult(value: FastFloat): FastMatrix2 {
extern public inline function mult(value: FastFloat): FastMatrix2 {
return new FastMatrix2(_00 * value, _10 * value, _01 * value, _11 * value);
}

@:extern public inline function transpose(): FastMatrix2 {
extern public inline function transpose(): FastMatrix2 {
return new FastMatrix2(_00, _01, _10, _11);
}

@:extern public inline function trace(): FastFloat {
extern public inline function trace(): FastFloat {
return _00 + _11;
}

@:extern public inline function multmat(m: FastMatrix2): FastMatrix2 {
extern public inline function multmat(m: FastMatrix2): FastMatrix2 {
return new FastMatrix2(_00 * m._00 + _10 * m._01, _00 * m._10 + _10 * m._11, _01 * m._00 + _11 * m._01, _01 * m._10 + _11 * m._11);
}

@:extern public inline function multvec(value: FastVector2): FastVector2 {
extern public inline function multvec(value: FastVector2): FastVector2 {
var x = _00 * value.x + _10 * value.y;
var y = _01 * value.x + _11 * value.y;
return new FastVector2(x, y);
Expand Down
32 changes: 16 additions & 16 deletions Sources/kha/math/FastMatrix3.hx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class FastMatrix3 {
public static function index(x: Int, y: Int): Int {
return y * width + x;
}*/
@:extern public inline function setFrom(m: FastMatrix3): Void {
extern public inline function setFrom(m: FastMatrix3): Void {
this._00 = m._00;
this._10 = m._10;
this._20 = m._20;
Expand All @@ -67,47 +67,47 @@ class FastMatrix3 {
this._22 = m._22;
}

@:extern public static inline function translation(x: FastFloat, y: FastFloat): FastMatrix3 {
extern public static inline function translation(x: FastFloat, y: FastFloat): FastMatrix3 {
return new FastMatrix3(1, 0, x, 0, 1, y, 0, 0, 1);
}

@:extern public static inline function empty(): FastMatrix3 {
extern public static inline function empty(): FastMatrix3 {
return new FastMatrix3(0, 0, 0, 0, 0, 0, 0, 0, 0);
}

@:extern public static inline function identity(): FastMatrix3 {
extern public static inline function identity(): FastMatrix3 {
return new FastMatrix3(1, 0, 0, 0, 1, 0, 0, 0, 1);
}

@:extern public static inline function scale(x: FastFloat, y: FastFloat): FastMatrix3 {
extern public static inline function scale(x: FastFloat, y: FastFloat): FastMatrix3 {
return new FastMatrix3(x, 0, 0, 0, y, 0, 0, 0, 1);
}

@:extern public static inline function rotation(alpha: FastFloat): FastMatrix3 {
extern public static inline function rotation(alpha: FastFloat): FastMatrix3 {
return new FastMatrix3(Math.cos(alpha), -Math.sin(alpha), 0, Math.sin(alpha), Math.cos(alpha), 0, 0, 0, 1);
}

@:extern public inline function add(m: FastMatrix3): FastMatrix3 {
extern public inline function add(m: FastMatrix3): FastMatrix3 {
return new FastMatrix3(_00 + m._00, _10 + m._10, _20 + m._20, _01 + m._01, _11 + m._11, _21 + m._21, _02 + m._02, _12 + m._12, _22 + m._22);
}

@:extern public inline function sub(m: FastMatrix3): FastMatrix3 {
extern public inline function sub(m: FastMatrix3): FastMatrix3 {
return new FastMatrix3(_00 - m._00, _10 - m._10, _20 - m._20, _01 - m._01, _11 - m._11, _21 - m._21, _02 - m._02, _12 - m._12, _22 - m._22);
}

@:extern public inline function mult(value: FastFloat): FastMatrix3 {
extern public inline function mult(value: FastFloat): FastMatrix3 {
return new FastMatrix3(_00 * value, _10 * value, _20 * value, _01 * value, _11 * value, _21 * value, _02 * value, _12 * value, _22 * value);
}

@:extern public inline function transpose(): FastMatrix3 {
extern public inline function transpose(): FastMatrix3 {
return new FastMatrix3(_00, _01, _02, _10, _11, _12, _20, _21, _22);
}

@:extern public inline function trace(): FastFloat {
extern public inline function trace(): FastFloat {
return _00 + _11 + _22;
}

@:extern public inline function multmat(m: FastMatrix3): FastMatrix3 {
extern public inline function multmat(m: FastMatrix3): FastMatrix3 {
return new FastMatrix3(_00 * m._00
+ _10 * m._01
+ _20 * m._02, _00 * m._10
Expand All @@ -131,7 +131,7 @@ class FastMatrix3 {
+ _22 * m._22);
}

@:extern public inline function multvec(value: FastVector2): FastVector2 {
extern public inline function multvec(value: FastVector2): FastVector2 {
// var product = new Vector2(0, 0);
var w = _02 * value.x + _12 * value.y + _22 * 1;
var x = (_00 * value.x + _10 * value.y + _20 * 1) / w;
Expand All @@ -140,18 +140,18 @@ class FastMatrix3 {
return new FastVector2(x, y);
}

@:extern public inline function cofactor(m0: FastFloat, m1: FastFloat, m2: FastFloat, m3: FastFloat): Float {
extern public inline function cofactor(m0: FastFloat, m1: FastFloat, m2: FastFloat, m3: FastFloat): Float {
return m0 * m3 - m1 * m2;
}

@:extern public inline function determinant(): FastFloat {
extern public inline function determinant(): FastFloat {
var c00 = cofactor(_11, _21, _12, _22);
var c01 = cofactor(_10, _20, _12, _22);
var c02 = cofactor(_10, _20, _11, _21);
return _00 * c00 - _01 * c01 + _02 * c02;
}

@:extern public inline function inverse(): FastMatrix3 {
extern public inline function inverse(): FastMatrix3 {
var c00 = cofactor(_11, _21, _12, _22);
var c01 = cofactor(_10, _20, _12, _22);
var c02 = cofactor(_10, _20, _11, _21);
Expand Down
Loading

0 comments on commit 3e22af9

Please sign in to comment.