├── .gitattributes ├── make.bat ├── Backends ├── Kore │ ├── pch.h │ ├── lib │ │ └── khalib │ │ │ └── pch.h │ └── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── kore │ │ ├── graphics4 │ │ │ ├── ShaderType.hx │ │ │ ├── TextureUnit.hx │ │ │ ├── ConstantLocation.hx │ │ │ └── Graphics2.hx │ │ └── Keyboard.hx │ │ ├── compute │ │ ├── TextureUnit.hx │ │ └── ConstantLocation.hx │ │ ├── capture │ │ └── AudioCapture.hx │ │ ├── graphics5_ │ │ ├── RayTraceTarget.hx │ │ ├── AccelerationStructure.hx │ │ ├── RayTracePipeline.hx │ │ └── ConstantBuffer.hx │ │ ├── graphics4 │ │ ├── GeometryShader.hx │ │ ├── TessellationControlShader.hx │ │ └── TessellationEvaluationShader.hx │ │ └── input │ │ └── Sensor.hx ├── Empty │ └── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── input │ │ └── MouseImpl.hx │ │ ├── EnvironmentVariables.hx │ │ ├── network │ │ └── Http.hx │ │ ├── Storage.hx │ │ ├── audio2 │ │ └── Audio.hx │ │ ├── netsync │ │ └── Network.hx │ │ ├── graphics4 │ │ ├── IndexBuffer.hx │ │ ├── VertexShader.hx │ │ ├── FragmentShader.hx │ │ ├── PipelineState.hx │ │ └── VertexBuffer.hx │ │ ├── DisplayImpl.hx │ │ └── arrays │ │ ├── Float32Array.hx │ │ ├── Int32Array.hx │ │ ├── Int16Array.hx │ │ └── Uint32Array.hx ├── Flash │ └── kha │ │ ├── Font.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── flash │ │ └── graphics4 │ │ │ ├── TextureUnit.hx │ │ │ └── ConstantLocation.hx │ │ ├── network │ │ └── Network.hx │ │ ├── input │ │ └── MouseImpl.hx │ │ ├── arrays │ │ ├── Int16Array.hx │ │ ├── Int32Array.hx │ │ └── Uint32Array.hx │ │ └── graphics4 │ │ ├── VertexShader.hx │ │ └── FragmentShader.hx ├── HTML5 │ └── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── js │ │ ├── graphics4 │ │ │ ├── TextureUnit.hx │ │ │ └── ConstantLocation.hx │ │ ├── AudioElementAudio.hx │ │ └── MobileWebAudio.hx │ │ ├── Macros.hx │ │ ├── EnvironmentVariables.hx │ │ ├── capture │ │ └── VideoCapture.hx │ │ ├── arrays │ │ └── Float32Array.hx │ │ └── graphics4 │ │ ├── VertexShader.hx │ │ └── FragmentShader.hx ├── KoreHL │ ├── kha │ │ ├── Font.hx │ │ ├── Pointer.hx │ │ ├── Blob.hx │ │ ├── audio1 │ │ │ └── Audio.hx │ │ ├── compute │ │ │ ├── TextureUnit.hx │ │ │ ├── ConstantLocation.hx │ │ │ └── ShaderStorageBuffer.hx │ │ ├── korehl │ │ │ └── graphics4 │ │ │ │ ├── TextureUnit.hx │ │ │ │ ├── ConstantLocation.hx │ │ │ │ └── Graphics2.hx │ │ ├── network │ │ │ └── Http.hx │ │ ├── Storage.hx │ │ ├── netsync │ │ │ └── Network.hx │ │ └── StringHelper.hx │ └── KoreC │ │ ├── indexbuffer.cpp │ │ └── display.cpp ├── Krom │ └── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── compute │ │ ├── TextureUnit.hx │ │ ├── ConstantLocation.hx │ │ ├── Shader.hx │ │ └── ShaderStorageBuffer.hx │ │ ├── network │ │ ├── Http.hx │ │ └── Network.hx │ │ ├── graphics4 │ │ ├── GeometryShader.hx │ │ ├── TessellationControlShader.hx │ │ ├── TessellationEvaluationShader.hx │ │ ├── VertexShader.hx │ │ └── FragmentShader.hx │ │ └── krom │ │ └── Sound.hx ├── Node │ └── kha │ │ ├── Font.hx │ │ ├── js │ │ ├── Video.hx │ │ ├── graphics4 │ │ │ ├── TextureUnit.hx │ │ │ └── ConstantLocation.hx │ │ ├── Music.hx │ │ ├── EmptyGraphics1.hx │ │ ├── Mouse.hx │ │ └── Sound.hx │ │ ├── graphics4 │ │ ├── VertexShader.hx │ │ ├── FragmentShader.hx │ │ ├── IndexBuffer.hx │ │ └── PipelineState.hx │ │ ├── Storage.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── DisplayImpl.hx │ │ └── arrays │ │ └── Float32Array.hx ├── Unity │ ├── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── unity │ │ │ ├── Music.hx │ │ │ ├── Video.hx │ │ │ ├── TextureUnit.hx │ │ │ ├── Sound.hx │ │ │ └── ConstantLocation.hx │ │ ├── Storage.hx │ │ ├── audio1 │ │ │ ├── UnityMusicChannel.hx │ │ │ └── Audio.hx │ │ ├── netsync │ │ │ └── Network.hx │ │ ├── graphics4 │ │ │ ├── VertexShader.hx │ │ │ ├── FragmentShader.hx │ │ │ ├── PipelineState.hx │ │ │ └── IndexBuffer.hx │ │ ├── arrays │ │ │ ├── Int32Array.hx │ │ │ └── Float32Array.hx │ │ └── DisplayImpl.hx │ ├── unityEngine │ │ ├── MonoBehaviour.hx │ │ ├── AudioClip.hx │ │ ├── Vector2.hx │ │ ├── GameObject.hx │ │ ├── Shader.hx │ │ ├── Texture.hx │ │ ├── Vector3.hx │ │ ├── Color.hx │ │ ├── Screen.hx │ │ ├── Vector4.hx │ │ ├── Texture2D.hx │ │ ├── Graphics.hx │ │ ├── GL.hx │ │ ├── Input.hx │ │ ├── RenderTexture.hx │ │ ├── Matrix4x4.hx │ │ ├── AudioSource.hx │ │ ├── Material.hx │ │ └── Mesh.hx │ ├── Point.hx │ ├── system │ │ └── diagnostics │ │ │ └── Stopwatch.hx │ └── UnityBackend.hx ├── Android │ ├── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── android │ │ │ ├── graphics4 │ │ │ │ ├── TextureUnit.hx │ │ │ │ └── ConstantLocation.hx │ │ │ ├── Keyboard.hx │ │ │ └── Video.hx │ │ ├── network │ │ │ └── Http.hx │ │ ├── netsync │ │ │ └── Network.hx │ │ ├── graphics4 │ │ │ ├── VertexShader.hx │ │ │ └── FragmentShader.hx │ │ └── DisplayImpl.hx │ ├── android │ │ ├── graphics │ │ │ ├── RectF.hx │ │ │ ├── Rect.hx │ │ │ ├── Color.hx │ │ │ ├── Typeface.hx │ │ │ ├── BitmapFactory.hx │ │ │ ├── Bitmap.hx │ │ │ ├── Canvas.hx │ │ │ └── Paint.hx │ │ ├── os │ │ │ ├── IBinder.hx │ │ │ ├── Parcelable.hx │ │ │ ├── BaseBundle.hx │ │ │ ├── BuildVERSION.hx │ │ │ ├── VibratorEffect.hx │ │ │ ├── Vibrator.hx │ │ │ └── Bundle.hx │ │ ├── content │ │ │ ├── ComponentName.hx │ │ │ ├── IntentSender.hx │ │ │ ├── res │ │ │ │ ├── Configuration.hx │ │ │ │ ├── AssetManager.hx │ │ │ │ └── AssetFileDescriptor.hx │ │ │ ├── ServiceConnection.hx │ │ │ └── Context.hx │ │ ├── media │ │ │ ├── AudioManager.hx │ │ │ ├── AudioFormat.hx │ │ │ ├── MediaFormat.hx │ │ │ ├── MediaPlayerOnCompletionListener.hx │ │ │ ├── SoundPoolOnLoadCompleteListener.hx │ │ │ ├── AudioTrackOnPlaybackPositionUpdateListener.hx │ │ │ ├── MediaExtractor.hx │ │ │ └── SoundPool.hx │ │ ├── text │ │ │ └── method │ │ │ │ └── MetaKeyKeyListener.hx │ │ ├── view │ │ │ ├── SurfaceHolderCallback.hx │ │ │ ├── ViewOnTouchListener.hx │ │ │ ├── Window.hx │ │ │ ├── WindowManagerLayoutParams.hx │ │ │ ├── KeyCharacterMap.hx │ │ │ ├── SurfaceHolder.hx │ │ │ ├── SurfaceView.hx │ │ │ ├── inputmethod │ │ │ │ └── InputMethodManager.hx │ │ │ ├── KeyEvent.hx │ │ │ ├── MotionEvent.hx │ │ │ └── View.hx │ │ ├── opengl │ │ │ ├── GLSurfaceViewRenderer.hx │ │ │ ├── GLES11Ext.hx │ │ │ ├── Matrix.hx │ │ │ ├── GLUtils.hx │ │ │ └── GLSurfaceView.hx │ │ ├── widget │ │ │ └── LinearLayout.hx │ │ └── net │ │ │ └── Uri.hx │ ├── javax │ │ └── microedition │ │ │ └── khronos │ │ │ ├── egl │ │ │ └── EGLConfig.hx │ │ │ └── opengles │ │ │ └── GL10.hx │ └── tech │ │ └── kode │ │ └── kha │ │ └── KhaExtension.hx ├── Java │ ├── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── graphics4 │ │ │ ├── VertexShader.hx │ │ │ ├── FragmentShader.hx │ │ │ ├── IndexBuffer.hx │ │ │ ├── VertexBuffer.hx │ │ │ └── Program.hx │ │ ├── java │ │ │ └── Graphics.hx │ │ ├── audio1 │ │ │ └── Audio.hx │ │ └── arrays │ │ │ └── Float32Array.hx │ └── java │ │ └── lang │ │ └── Runnable.hx ├── HTML5-Worker │ └── kha │ │ ├── Font.hx │ │ ├── Blob.hx │ │ ├── html5worker │ │ ├── TextureUnit.hx │ │ ├── ConstantLocation.hx │ │ └── Sound.hx │ │ ├── Storage.hx │ │ ├── audio2 │ │ └── Audio.hx │ │ ├── Worker.hx │ │ ├── audio1 │ │ └── Audio.hx │ │ ├── graphics4 │ │ ├── VertexShader.hx │ │ └── FragmentShader.hx │ │ └── arrays │ │ └── Float32Array.hx ├── WPF │ ├── kha │ │ ├── Blob.hx │ │ ├── wpf │ │ │ ├── Mouse.hx │ │ │ ├── Music.hx │ │ │ ├── Sound.hx │ │ │ └── Graphics.hx │ │ ├── graphics4 │ │ │ ├── VertexShader.hx │ │ │ ├── FragmentShader.hx │ │ │ ├── IndexBuffer.hx │ │ │ ├── PipelineState.hx │ │ │ └── VertexBuffer.hx │ │ ├── network │ │ │ ├── Http.hx │ │ │ └── Network.hx │ │ └── audio1 │ │ │ ├── Audio.hx │ │ │ └── WpfMusicChannel.hx │ └── system │ │ ├── io │ │ ├── DirectoryInfo.hx │ │ ├── Path.hx │ │ ├── Directory.hx │ │ └── File.hx │ │ ├── windows │ │ ├── media │ │ │ ├── Color.hx │ │ │ ├── imaging │ │ │ │ └── BitmapSource.hx │ │ │ ├── ImageSource.hx │ │ │ ├── DrawingVisual.hx │ │ │ ├── DrawingContext.hx │ │ │ ├── MatrixTransform.hx │ │ │ ├── ImageBrush.hx │ │ │ └── MediaPlayer.hx │ │ ├── input │ │ │ ├── Cursor.hx │ │ │ ├── Mouse.hx │ │ │ └── Cursors.hx │ │ ├── Window.hx │ │ ├── controls │ │ │ ├── MediaState.hx │ │ │ ├── Canvas.hx │ │ │ └── MediaElement.hx │ │ └── FrameworkElement.hx │ │ ├── Uri.hx │ │ ├── UriKind.hx │ │ └── diagnostics │ │ └── Stopwatch.hx └── PSM │ ├── system │ ├── io │ │ ├── DirectoryInfo.hx │ │ ├── Path.hx │ │ ├── Directory.hx │ │ └── File.hx │ ├── windows │ │ ├── media │ │ │ ├── Color.hx │ │ │ ├── DrawingContext.hx │ │ │ ├── imaging │ │ │ │ └── BitmapSource.hx │ │ │ └── MediaPlayer.hx │ │ ├── input │ │ │ ├── Cursor.hx │ │ │ ├── Mouse.hx │ │ │ └── Cursors.hx │ │ ├── Window.hx │ │ ├── FrameworkElement.hx │ │ └── controls │ │ │ ├── MediaState.hx │ │ │ ├── Canvas.hx │ │ │ └── MediaElement.hx │ ├── Uri.hx │ ├── UriKind.hx │ └── diagnostics │ │ └── Stopwatch.hx │ ├── kha │ ├── psm │ │ ├── graphics4 │ │ │ ├── TextureUnit.hx │ │ │ └── ConstantLocation.hx │ │ ├── Sound.hx │ │ └── Music.hx │ ├── Storage.hx │ └── graphics4 │ │ ├── FragmentShader.hx │ │ ├── VertexShader.hx │ │ └── IndexBuffer.hx │ └── sce │ └── playstation │ └── core │ ├── Matrix4.hx │ └── graphics │ ├── BlendFuncMode.hx │ ├── VertexFormat.hx │ ├── DrawMode.hx │ ├── ShaderProgram.hx │ ├── Texture2D.hx │ ├── EnableMode.hx │ ├── BlendFuncFactor.hx │ ├── VertexBuffer.hx │ └── GraphicsContext.hx ├── make.js ├── .gitignore ├── Tests ├── MultiWindow │ ├── Readme.md │ ├── khafile.js │ └── Sources │ │ ├── Primary.hx │ │ ├── Secondary1.hx │ │ └── Secondary2.hx ├── Gamepads │ ├── khafile.js │ ├── configure-msvc2010-opengl.cmd │ └── src │ │ └── Main.hx └── Empty │ ├── khafile.js │ └── Sources │ └── Main.hx ├── .github ├── funding.yml └── workflows │ ├── windows.yml │ ├── flash.yml │ ├── html5.yml │ ├── krom.yml │ ├── android.yml │ ├── macos.yml │ └── linux.yml ├── checkstyle.bat ├── Sources ├── kha │ ├── graphics5_ │ │ ├── Usage.hx │ │ ├── CubeMap.hx │ │ ├── CullMode.hx │ │ ├── RenderTarget.hx │ │ ├── CompareMode.hx │ │ ├── IndexBuffer.hx │ │ ├── TextureUnit.hx │ │ ├── VertexData.hx │ │ ├── MipMapFilter.hx │ │ ├── PipelineState.hx │ │ ├── StencilAction.hx │ │ ├── TextureFilter.hx │ │ ├── TextureFormat.hx │ │ ├── VertexBuffer.hx │ │ ├── VertexElement.hx │ │ ├── VertexShader.hx │ │ ├── AccelerationStructure.hx │ │ ├── BlendingFactor.hx │ │ ├── FragmentShader.hx │ │ ├── GeometryShader.hx │ │ ├── ConstantLocation.hx │ │ ├── VertexStructure.hx │ │ ├── BlendingOperation.hx │ │ ├── TextureAddressing.hx │ │ ├── TessellationControlShader.hx │ │ ├── TessellationEvaluationShader.hx │ │ └── Graphics.hx │ ├── compute │ │ ├── TextureUnit.hx │ │ ├── ConstantLocation.hx │ │ ├── Access.hx │ │ ├── Shader.hx │ │ └── ShaderStorageBuffer.hx │ ├── graphics4 │ │ ├── TextureUnit.hx │ │ ├── ConstantLocation.hx │ │ ├── StencilValue.hx │ │ ├── TexDir.hx │ │ ├── CullMode.hx │ │ ├── TextureAddressing.hx │ │ ├── TextureFilter.hx │ │ ├── Usage.hx │ │ ├── BlendingOperation.hx │ │ ├── MipMapFilter.hx │ │ ├── VertexData.hx │ │ ├── VertexElement.hx │ │ ├── CompareMode.hx │ │ ├── StencilAction.hx │ │ ├── TextureFormat.hx │ │ ├── VertexShader.hx │ │ ├── FragmentShader.hx │ │ ├── PipelineState.hx │ │ ├── GeometryShader.hx │ │ ├── TessellationControlShader.hx │ │ ├── BlendingFactor.hx │ │ ├── IndexBuffer.hx │ │ ├── TessellationEvaluationShader.hx │ │ ├── DepthStencilFormat.hx │ │ ├── VertexBuffer.hx │ │ ├── hxsl │ │ │ ├── Types.hx │ │ │ ├── ShaderList.hx │ │ │ └── Serializer.hx │ │ └── CubeMap.hx │ ├── internal │ │ ├── VoidCallback.hx │ │ ├── AssetErrorCallback.hx │ │ └── IntBox.hx │ ├── AssetError.hx │ ├── Shaders.hx │ ├── input │ │ ├── SensorType.hx │ │ └── Sensor.hx │ ├── EnvironmentVariables.hx │ ├── netsync │ │ ├── Sync.hx │ │ ├── Client.hx │ │ ├── Entity.hx │ │ ├── Network.hx │ │ ├── Example.hx │ │ ├── Controller.hx │ │ └── LocalClient.hx │ ├── graphics2 │ │ ├── HorTextAlignment.hx │ │ ├── VerTextAlignment.hx │ │ └── ImageScaleQuality.hx │ ├── capture │ │ ├── VideoCapture.hx │ │ └── AudioCapture.hx │ ├── network │ │ ├── HttpMethod.hx │ │ └── Http.hx │ ├── FastFloat.hx │ ├── ScreenRotation.hx │ ├── audio2 │ │ ├── ogg │ │ │ ├── vorbis │ │ │ │ └── data │ │ │ │ │ ├── IntPoint.hx │ │ │ │ │ ├── ProbedPage.hx │ │ │ │ │ └── Setting.hx │ │ │ └── tools │ │ │ │ └── Crc32.hx │ │ └── Buffer.hx │ ├── audio1 │ │ ├── Audio.hx │ │ └── AudioChannel.hx │ ├── Rotation.hx │ ├── StringExtensions.hx │ ├── WindowMode.hx │ ├── Resource.hx │ ├── vr │ │ ├── Pose.hx │ │ ├── PoseState.hx │ │ └── SensorState.hx │ ├── DisplayMode.hx │ ├── CodeStyle.hx │ ├── Display.hx │ ├── Font.hx │ ├── graphics1 │ │ └── Graphics.hx │ ├── Canvas.hx │ └── FramebufferOptions.hx └── Shaders │ ├── painter-colored.frag.glsl │ ├── painter-text.frag.glsl │ ├── painter-image.frag.glsl │ ├── painter-video.frag.glsl │ ├── painter-colored.vert.glsl │ ├── painter-image.vert.glsl │ ├── painter-video.vert.glsl │ └── painter-text.vert.glsl ├── .codeclimate.yml ├── make.sh ├── checkstyle-exclude.json ├── updates.md ├── checkstyle.json └── license.txt /.gitattributes: -------------------------------------------------------------------------------- 1 | * -text 2 | -------------------------------------------------------------------------------- /make.bat: -------------------------------------------------------------------------------- 1 | @node %~dp0make.js %* -------------------------------------------------------------------------------- /Backends/Kore/pch.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /make.js: -------------------------------------------------------------------------------- 1 | require('./Tools/khamake/khamake.js'); 2 | -------------------------------------------------------------------------------- /Backends/Kore/lib/khalib/pch.h: -------------------------------------------------------------------------------- 1 | #include 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | /build 3 | /Tests/Empty/korefile.js 4 | -------------------------------------------------------------------------------- /Tests/MultiWindow/Readme.md: -------------------------------------------------------------------------------- 1 | node ../../make --graphics opengl 2 | -------------------------------------------------------------------------------- /.github/funding.yml: -------------------------------------------------------------------------------- 1 | github: RobDangerous 2 | patreon: RobDangerous 3 | -------------------------------------------------------------------------------- /Backends/Empty/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Flash/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Kore/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Krom/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Node/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Unity/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Android/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Java/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.java.Font; 4 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/Pointer.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Pointer = hl.Bytes; 4 | -------------------------------------------------------------------------------- /checkstyle.bat: -------------------------------------------------------------------------------- 1 | haxelib run checkstyle -s Sources -s Backends/HTML5 -s Backends/Kore/kha -------------------------------------------------------------------------------- /Backends/Android/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Font = kha.Kravur; 4 | -------------------------------------------------------------------------------- /Backends/Java/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/Kore/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/Krom/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/Unity/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/WPF/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/Empty/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/Blob.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef Blob = kha.internal.BytesBlob; 4 | -------------------------------------------------------------------------------- /Backends/Empty/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Backends/Flash/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Backends/Kore/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Backends/Krom/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | typedef Audio = kha.audio2.Audio1; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/Usage.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef Usage = kha.graphics4.Usage; 4 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/RectF.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class RectF { 4 | 5 | } -------------------------------------------------------------------------------- /Sources/kha/compute/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | extern class TextureUnit { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | interface TextureUnit { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/CubeMap.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef CubeMap = kha.graphics4.CubeMap; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/CullMode.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef CullMode = kha.graphics4.CullMode; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/RenderTarget.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | interface RenderTarget { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/internal/VoidCallback.hx: -------------------------------------------------------------------------------- 1 | package kha.internal; 2 | 3 | typedef VoidCallback = Void -> Void; 4 | -------------------------------------------------------------------------------- /.codeclimate.yml: -------------------------------------------------------------------------------- 1 | engines: 2 | haxe-checkstyle: 3 | enabled: true 4 | ratings: 5 | paths: 6 | - "**.hx" -------------------------------------------------------------------------------- /Backends/Android/android/os/IBinder.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | extern interface IBinder { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Android/android/os/Parcelable.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | extern interface Parcelable { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/AssetError.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | typedef AssetError = { 4 | url: String, 5 | ?error: Dynamic, 6 | } 7 | -------------------------------------------------------------------------------- /Sources/kha/compute/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | extern class ConstantLocation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | interface ConstantLocation { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/CompareMode.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef CompareMode = kha.graphics4.CompareMode; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef IndexBuffer = kha.graphics4.IndexBuffer; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TextureUnit = kha.graphics4.TextureUnit; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/VertexData.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef VertexData = kha.graphics4.VertexData; 4 | -------------------------------------------------------------------------------- /Backends/Android/android/content/ComponentName.hx: -------------------------------------------------------------------------------- 1 | package android.content; 2 | 3 | extern class ComponentName { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Android/android/content/IntentSender.hx: -------------------------------------------------------------------------------- 1 | package android.content; 2 | 3 | extern class IntentSender { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Java/java/lang/Runnable.hx: -------------------------------------------------------------------------------- 1 | package java.lang; 2 | 3 | extern interface Runnable { 4 | function run() : Void; 5 | } -------------------------------------------------------------------------------- /Sources/kha/graphics5_/MipMapFilter.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef MipMapFilter = kha.graphics4.MipMapFilter; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef PipelineState = kha.graphics4.PipelineState; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/StencilAction.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef StencilAction = kha.graphics4.StencilAction; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TextureFilter.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TextureFilter = kha.graphics4.TextureFilter; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TextureFormat.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TextureFormat = kha.graphics4.TextureFormat; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef VertexBuffer = kha.graphics4.VertexBuffer; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/VertexElement.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef VertexElement = kha.graphics4.VertexElement; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef VertexShader = kha.graphics4.VertexShader; 4 | -------------------------------------------------------------------------------- /Sources/kha/internal/AssetErrorCallback.hx: -------------------------------------------------------------------------------- 1 | package kha.internal; 2 | 3 | typedef AssetErrorCallback = AssetError -> Void; 4 | -------------------------------------------------------------------------------- /make.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | directory=$(dirname "$BASH_SOURCE") 3 | makejs=$directory 4 | makejs+="/make.js" 5 | node "$makejs" "$@" -------------------------------------------------------------------------------- /Sources/kha/graphics5_/AccelerationStructure.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | interface AccelerationStructure { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/BlendingFactor.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef BlendingFactor = kha.graphics4.BlendingFactor; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef FragmentShader = kha.graphics4.FragmentShader; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/GeometryShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef GeometryShader = kha.graphics4.GeometryShader; 4 | -------------------------------------------------------------------------------- /Tests/Gamepads/khafile.js: -------------------------------------------------------------------------------- 1 | let project = new Project('Gamepads'); 2 | 3 | project.addSources('src'); 4 | 5 | resolve(project); 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/StencilValue.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | enum StencilValue { 4 | Dynamic; 5 | Static(value: Int); 6 | } 7 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef ConstantLocation = kha.graphics4.ConstantLocation; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/VertexStructure.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef VertexStructure = kha.graphics4.VertexStructure; 4 | -------------------------------------------------------------------------------- /Tests/Empty/khafile.js: -------------------------------------------------------------------------------- 1 | let project = new Project('Empty'); 2 | 3 | project.addSources('Sources'); 4 | 5 | resolve(project); 6 | -------------------------------------------------------------------------------- /Tests/Gamepads/configure-msvc2010-opengl.cmd: -------------------------------------------------------------------------------- 1 | @node ../../make --target windows --kha ../.. --visualstudio vs2010 --graphics opengl 2 | -------------------------------------------------------------------------------- /Backends/Android/android/content/res/Configuration.hx: -------------------------------------------------------------------------------- 1 | package android.content.res; 2 | 3 | extern class Configuration { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Krom/kha/compute/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | class TextureUnit { 4 | public function new() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/Shaders.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | @:keep 4 | @:build(kha.internal.ShadersBuilder.build()) 5 | class Shaders { 6 | 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/BlendingOperation.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef BlendingOperation = kha.graphics4.BlendingOperation; 4 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TextureAddressing.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TextureAddressing = kha.graphics4.TextureAddressing; 4 | -------------------------------------------------------------------------------- /Tests/MultiWindow/khafile.js: -------------------------------------------------------------------------------- 1 | let project = new Project('MultiWindow'); 2 | 3 | project.addSources('Sources'); 4 | 5 | resolve(project); 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/TexDir.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract TexDir(Int) to Int { 4 | var U = 0; 5 | var V = 1; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Krom/kha/compute/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | class ConstantLocation { 4 | public function new() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/io/DirectoryInfo.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.DirectoryInfo") 4 | extern class DirectoryInfo 5 | { 6 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/MonoBehaviour.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.MonoBehaviour') 4 | extern class MonoBehaviour {} 5 | -------------------------------------------------------------------------------- /Backends/WPF/system/io/DirectoryInfo.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.DirectoryInfo") 4 | extern class DirectoryInfo 5 | { 6 | } -------------------------------------------------------------------------------- /Sources/kha/input/SensorType.hx: -------------------------------------------------------------------------------- 1 | package kha.input; 2 | 3 | enum abstract SensorType(Int) { 4 | var Accelerometer = 0; 5 | var Gyroscope = 1; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Android/android/media/AudioManager.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | extern class AudioManager { 4 | public static var STREAM_MUSIC : Int; 5 | } -------------------------------------------------------------------------------- /Backends/Android/javax/microedition/khronos/egl/EGLConfig.hx: -------------------------------------------------------------------------------- 1 | package javax.microedition.khronos.egl; 2 | 3 | extern class EGLConfig { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Android/javax/microedition/khronos/opengles/GL10.hx: -------------------------------------------------------------------------------- 1 | package javax.microedition.khronos.opengles; 2 | 3 | extern class GL10 { 4 | 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/Video.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | class Video extends kha.Video { 4 | public function new() { 5 | super(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Unity/kha/unity/Music.hx: -------------------------------------------------------------------------------- 1 | package kha.unity; 2 | 3 | class Music extends kha.Music { 4 | public function new() { 5 | super(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Unity/kha/unity/Video.hx: -------------------------------------------------------------------------------- 1 | package kha.unity; 2 | 3 | class Video extends kha.Video { 4 | public function new() { 5 | super(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/WPF/kha/wpf/Mouse.hx: -------------------------------------------------------------------------------- 1 | package kha.wpf; 2 | 3 | class Mouse extends kha.Mouse { 4 | public function new() { 5 | super(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/media/Color.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.Color") 4 | extern class Color { 5 | 6 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/Color.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.Color") 4 | extern class Color { 5 | 6 | } -------------------------------------------------------------------------------- /Sources/kha/EnvironmentVariables.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | extern class EnvironmentVariables { 4 | public static function get(name: String): String; 5 | } 6 | -------------------------------------------------------------------------------- /checkstyle-exclude.json: -------------------------------------------------------------------------------- 1 | { 2 | "all": [ 3 | "kha.audio2.ogg", 4 | "kha.graphics2.truetype", 5 | "kha.graphics4.hxsl", 6 | "kha.vr" 7 | ] 8 | } 9 | -------------------------------------------------------------------------------- /Backends/PSM/system/Uri.hx: -------------------------------------------------------------------------------- 1 | package system; 2 | 3 | @:native("System.Uri") 4 | extern class Uri { 5 | function new(filename : String, kind : UriKind) : Void; 6 | } -------------------------------------------------------------------------------- /Backends/PSM/system/windows/input/Cursor.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Cursor") 4 | extern class Cursor { 5 | 6 | } -------------------------------------------------------------------------------- /Backends/Unity/Point.hx: -------------------------------------------------------------------------------- 1 | package; 2 | 3 | extern class Point { 4 | public var x: Int; 5 | public var y: Int; 6 | public function new(px: Int, py: Int); 7 | } 8 | -------------------------------------------------------------------------------- /Backends/WPF/system/Uri.hx: -------------------------------------------------------------------------------- 1 | package system; 2 | 3 | @:native("System.Uri") 4 | extern class Uri { 5 | function new(filename : String, kind : UriKind) : Void; 6 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/input/Cursor.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Cursor") 4 | extern class Cursor { 5 | 6 | } -------------------------------------------------------------------------------- /Sources/kha/compute/Access.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | enum abstract Access(Int) to Int { 4 | var Read = 0; 5 | var Write = 1; 6 | var ReadWrite = 2; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TessellationControlShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TessellationControlShader = kha.graphics4.TessellationControlShader; 4 | -------------------------------------------------------------------------------- /updates.md: -------------------------------------------------------------------------------- 1 | * 2019-09-15: CompilerDefines was removed, if you're interested in it, please grab rblsb's fixed up version in https://github.com/Kode/Kha/pull/1010. 2 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/AudioClip.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.AudioClip') 4 | extern class AudioClip { 5 | public var length: Float; 6 | } 7 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/TessellationEvaluationShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | typedef TessellationEvaluationShader = kha.graphics4.TessellationEvaluationShader; 4 | -------------------------------------------------------------------------------- /Sources/kha/netsync/Sync.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | @:autoBuild(kha.network.SyncBuilder.build()) 4 | interface Sync { 5 | function _syncId(): Int; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Rect.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class Rect { 4 | public function new(x1 : Int, y1 : Int, x2 : Int, y2 : Int) : Void; 5 | } -------------------------------------------------------------------------------- /Backends/Empty/kha/input/MouseImpl.hx: -------------------------------------------------------------------------------- 1 | package kha.input; 2 | 3 | class MouseImpl extends kha.input.Mouse { 4 | public function new() { 5 | super(); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/UriKind.hx: -------------------------------------------------------------------------------- 1 | package system; 2 | 3 | @:native("System.UriKind") 4 | extern enum UriKind { 5 | RelativeOrAbsolute; 6 | Absolute; 7 | Relative; 8 | } -------------------------------------------------------------------------------- /Backends/WPF/system/UriKind.hx: -------------------------------------------------------------------------------- 1 | package system; 2 | 3 | @:native("System.UriKind") 4 | extern enum UriKind { 5 | RelativeOrAbsolute; 6 | Absolute; 7 | Relative; 8 | } -------------------------------------------------------------------------------- /Backends/Java/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class VertexShader { 6 | public function new(source: Blob) { } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Kore/kha/kore/graphics4/ShaderType.hx: -------------------------------------------------------------------------------- 1 | package kha.kore.graphics4; 2 | 3 | enum abstract ShaderType(Int) { 4 | var FragmentShader; 5 | var VertexShader; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class VertexShader { 6 | public function new(source: Blob) { } 7 | } 8 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-colored.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | in vec4 fragmentColor; 4 | out vec4 FragColor; 5 | 6 | void main() { 7 | FragColor = fragmentColor; 8 | } 9 | -------------------------------------------------------------------------------- /Sources/kha/graphics2/HorTextAlignment.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics2; 2 | 3 | enum abstract HorTextAlignment(Int) { 4 | var TextLeft; 5 | var TextCenter; 6 | var TextRight; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics2/VerTextAlignment.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics2; 2 | 3 | enum abstract VerTextAlignment(Int) { 4 | var TextTop; 5 | var TextMiddle; 6 | var TextBottom; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Color.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class Color { 4 | public static function argb(a : Int, r : Int, g : Int, b : Int) : Color; 5 | } -------------------------------------------------------------------------------- /Backends/Android/android/os/BaseBundle.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | import java.lang.Object; 4 | 5 | extern class BaseBundle { 6 | public function get(key: String): Object; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/os/BuildVERSION.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | @:native("android.os.Build.VERSION") 4 | extern class BuildVERSION { 5 | public static var SDK_INT: Int; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Android/android/text/method/MetaKeyKeyListener.hx: -------------------------------------------------------------------------------- 1 | package android.text.method; 2 | 3 | extern class MetaKeyKeyListener { 4 | public static var META_SHIFT_ON: Int; 5 | } 6 | -------------------------------------------------------------------------------- /Backends/Empty/kha/EnvironmentVariables.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class EnvironmentVariables { 4 | public static function get(name: String): String { 5 | return null; 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Java/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class FragmentShader { 6 | public function new(source: Blob) { } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/media/DrawingContext.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.DrawingContext") 4 | extern class DrawingContext { 5 | 6 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Vector2.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Vector2') 4 | extern class Vector2 { 5 | public function new(x: Single, y: Single); 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class FragmentShader { 6 | public function new(source: Blob) { } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/view/SurfaceHolderCallback.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | @:native("android.view.SurfaceHolder.Callback") 4 | extern interface SurfaceHolderCallback { 5 | 6 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/GameObject.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.GameObject') 4 | extern class GameObject { 5 | public function new(name: String) : Void; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Shader.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Shader') 4 | extern class Shader { 5 | public static function Find(name: String): Shader; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Texture.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Texture') 4 | extern class Texture { 5 | public var width: Int; 6 | public var height: Int; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/view/ViewOnTouchListener.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | @:native("android.view.View.OnTouchListener") 4 | extern interface ViewOnTouchListener { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.js.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public function new() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/kha/psm/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.psm.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public function new() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/io/Path.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.Path") 4 | extern class Path 5 | { 6 | public static function GetFullPath(path: String): String; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Vector3.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Vector3') 4 | extern class Vector3 { 5 | public function new(x: Single, y: Single, z: Single); 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/system/io/Path.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.Path") 4 | extern class Path 5 | { 6 | public static function GetFullPath(path: String): String; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/capture/VideoCapture.hx: -------------------------------------------------------------------------------- 1 | package kha.capture; 2 | 3 | extern class VideoCapture { 4 | public static function init(initialized: kha.Video->Void, error: Void->Void): Void; 5 | } 6 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/CullMode.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract CullMode(Int) to Int { 4 | var Clockwise = 0; 5 | var CounterClockwise = 1; 6 | var None = 2; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/network/HttpMethod.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | enum abstract HttpMethod(Int) to Int { 4 | var Get = 0; 5 | var Post = 1; 6 | var Put = 2; 7 | var Delete = 3; 8 | } 9 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/input/Mouse.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Mouse") 4 | extern class Mouse { 5 | public static var OverrideCursor : Cursor; 6 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Color.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Color') 4 | extern class Color { 5 | public function new(r: Single, g: Single, b: Single, a: Single); 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/input/Mouse.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Mouse") 4 | extern class Mouse { 5 | public static var OverrideCursor : Cursor; 6 | } -------------------------------------------------------------------------------- /Sources/kha/graphics4/TextureAddressing.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract TextureAddressing(Int) to Int { 4 | var Repeat = 0; 5 | var Mirror = 1; 6 | var Clamp = 2; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/internal/IntBox.hx: -------------------------------------------------------------------------------- 1 | package kha.internal; 2 | 3 | class IntBox { 4 | public var value: Int; 5 | 6 | public function new(value: Int) { 7 | this.value = value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Android/android/media/AudioFormat.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | extern class AudioFormat { 4 | public static var ENCODING_PCM_16BIT: Int; 5 | public static var CHANNEL_OUT_STEREO: Int; 6 | } -------------------------------------------------------------------------------- /Backends/Android/android/opengl/GLSurfaceViewRenderer.hx: -------------------------------------------------------------------------------- 1 | package android.opengl; 2 | 3 | @:native("android.opengl.GLSurfaceView.Renderer") 4 | extern interface GLSurfaceViewRenderer { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Screen.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Screen') 4 | extern class Screen { 5 | public static var height: Int; 6 | public static var width: Int; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Vector4.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Vector4') 4 | extern class Vector4 { 5 | public function new(x: Single, y: Single, z: Single, w: Single); 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.js.graphics4; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public function new() { 5 | 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/media/imaging/BitmapSource.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media.imaging; 2 | 3 | @:native("System.Windows.Media.Imaging.BitmapSource") 4 | extern class BitmapSource { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Texture2D.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Texture2D') 4 | extern class Texture2D extends Texture { 5 | public function new(width: Int, height: Int); 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/imaging/BitmapSource.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media.imaging; 2 | 3 | @:native("System.Windows.Media.Imaging.BitmapSource") 4 | extern class BitmapSource { 5 | 6 | } 7 | -------------------------------------------------------------------------------- /Sources/kha/graphics2/ImageScaleQuality.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics2; 2 | 3 | enum abstract ImageScaleQuality(Int) { 4 | var Low; // usually point filter 5 | var High; // usually bilinear filter 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Android/android/view/Window.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | extern class Window { 4 | public static var FEATURE_NO_TITLE : Int; 5 | public function setFlags(flags: Int, mask: Int): Void; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/compute/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | class TextureUnit { 4 | public var _unit:Pointer; 5 | 6 | public function new(unit: Pointer) { 7 | _unit = unit; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/system/io/Directory.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.Directory") 4 | extern class Directory 5 | { 6 | public static function CreateDirectory(path : String) : DirectoryInfo; 7 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Graphics.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Graphics') 4 | extern class Graphics { 5 | public static function DrawMeshNow(mesh: Mesh, matrix: Matrix4x4): Void; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/WPF/system/io/Directory.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | @:native("System.IO.Directory") 4 | extern class Directory 5 | { 6 | public static function CreateDirectory(path : String) : DirectoryInfo; 7 | } -------------------------------------------------------------------------------- /Sources/kha/graphics4/TextureFilter.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract TextureFilter(Int) to Int { 4 | var PointFilter = 0; 5 | var LinearFilter = 1; 6 | var AnisotropicFilter = 2; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Typeface.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class Typeface { 4 | public static var NORMAL : Int; 5 | public static function create(name : String, type : Int) : Typeface; 6 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/ImageSource.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.ImageSource") 4 | extern class ImageSource { 5 | public function new() { 6 | 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/Window.hx: -------------------------------------------------------------------------------- 1 | package system.windows; 2 | 3 | @:native("System.Windows.Window") 4 | extern class Window extends FrameworkElement { 5 | public function AddChild(child : FrameworkElement) : Void; 6 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/Window.hx: -------------------------------------------------------------------------------- 1 | package system.windows; 2 | 3 | @:native("System.Windows.Window") 4 | extern class Window extends FrameworkElement { 5 | public function AddChild(child : FrameworkElement) : Void; 6 | } -------------------------------------------------------------------------------- /Backends/Android/android/graphics/BitmapFactory.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | import java.io.InputStream; 4 | 5 | extern class BitmapFactory { 6 | public static function decodeStream(stream : InputStream) : Bitmap; 7 | } -------------------------------------------------------------------------------- /Backends/Java/kha/java/Graphics.hx: -------------------------------------------------------------------------------- 1 | package kha.java; 2 | 3 | class Graphics { 4 | public function new() { 5 | 6 | } 7 | 8 | public function maxTextureSize(): Int { 9 | return 4096; 10 | } 11 | 12 | 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/GL.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.GL') 4 | extern class GL { 5 | public static function Clear(clearDepth: Bool, clearColor: Bool, backgroundColor: Color, depth: Single): Void; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Android/android/view/WindowManagerLayoutParams.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | @:native("android.view.WindowManager.LayoutParams") 4 | extern class WindowManagerLayoutParams { 5 | public static var FLAG_FULLSCREEN: Int; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/compute/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | class ConstantLocation { 4 | public var _location: Pointer; 5 | 6 | public function new(location: Pointer) { 7 | _location = location; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/Matrix4.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core; 2 | 3 | /** 4 | * ... 5 | * @author Robert 6 | */ 7 | class Matrix4 8 | { 9 | 10 | public function new() 11 | { 12 | 13 | } 14 | 15 | } -------------------------------------------------------------------------------- /Backends/PSM/system/windows/FrameworkElement.hx: -------------------------------------------------------------------------------- 1 | package system.windows; 2 | import system.windows.input.Cursor; 3 | 4 | @:native("System.Windows.FrameworkElement") 5 | extern class FrameworkElement { 6 | public var Cursor : Cursor; 7 | } -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Input.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Input') 4 | extern class Input { 5 | public static function GetKeyDown(name: String): Bool; 6 | public static function GetKeyUp(name: String): Bool; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/Usage.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract Usage(Int) to Int { 4 | var StaticUsage = 0; 5 | var DynamicUsage = 1; // Just calling it Dynamic causes problems in C++ 6 | var ReadableUsage = 2; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/view/KeyCharacterMap.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | extern class KeyCharacterMap { 4 | public static function load(deviceId: Int): KeyCharacterMap; 5 | public function get(keyCode: Int, metaState: Int): Int; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/Flash/kha/flash/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.flash.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public var unit: Int; 5 | 6 | public function new() { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/controls/MediaState.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | 3 | @:native("System.Windows.Controls.MediaState") 4 | extern enum MediaState { 5 | Manual; 6 | Play; 7 | Close; 8 | Pause; 9 | Stop; 10 | } -------------------------------------------------------------------------------- /Backends/Unity/kha/unity/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.unity; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public var name: String; 5 | 6 | public function new(name: String) { 7 | this.name = name; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/controls/MediaState.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | 3 | @:native("System.Windows.Controls.MediaState") 4 | extern enum MediaState { 5 | Manual; 6 | Play; 7 | Close; 8 | Pause; 9 | Stop; 10 | } -------------------------------------------------------------------------------- /Backends/Unity/kha/unity/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.unity; 2 | 3 | class Sound extends kha.Sound { 4 | public var filename: String; 5 | 6 | public function new(filename: String): Void { 7 | super(); 8 | this.filename = filename; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/BlendingOperation.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract BlendingOperation(Int) to Int { 4 | var Add = 0; 5 | var Subtract = 1; 6 | var ReverseSubtract = 2; 7 | var Min = 3; 8 | var Max = 4; 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Android/android/opengl/GLES11Ext.hx: -------------------------------------------------------------------------------- 1 | package android.opengl; 2 | 3 | class GLES11Ext { 4 | public static var GL_DEPTH_STENCIL_OES: Int; 5 | public static var GL_DEPTH24_STENCIL8_OES: Int; 6 | public static var GL_UNSIGNED_INT_24_8_OES: Int; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/BlendFuncMode.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.BlendFuncMode") 4 | extern enum BlendFuncMode { 5 | Add; 6 | Subtract; 7 | ReverseSubtract; 8 | } 9 | -------------------------------------------------------------------------------- /Backends/Android/android/media/MediaFormat.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | extern class MediaFormat { 4 | public function getInteger(name: String): Int; 5 | 6 | public static var KEY_CHANNEL_COUNT: String; 7 | public static var KEY_SAMPLE_RATE: String; 8 | } -------------------------------------------------------------------------------- /Backends/Unity/kha/unity/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.unity; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public var name: String; 5 | 6 | public function new(name: String) { 7 | this.name = name; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/DrawingVisual.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.DrawingVisual") 4 | extern class DrawingVisual { 5 | public function new(); 6 | public function RenderOpen(): DrawingContext; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/FastFloat.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | #if cpp 4 | typedef FastFloat = cpp.Float32; 5 | #elseif hl 6 | typedef FastFloat = hl.F32; 7 | #elseif java 8 | typedef FastFloat = Single; 9 | #else 10 | typedef FastFloat = Float; 11 | #end 12 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/js/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.js.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public var value: Int; 5 | 6 | public function new(value: Int) { 7 | this.value = value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Android/android/os/VibratorEffect.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | extern class VibrationEffect implements Parcelable { 4 | public static var DEFAULT_AMPLITUDE: Int; 5 | public function createOneShot(ms: haxe.Int64, amplitude: Int): VibrationEffect; 6 | } 7 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/controls/Canvas.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | 3 | import system.windows.FrameworkElement; 4 | 5 | @:native("System.Windows.Controls.Canvas") 6 | extern class Canvas extends FrameworkElement { 7 | public function new(): Void; 8 | } -------------------------------------------------------------------------------- /Backends/PSM/system/windows/input/Cursors.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Cursors") 4 | extern class Cursors { 5 | public static var Arrow : Cursor; 6 | public static var Hand : Cursor; 7 | public static var Wait : Cursor; 8 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/controls/Canvas.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | 3 | import system.windows.FrameworkElement; 4 | 5 | @:native("System.Windows.Controls.Canvas") 6 | extern class Canvas extends FrameworkElement { 7 | public function new(): Void; 8 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/input/Cursors.hx: -------------------------------------------------------------------------------- 1 | package system.windows.input; 2 | 3 | @:native("System.Windows.Input.Cursors") 4 | extern class Cursors { 5 | public static var Arrow : Cursor; 6 | public static var Hand : Cursor; 7 | public static var Wait : Cursor; 8 | } -------------------------------------------------------------------------------- /Backends/Android/android/os/Vibrator.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | extern class Vibrator { 4 | @:overload(function(arg0: haxe.Int64): Void {}) 5 | public function vibrate(arg0: java.NativeArray, arg1: Int): Void; 6 | public function cancel(): Void; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/korehl/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.korehl.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public var _unit: Pointer; 5 | 6 | public function new(unit: Pointer) { 7 | _unit = unit; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/RenderTexture.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.RenderTexture') 4 | extern class RenderTexture extends Texture { 5 | public function new(width: Int, height: Int, depth: Int); 6 | public static var active: RenderTexture; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/MipMapFilter.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract MipMapFilter(Int) to Int { 4 | var NoMipFilter = 0; 5 | var PointMipFilter = 1; 6 | var LinearMipFilter = 2; // linear texture filter + linear mip filter -> trilinear filter 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/kha/android/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.android.graphics4; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | public var value: Int; 5 | 6 | public function new(value: Int) { 7 | this.value = value; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/VertexFormat.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.VertexFormat") 4 | extern enum VertexFormat { 5 | None; 6 | Float; 7 | Float2; 8 | Float3; 9 | Float4; 10 | } 11 | -------------------------------------------------------------------------------- /Sources/kha/capture/AudioCapture.hx: -------------------------------------------------------------------------------- 1 | package kha.capture; 2 | 3 | import kha.audio2.Buffer; 4 | 5 | extern class AudioCapture { 6 | public static var audioCallback: Int->Buffer->Void; 7 | public static function init(initialized: Void->Void, error: Void->Void): Void; 8 | } 9 | -------------------------------------------------------------------------------- /Backends/Unity/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class Storage { 4 | public static function namedFile(name: String): StorageFile { 5 | return null; 6 | } 7 | 8 | public static function defaultFile(): StorageFile { 9 | return namedFile("default.kha"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Unity/kha/audio1/UnityMusicChannel.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | class UnityMusicChannel extends UnitySoundChannel implements kha.audio1.MusicChannel { 4 | public function new(filename: String, looping: Bool) { 5 | super(filename); 6 | source.loop = looping; 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/DrawingContext.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.DrawingContext") 4 | extern class DrawingContext { 5 | public function PushTransform(transform: MatrixTransform): Void; 6 | public function Pop(): Void; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/ScreenRotation.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | /** 4 | * Enum with all the possible rotations. 5 | */ 6 | enum abstract ScreenRotation(Int) { 7 | var RotationNone = 0; 8 | var Rotation90 = 90; 9 | var Rotation180 = 180; 10 | var Rotation270 = 270; 11 | } 12 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/VertexData.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract VertexData(Int) { 4 | var Float1 = 0; 5 | var Float2 = 1; 6 | var Float3 = 2; 7 | var Float4 = 3; 8 | var Float4x4 = 4; 9 | var Short2Norm = 5; 10 | var Short4Norm = 6; 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Android/android/content/res/AssetManager.hx: -------------------------------------------------------------------------------- 1 | package android.content.res; 2 | 3 | import java.io.InputStream; 4 | 5 | extern class AssetManager { 6 | public function openFd(filename : String) : AssetFileDescriptor; 7 | public function open(filename : String) : InputStream; 8 | } -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/html5worker/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.html5worker; 2 | 3 | class TextureUnit implements kha.graphics4.TextureUnit { 4 | static var lastId: Int = -1; 5 | public var _id: Int; 6 | 7 | public function new() { 8 | _id = ++lastId; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/MatrixTransform.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.MatrixTransform") 4 | extern class MatrixTransform { 5 | public function new(m11: Float, m12: Float, m21: Float, m22: Float, offsetX: Float, offsetY: Float); 6 | } 7 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-text.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | uniform sampler2D tex; 4 | in vec2 texCoord; 5 | in vec4 fragmentColor; 6 | out vec4 FragColor; 7 | 8 | void main() { 9 | FragColor = vec4(fragmentColor.rgb, texture(tex, texCoord).r * fragmentColor.a); 10 | } 11 | -------------------------------------------------------------------------------- /Sources/kha/audio2/ogg/vorbis/data/IntPoint.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2.ogg.vorbis.data; 2 | 3 | /** 4 | * ... 5 | * @author shohei909 6 | */ 7 | class IntPoint 8 | { 9 | public var x:Int; 10 | public var y:Int; 11 | 12 | public function new() { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/PSM/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class Storage { 4 | public static function namedFile(name: String): StorageFile { 5 | return null; 6 | } 7 | 8 | public static function defaultFile(): StorageFile { 9 | return namedFile("default.kha"); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Backends/PSM/kha/psm/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.psm.graphics4; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public var location: Int; 5 | 6 | public function new(location: Int) { 7 | this.location = location; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Tests/MultiWindow/Sources/Primary.hx: -------------------------------------------------------------------------------- 1 | class Primary { 2 | public function new( id : Int ) { 3 | kha.System.notifyOnRender(render, id); 4 | } 5 | 6 | function render( framebuffer : kha.Framebuffer ) { 7 | framebuffer.g2.begin(kha.Color.Red); 8 | framebuffer.g2.end(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Backends/Android/android/opengl/Matrix.hx: -------------------------------------------------------------------------------- 1 | package android.opengl; 2 | 3 | import java.NativeArray; 4 | 5 | extern class Matrix { 6 | public static function orthoM(matrix : NativeArray, x : Int, y : Int, width : Int, height : Int, unknown : Int, znear : Single, zfar : Single) : Void; 7 | } -------------------------------------------------------------------------------- /Backends/Android/android/widget/LinearLayout.hx: -------------------------------------------------------------------------------- 1 | package android.widget; 2 | 3 | import android.app.Activity; 4 | import android.view.View; 5 | 6 | extern class LinearLayout extends View { 7 | public function new(activity : Activity) : Void; 8 | public function addView(view : View) : Void; 9 | } -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/DrawMode.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.DrawMode") 4 | extern enum DrawMode { 5 | Points; 6 | Lines; 7 | LineStrip; 8 | Triangles; 9 | TriangleStrip; 10 | TriangleFan; 11 | } 12 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/FrameworkElement.hx: -------------------------------------------------------------------------------- 1 | package system.windows; 2 | import system.windows.input.Cursor; 3 | 4 | @:native("System.Windows.FrameworkElement") 5 | extern class FrameworkElement { 6 | public var Cursor: Cursor; 7 | public var Width: Float; 8 | public var Height: Float; 9 | } -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/html5worker/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.html5worker; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | static var lastId: Int = -1; 5 | public var _id: Int; 6 | 7 | public function new() { 8 | _id = ++lastId; 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Backends/PSM/kha/psm/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.psm; 2 | 3 | import kha.SoundChannel; 4 | 5 | class Sound extends kha.Sound { 6 | public function new(filename: String) { 7 | super(); 8 | } 9 | 10 | override public function play(): SoundChannel { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/ShaderProgram.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.ShaderProgram") 4 | extern class ShaderProgram { 5 | public function new(fileName: String); 6 | public function FindUniform(name: String): Int; 7 | } 8 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/VertexElement.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class VertexElement { 4 | public var name: String; 5 | public var data: VertexData; 6 | 7 | public function new(name: String, data: VertexData) { 8 | this.name = name; 9 | this.data = data; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Tests/MultiWindow/Sources/Secondary1.hx: -------------------------------------------------------------------------------- 1 | class Secondary1 { 2 | public function new( id : Int ) { 3 | kha.System.notifyOnRender(render, id); 4 | } 5 | 6 | function render( framebuffer : kha.Framebuffer ) { 7 | framebuffer.g2.begin(kha.Color.Green); 8 | framebuffer.g2.end(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Tests/MultiWindow/Sources/Secondary2.hx: -------------------------------------------------------------------------------- 1 | class Secondary2 { 2 | public function new( id : Int ) { 3 | kha.System.notifyOnRender(render, id); 4 | } 5 | 6 | function render( framebuffer : kha.Framebuffer ) { 7 | framebuffer.g2.begin(kha.Color.Blue); 8 | framebuffer.g2.end(); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Backends/Android/android/media/MediaPlayerOnCompletionListener.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | import android.media.MediaPlayer; 4 | 5 | @:native("android.media.MediaPlayer.OnCompletionListener") 6 | extern interface MediaPlayerOnCompletionListener { 7 | public function onCompletion(mp: MediaPlayer): Void; 8 | } -------------------------------------------------------------------------------- /Backends/KoreHL/kha/korehl/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.korehl.graphics4; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public var _location: Pointer; 5 | 6 | public function new(location: Pointer) { 7 | _location = location; 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/Texture2D.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.Texture2D") 4 | extern class Texture2D { 5 | public function new(filename: String, unknown: Bool); 6 | public var Width: Int; 7 | public var Height: Int; 8 | } 9 | -------------------------------------------------------------------------------- /Backends/PSM/system/diagnostics/Stopwatch.hx: -------------------------------------------------------------------------------- 1 | package system.diagnostics; 2 | 3 | import haxe.Int64; 4 | 5 | @:native("System.Diagnostics.Stopwatch") 6 | extern class Stopwatch { 7 | public function new(): Void; 8 | public function Start(): Void; 9 | public var ElapsedMilliseconds: Int64; 10 | } -------------------------------------------------------------------------------- /Backends/Unity/system/diagnostics/Stopwatch.hx: -------------------------------------------------------------------------------- 1 | package system.diagnostics; 2 | 3 | import haxe.Int64; 4 | 5 | @:native("System.Diagnostics.Stopwatch") 6 | extern class Stopwatch { 7 | public function new(): Void; 8 | public function Start(): Void; 9 | public var ElapsedMilliseconds: Int64; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/WPF/system/diagnostics/Stopwatch.hx: -------------------------------------------------------------------------------- 1 | package system.diagnostics; 2 | 3 | import haxe.Int64; 4 | 5 | @:native("System.Diagnostics.Stopwatch") 6 | extern class Stopwatch { 7 | public function new(): Void; 8 | public function Start(): Void; 9 | public var ElapsedMilliseconds: Int64; 10 | } -------------------------------------------------------------------------------- /Sources/Shaders/painter-image.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | uniform sampler2D tex; 4 | in vec2 texCoord; 5 | in vec4 color; 6 | out vec4 FragColor; 7 | 8 | void main() { 9 | vec4 texcolor = texture(tex, texCoord) * color; 10 | texcolor.rgb *= color.a; 11 | FragColor = texcolor; 12 | } 13 | -------------------------------------------------------------------------------- /Sources/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | import kha.Sound; 4 | 5 | extern class Audio { 6 | public static function play(sound: Sound, loop: Bool = false): AudioChannel; 7 | 8 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel; 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Kore/kha/compute/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:headerClassCode("Kore::ComputeTextureUnit unit;") 9 | class TextureUnit { 10 | public function new() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-video.frag.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | uniform samplerVideo tex; 4 | in vec2 texCoord; 5 | in vec4 color; 6 | out vec4 FragColor; 7 | 8 | void main() { 9 | vec4 texcolor = texture(tex, texCoord) * color; 10 | texcolor.rgb *= color.a; 11 | FragColor = texcolor; 12 | } 13 | -------------------------------------------------------------------------------- /Sources/kha/Rotation.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import kha.math.Vector2; 4 | 5 | class Rotation { 6 | public var center: Vector2; 7 | public var angle: Float; 8 | 9 | public function new(center: Vector2, angle: Float) { 10 | this.center = center; 11 | this.angle = angle; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/StringExtensions.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class StringExtensions { 4 | public static function toCharArray(s: String): Array { 5 | var results = new Array(); 6 | for (i in 0...s.length) { 7 | results.push(s.charCodeAt(i)); 8 | } 9 | return results; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/kha/WindowMode.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | @:enum 4 | abstract WindowMode(Int) { 5 | var Windowed = 0; // Use an ordinary window 6 | var Fullscreen = 1; // Regular fullscreen mode 7 | var ExclusiveFullscreen = 2; // Exclusive fullscreen mode (switches monitor resolution, Windows only) 8 | } 9 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/CompareMode.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract CompareMode(Int) to Int { 4 | var Always = 0; 5 | var Never = 1; 6 | var Equal = 2; 7 | var NotEqual = 3; 8 | var Less = 4; 9 | var LessEqual = 5; 10 | var Greater = 6; 11 | var GreaterEqual = 7; 12 | } 13 | -------------------------------------------------------------------------------- /Backends/Android/android/content/ServiceConnection.hx: -------------------------------------------------------------------------------- 1 | package android.content; 2 | 3 | import android.os.IBinder; 4 | 5 | extern interface ServiceConnection { 6 | public function onServiceDisconnected(name: ComponentName): Void; 7 | public function onServiceConnected(name: ComponentName, service: IBinder): Void; 8 | } 9 | -------------------------------------------------------------------------------- /Sources/kha/netsync/Client.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | interface Client { 6 | var id(get, null): Int; 7 | function send(bytes: Bytes, mandatory: Bool): Void; 8 | function receive(receiver: Bytes->Void): Void; 9 | function onClose(close: Void->Void): Void; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/Kore/kha/capture/AudioCapture.hx: -------------------------------------------------------------------------------- 1 | package kha.capture; 2 | 3 | import kha.audio2.Buffer; 4 | 5 | class AudioCapture { 6 | public static var audioCallback: Int->Buffer->Void; 7 | 8 | public static function init(initialized: Void->Void, error: Void->Void): Void { 9 | error(); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-colored.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | in vec3 vertexPosition; 4 | in vec4 vertexColor; 5 | uniform mat4 projectionMatrix; 6 | out vec4 fragmentColor; 7 | 8 | void main() { 9 | gl_Position = projectionMatrix * vec4(vertexPosition, 1.0); 10 | fragmentColor = vertexColor; 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Android/android/net/Uri.hx: -------------------------------------------------------------------------------- 1 | package android.net; 2 | 3 | import android.os.Parcelable; 4 | import java.lang.Comparable; 5 | 6 | extern class Uri implements Parcelable implements Comparable { 7 | public static function parse(uriString: String): Uri; 8 | public function compareTo(another: Uri): Int; 9 | } 10 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/StencilAction.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract StencilAction(Int) to Int { 4 | var Keep = 0; 5 | var Zero = 1; 6 | var Replace = 2; 7 | var Increment = 3; 8 | var IncrementWrap = 4; 9 | var Decrement = 5; 10 | var DecrementWrap = 6; 11 | var Invert = 7; 12 | } 13 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/TextureFormat.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract TextureFormat(Int) to Int { 4 | var RGBA32 = 0; 5 | var L8 = 1; 6 | var RGBA128 = 2; // Floats 7 | var DEPTH16 = 3; 8 | var RGBA64 = 4; // Half floats 9 | var A32 = 5; // Float 10 | var A16 = 6; // Half float 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Android/kha/android/Keyboard.hx: -------------------------------------------------------------------------------- 1 | package kha.android; 2 | 3 | @:allow(kha.SystemImpl) 4 | class Keyboard extends kha.input.Keyboard { 5 | override public function show() { 6 | SystemImpl.showKeyboard = true; 7 | } 8 | 9 | override public function hide() { 10 | SystemImpl.showKeyboard = false; 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/Macros.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.macro.Context; 4 | import haxe.macro.Expr; 5 | 6 | class Macros { 7 | public static macro function canvasId(): Expr { 8 | return { 9 | expr: EConst(CString(Context.getDefines().get("canvas_id"))), 10 | pos: Context.currentPos() 11 | }; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Kore/kha/compute/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:headerClassCode("Kore::ComputeConstantLocation location;") 9 | class ConstantLocation { 10 | public function new() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/PSM/kha/psm/Music.hx: -------------------------------------------------------------------------------- 1 | package kha.psm; 2 | 3 | class Music extends kha.Music { 4 | public function new(filename: String) { 5 | super(); 6 | } 7 | 8 | override public function play(loop: Bool = false): Void { 9 | 10 | } 11 | 12 | override public function stop(): Void { 13 | 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Node/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class VertexShader { 6 | public function new(sources: Array, files: Array) { 7 | 8 | } 9 | 10 | public static function fromSource(source: String): VertexShader { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | extern class Http { 6 | public static function request(url: String, path: String, data: String, port: Int, secure: Bool, method: HttpMethod, headers: Map, callback: Int->Int->String->Void /*error, response, body*/): Void; 7 | } 8 | -------------------------------------------------------------------------------- /Backends/Android/android/media/SoundPoolOnLoadCompleteListener.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | import android.media.SoundPool; 4 | 5 | @:native("android.media.SoundPool.OnLoadCompleteListener") 6 | extern interface SoundPoolOnLoadCompleteListener { 7 | public function onLoadComplete(soundPool: SoundPool, sampleId: Int, status:Int): Void; 8 | } -------------------------------------------------------------------------------- /Backends/Node/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class FragmentShader { 6 | public function new(sources: Array, files: Array) { 7 | 8 | } 9 | 10 | public static function fromSource(source: String): FragmentShader { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Matrix4x4.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Matrix4x4') 4 | extern class Matrix4x4 { 5 | public static var identity: Matrix4x4; 6 | public static var zero: Matrix4x4; 7 | public function SetColumn(i: Int, v: Vector4): Void; 8 | public function SetRow(i: Int, v: Vector4): Void; 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Bitmap.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | import java.nio.Buffer; 4 | 5 | extern class Bitmap { 6 | public function getWidth() : Int; 7 | public function getHeight() : Int; 8 | public function getPixel(x : Int, y : Int) : Int; 9 | public function copyPixelsToBuffer(buffer : Buffer) : Void; 10 | } -------------------------------------------------------------------------------- /Backends/Android/android/view/SurfaceHolder.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | import android.graphics.Canvas; 4 | 5 | extern class SurfaceHolder { 6 | public function lockCanvas(canvas : Canvas) : Canvas; 7 | public function unlockCanvasAndPost(canvas : Canvas) : Void; 8 | public function addCallback(callb : SurfaceHolderCallback) : Void; 9 | } -------------------------------------------------------------------------------- /Backends/Android/kha/android/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.android.graphics4; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public var value: Int; 5 | public var type: Int; 6 | 7 | public function new(value: Int, type: Int) { 8 | this.value = value; 9 | this.type = type; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/kha/Resource.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | /** 4 | * Interface representing a generic application resource. 5 | * It can go from images, to sound or music, videos or blobs. 6 | */ 7 | interface Resource { 8 | /** 9 | * Unload the resource from memory. Normally called by the Loader. 10 | */ 11 | function unload(): Void; 12 | } -------------------------------------------------------------------------------- /Sources/kha/netsync/Entity.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | @:autoBuild(kha.netsync.EntityBuilder.build()) 6 | interface Entity { 7 | function _id(): Int; 8 | function _size(): Int; 9 | function _send(offset: Int, bytes: Bytes): Int; 10 | function _receive(offset: Int, bytes: Bytes): Int; 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Android/android/view/SurfaceView.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | import android.content.Context; 4 | 5 | extern class SurfaceView extends View { 6 | public function new(context: Context): Void; 7 | public function getHolder(): SurfaceHolder; 8 | public function getWidth(): Int; 9 | public function getHeight(): Int; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/Empty/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Http { 6 | 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 { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/js/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.js.graphics4; 2 | 3 | class ConstantLocation implements kha.graphics4.ConstantLocation { 4 | public var value: Dynamic; 5 | public var type: Int; 6 | 7 | public function new(value: Dynamic, type: Int) { 8 | this.value = value; 9 | this.type = type; 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Http { 6 | 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 { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Krom/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Http { 6 | 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 { 7 | 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/EnableMode.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.EnableMode") 4 | extern enum EnableMode { 5 | None; 6 | ScissorTest; 7 | CullFace; 8 | Blend; 9 | DepthTest; 10 | PolygonOffsetFill; 11 | StencilTest; 12 | Dither; 13 | All; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/compute/Shader.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | import kha.Blob; 4 | 5 | extern class Shader { 6 | public function new(source: Blob, file: String); 7 | public function delete(): Void; 8 | public function getConstantLocation(name: String): ConstantLocation; 9 | public function getTextureUnit(name: String): TextureUnit; 10 | } 11 | -------------------------------------------------------------------------------- /Sources/kha/netsync/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | extern class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void); 7 | public function send(bytes: Bytes, mandatory: Bool): Void; 8 | public function listen(listener: Bytes->Void): Void; 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Flash/kha/network/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) {} 7 | public function send(bytes: Bytes, mandatory: Bool): Void {} 8 | public function listen(listener: Bytes->Void): Void {} 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/Music.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | import js.Browser; 4 | import js.html.AudioElement; 5 | import js.html.ErrorEvent; 6 | import js.html.Event; 7 | import js.html.MediaError; 8 | import js.Lib; 9 | 10 | using StringTools; 11 | 12 | class Music extends kha.Music { 13 | public function new() { 14 | super(); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Backends/Unity/kha/netsync/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) {} 7 | 8 | public function send(bytes: Bytes, mandatory: Bool): Void {} 9 | 10 | public function listen(listener: Bytes->Void): Void {} 11 | } 12 | -------------------------------------------------------------------------------- /Sources/kha/netsync/Example.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | class Example implements Entity { 4 | @replicated 5 | private var test: Float; 6 | @replicated 7 | private var bla: Int; 8 | 9 | public function new() { 10 | //super(); 11 | test = 3; 12 | } 13 | 14 | public function simulate(tdif: Float): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/Kore/kha/kore/graphics4/TextureUnit.hx: -------------------------------------------------------------------------------- 1 | package kha.kore.graphics4; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:headerClassCode("Kore::Graphics4::TextureUnit unit;") 9 | class TextureUnit implements kha.graphics4.TextureUnit { 10 | public function new() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/vr/Pose.hx: -------------------------------------------------------------------------------- 1 | package kha.vr; 2 | 3 | import kha.math.Quaternion; 4 | import kha.math.Vector3; 5 | 6 | // Position and orientation together. 7 | class Pose { 8 | public var Orientation: Quaternion; 9 | public var Position: Vector3; 10 | 11 | public function new() { 12 | Orientation = new Quaternion(); 13 | Position = new Vector3(); 14 | } 15 | } -------------------------------------------------------------------------------- /Backends/Android/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Http { 6 | 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 { 7 | callback(0, 404, ""); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Flash/kha/input/MouseImpl.hx: -------------------------------------------------------------------------------- 1 | package kha.input; 2 | 3 | class MouseImpl extends Mouse { 4 | public function new() { 5 | super(); 6 | } 7 | 8 | public override function hideSystemCursor(): Void { 9 | flash.ui.Mouse.hide(); 10 | } 11 | 12 | public override function showSystemCursor(): Void { 13 | flash.ui.Mouse.show(); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/WPF/kha/network/Http.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Http { 6 | 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 { 7 | callback(418, 418, null); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | extern class VertexShader { 6 | public function new(source: Blob, file: String); 7 | public function delete(): Void; 8 | 9 | /** 10 | Beware: This function is not portable. 11 | **/ 12 | public static function fromSource(source: String): VertexShader; 13 | } 14 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-image.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | in vec3 vertexPosition; 4 | in vec2 texPosition; 5 | in vec4 vertexColor; 6 | uniform mat4 projectionMatrix; 7 | out vec2 texCoord; 8 | out vec4 color; 9 | 10 | void main() { 11 | gl_Position = projectionMatrix * vec4(vertexPosition, 1.0); 12 | texCoord = texPosition; 13 | color = vertexColor; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-video.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | in vec3 vertexPosition; 4 | in vec2 texPosition; 5 | in vec4 vertexColor; 6 | uniform mat4 projectionMatrix; 7 | out vec2 texCoord; 8 | out vec4 color; 9 | 10 | void main() { 11 | gl_Position = projectionMatrix * vec4(vertexPosition, 1.0); 12 | texCoord = texPosition; 13 | color = vertexColor; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | extern class FragmentShader { 6 | public function new(source: Blob, file: String); 7 | public function delete(): Void; 8 | 9 | /** 10 | Beware: This function is not portable. 11 | **/ 12 | public static function fromSource(source: String): FragmentShader; 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | extern class PipelineState extends PipelineStateBase { 4 | public function new(); 5 | public function delete(): Void; 6 | public function compile(): Void; 7 | public function getConstantLocation(name: String): ConstantLocation; 8 | public function getTextureUnit(name: String): TextureUnit; 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Empty/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.io.Bytes; 4 | import haxe.io.BytesBuffer; 5 | import haxe.io.BytesData; 6 | 7 | class Storage { 8 | public static function namedFile(name: String): StorageFile { 9 | return null; 10 | } 11 | 12 | public static function defaultFile(): StorageFile { 13 | return namedFile("default.kha"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Kore/kha/kore/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.kore.graphics4; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:headerClassCode("Kore::Graphics4::ConstantLocation location;") 9 | class ConstantLocation implements kha.graphics4.ConstantLocation { 10 | public function new() { 11 | 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.io.Bytes; 4 | import haxe.io.BytesBuffer; 5 | import haxe.io.BytesData; 6 | 7 | class Storage { 8 | public static function namedFile(name: String): StorageFile { 9 | return null; 10 | } 11 | 12 | public static function defaultFile(): StorageFile { 13 | return namedFile("default.kha"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Node/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.io.Bytes; 4 | import haxe.io.BytesData; 5 | import js.html.ArrayBuffer; 6 | 7 | class Storage { 8 | public static function namedFile(name: String): StorageFile { 9 | return null; 10 | } 11 | 12 | public static function defaultFile(): StorageFile { 13 | return namedFile("default.kha"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Unity/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class VertexShader { 6 | public var shader: Dynamic; 7 | public var name: String; 8 | 9 | public function new(sources: Array, names: Array) { 10 | if (sources != null) { 11 | shader = sources[0].bytes.getData(); 12 | name = names[0]; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Android/android/opengl/GLUtils.hx: -------------------------------------------------------------------------------- 1 | package android.opengl; 2 | 3 | import android.graphics.Bitmap; 4 | 5 | extern class GLUtils { 6 | public static function texImage2D(textype: Int, unknown1: Int, bitmap: Bitmap, unknown2: Int): Void; 7 | public static function texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, bitmap: Bitmap, format: Int, type: Int): Void; 8 | } 9 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/Storage.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.io.Bytes; 4 | import haxe.io.BytesData; 5 | import js.lib.ArrayBuffer; 6 | 7 | class Storage { 8 | public static function namedFile(name: String): StorageFile { 9 | return null; 10 | } 11 | 12 | public static function defaultFile(): StorageFile { 13 | return namedFile("default.kha"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Unity/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | class FragmentShader { 6 | public var shader: Dynamic; 7 | public var name: String; 8 | 9 | public function new(sources: Array, names: Array) { 10 | if (sources != null) { 11 | shader = sources[0].bytes.getData(); 12 | name = names[0]; 13 | } 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Node/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | import kha.Sound; 4 | 5 | class Audio { 6 | 7 | public static function play(sound: Sound, loop: Bool = false): AudioChannel { 8 | return new NodeAudioChannel(); 9 | } 10 | 11 | public static function stream(sound: Sound, loop: Bool = false): AudioChannel { 12 | return new NodeAudioChannel(); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Sources/Shaders/painter-text.vert.glsl: -------------------------------------------------------------------------------- 1 | #version 450 2 | 3 | in vec3 vertexPosition; 4 | in vec2 texPosition; 5 | in vec4 vertexColor; 6 | uniform mat4 projectionMatrix; 7 | out vec2 texCoord; 8 | out vec4 fragmentColor; 9 | 10 | void main() { 11 | gl_Position = projectionMatrix * vec4(vertexPosition, 1.0); 12 | texCoord = texPosition; 13 | fragmentColor = vertexColor; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/GeometryShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | #if cpp 6 | extern class GeometryShader { 7 | public function new(source: Blob); 8 | public function delete(): Void; 9 | } 10 | #else 11 | class GeometryShader { 12 | public function new(source: Blob) { 13 | 14 | } 15 | 16 | public function delete(): Void { 17 | 18 | } 19 | } 20 | #end 21 | -------------------------------------------------------------------------------- /Backends/Empty/kha/audio2/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2; 2 | 3 | import kha.Sound; 4 | import kha.internal.IntBox; 5 | 6 | class Audio { 7 | public static var disableGcInteractions = false; 8 | public static var audioCallback: IntBox->Buffer->Void; 9 | 10 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/compute/ShaderStorageBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | import kha.graphics4.VertexData; 4 | 5 | extern class ShaderStorageBuffer { 6 | public function new(indexCount: Int, type: VertexData); 7 | public function delete(): Void; 8 | public function lock(): Array; 9 | public function unlock(): Void; 10 | public function set(): Void; 11 | public function count(): Int; 12 | } 13 | -------------------------------------------------------------------------------- /Backends/Java/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class IndexBuffer { 4 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false) { } 5 | public function lock(?start: Int, ?count: Int): Array { return null; } 6 | public function unlock(?count: Int): Void { } 7 | public function set(): Void { } 8 | public function count(): Int { return 0; } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Krom/kha/graphics4/GeometryShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class GeometryShader { 4 | public var shader: Dynamic; 5 | 6 | public function new(sources: Array, names: Array) { 7 | shader = Krom.createGeometryShader(sources[0].bytes.getData(), names[0]); 8 | } 9 | 10 | public function delete() { 11 | Krom.deleteShader(shader); 12 | shader = null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Backends/WPF/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class IndexBuffer { 4 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false) { } 5 | public function lock(?start: Int, ?count: Int): Array { return null; } 6 | public function unlock(?count: Int): Void { } 7 | public function set(): Void { } 8 | public function count(): Int { return 0; } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Android/android/content/res/AssetFileDescriptor.hx: -------------------------------------------------------------------------------- 1 | package android.content.res; 2 | import haxe.Int64; 3 | import java.io.FileDescriptor; 4 | 5 | extern class AssetFileDescriptor { 6 | public function getFileDescriptor() : FileDescriptor; 7 | public function getStartOffset() : Int; 8 | public function getLength() : Int; 9 | public function createInputStream(): java.io.FileInputStream; 10 | } -------------------------------------------------------------------------------- /Backends/Android/android/media/AudioTrackOnPlaybackPositionUpdateListener.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | import android.media.AudioTrack; 4 | 5 | @:native("android.media.AudioTrack.OnPlaybackPositionUpdateListener") 6 | extern interface AudioTrackOnPlaybackPositionUpdateListener { 7 | public function onMarkerReached(track: AudioTrack): Void; 8 | public function onPeriodicNotification(track: AudioTrack): Void; 9 | } -------------------------------------------------------------------------------- /Backends/Android/android/os/Bundle.hx: -------------------------------------------------------------------------------- 1 | package android.os; 2 | 3 | import java.util.ArrayList; 4 | 5 | extern class Bundle extends BaseBundle { 6 | public function new(); 7 | public function putStringArrayList(key: String, value: ArrayList): Void; 8 | public function getStringArrayList(key: String): ArrayList; 9 | public function getParcelable(key: String): T; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/audio2/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2; 2 | 3 | import kha.Sound; 4 | 5 | class Audio { 6 | public static var disableGcInteractions = false; 7 | public static var samplesPerSecond: Int; 8 | public static var audioCallback: Int->Buffer->Void; 9 | 10 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Android/android/media/MediaExtractor.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | import android.media.MediaFormat; 4 | import java.io.FileDescriptor; 5 | 6 | extern class MediaExtractor { 7 | public function new(): Void; 8 | public function setDataSource(fileDescriptor: FileDescriptor, offset: Int, length: Int): Void; 9 | public function getTrackFormat(index: Int): MediaFormat; 10 | public function release(): Void; 11 | } -------------------------------------------------------------------------------- /Backends/WPF/kha/graphics4/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class PipelineState extends PipelineStateBase { 4 | public function new() { 5 | super(); 6 | } 7 | 8 | public function compile(): Void { } 9 | 10 | public function getConstantLocation(name: String): ConstantLocation { return null; } 11 | public function getTextureUnit(name: String): TextureUnit { return null; } 12 | } 13 | -------------------------------------------------------------------------------- /Backends/WPF/kha/network/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) { 7 | 8 | } 9 | 10 | public function send(bytes: Bytes, mandatory: Bool): Void { 11 | 12 | } 13 | 14 | public function listen(listener: Bytes->Void): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/Android/kha/netsync/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) { 7 | 8 | } 9 | 10 | public function send(bytes: Bytes, mandatory: Bool): Void { 11 | 12 | } 13 | 14 | public function listen(listener: Bytes->Void): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/Empty/kha/netsync/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) { 7 | 8 | } 9 | 10 | public function send(bytes: Bytes, mandatory: Bool): Void { 11 | 12 | } 13 | 14 | public function listen(listener: Bytes->Void): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/netsync/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) { 7 | 8 | } 9 | 10 | public function send(bytes: Bytes, mandatory: Bool): Void { 11 | 12 | } 13 | 14 | public function listen(listener: Bytes->Void): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/Krom/kha/network/Network.hx: -------------------------------------------------------------------------------- 1 | package kha.network; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Network { 6 | public function new(url: String, port: Int, errorCallback: Void->Void, closeCallback: Void->Void) { 7 | 8 | } 9 | 10 | public function send(bytes: Bytes, mandatory: Bool): Void { 11 | 12 | } 13 | 14 | public function listen(listener: Bytes->Void): Void { 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/BlendFuncFactor.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.BlendFuncFactor") 4 | extern enum BlendFuncFactor { 5 | Zero; 6 | One; 7 | SrcColor; 8 | OneMinusSrcColor; 9 | SrcAlpha; 10 | OneMinusSrcAlpha; 11 | DstColor; 12 | OneMinusDstColor; 13 | DstAlpha; 14 | OneMinusDstAlpha; 15 | SrcAlphaSaturate; 16 | } 17 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/Worker.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class Worker { 4 | public static function postMessage(m: Dynamic): Void { 5 | try { 6 | untyped __js__("self.postMessage(m)"); 7 | } 8 | catch (e: Dynamic) { 9 | trace(e); 10 | } 11 | } 12 | 13 | public static function handleMessages(messageHandler: Dynamic->Void){ 14 | untyped __js__("self.onmessage = messageHandler"); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/media/MediaPlayer.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.MediaPlayer") 4 | extern class MediaPlayer { 5 | public var Volume: Float; 6 | 7 | public function new(): Void; 8 | 9 | public function Open(uri: Uri): Void; 10 | 11 | public function Play(): Void; 12 | 13 | public function Pause(): Void; 14 | 15 | public function Stop(): Void; 16 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/ImageBrush.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.ImageBrush") 4 | extern class ImageBrush { 5 | //public function new(); 6 | public function new(source: ImageSource); 7 | public var ImageSource(get, set): ImageSource; 8 | private function get_ImageSource(): ImageSource; 9 | private function set_ImageSource(source: ImageSource): ImageSource; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/WPF/system/windows/media/MediaPlayer.hx: -------------------------------------------------------------------------------- 1 | package system.windows.media; 2 | 3 | @:native("System.Windows.Media.MediaPlayer") 4 | extern class MediaPlayer { 5 | public var Volume: Float; 6 | 7 | public function new(): Void; 8 | 9 | public function Open(uri: Uri): Void; 10 | 11 | public function Play(): Void; 12 | 13 | public function Pause(): Void; 14 | 15 | public function Stop(): Void; 16 | } -------------------------------------------------------------------------------- /Sources/kha/DisplayMode.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class DisplayMode { 4 | public var width: Int; 5 | public var height: Int; 6 | public var frequency: Int; 7 | public var bitsPerPixel: Int; 8 | 9 | public function new(width: Int, height: Int, frequency: Int, bitsPerPixel: Int) { 10 | this.width = width; 11 | this.height = height; 12 | this.frequency = frequency; 13 | this.bitsPerPixel = bitsPerPixel; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Flash/kha/flash/graphics4/ConstantLocation.hx: -------------------------------------------------------------------------------- 1 | package kha.flash.graphics4; 2 | 3 | import flash.display3D.Context3DProgramType; 4 | 5 | class ConstantLocation implements kha.graphics4.ConstantLocation { 6 | public function new(value: Int, type: Context3DProgramType) { 7 | this.value = value; 8 | this.type = type; 9 | } 10 | 11 | public var value: Int; 12 | public var type: Context3DProgramType; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Krom/kha/graphics4/TessellationControlShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class TessellationControlShader { 4 | public var shader: Dynamic; 5 | 6 | public function new(sources: Array, names: Array) { 7 | shader = Krom.createTessellationControlShader(sources[0].bytes.getData(), names[0]); 8 | } 9 | 10 | public function delete() { 11 | Krom.deleteShader(shader); 12 | shader = null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Backends/Android/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import android.opengl.GLES20; 4 | 5 | class VertexShader { 6 | public var source: String; 7 | public var type: Int; 8 | public var shader: Int; 9 | 10 | public function new(sources: Array, files: Array) { 11 | this.source = sources[0].toString(); 12 | this.type = GLES20.GL_VERTEX_SHADER; 13 | this.shader = -1; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Krom/kha/graphics4/TessellationEvaluationShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class TessellationEvaluationShader { 4 | public var shader: Dynamic; 5 | 6 | public function new(sources: Array, names: Array) { 7 | shader = Krom.createTessellationEvaluationShader(sources[0].bytes.getData(), names[0]); 8 | } 9 | 10 | public function delete() { 11 | Krom.deleteShader(shader); 12 | shader = null; 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/AudioSource.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.AudioSource') 4 | extern class AudioSource { 5 | public function new() : Void; 6 | public function Play() : Void; 7 | public function Pause() : Void; 8 | public function Stop() : Void; 9 | public var clip: AudioClip; 10 | public var volume: Float; 11 | public var time: Float; 12 | public var isPlaying: Bool; 13 | public var loop: Bool; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/audio2/ogg/vorbis/data/ProbedPage.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2.ogg.vorbis.data; 2 | 3 | /** 4 | * ... 5 | * @author shohei909 6 | */ 7 | 8 | class ProbedPage 9 | { 10 | public var pageStart:Int; 11 | public var pageEnd:Int; 12 | public var afterPreviousPageStart:Int; 13 | public var firstDecodedSample:Null; 14 | public var lastDecodedSample:Null; 15 | 16 | public function new() { 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Backends/Android/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import android.opengl.GLES20; 4 | 5 | class FragmentShader { 6 | public var source: String; 7 | public var type: Int; 8 | public var shader: Int; 9 | 10 | public function new(sources: Array, files: Array) { 11 | this.source = sources[0].toString(); 12 | this.type = GLES20.GL_FRAGMENT_SHADER; 13 | this.shader = -1; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Java/kha/graphics4/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class VertexBuffer { 4 | public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, canRead: Bool = false) { } 5 | public function lock(?start: Int, ?count: Int): Array { return null; } 6 | public function unlock(?count: Int): Void { } 7 | public function count(): Int { return 0; } 8 | public function stride(): Int { return 1; } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/EmptyGraphics1.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | import kha.graphics1.Graphics; 4 | 5 | class EmptyGraphics1 implements Graphics { 6 | public function new(width: Int, height: Int) { 7 | 8 | } 9 | 10 | public function begin(): Void { 11 | 12 | } 13 | 14 | public function end(): Void { 15 | 16 | } 17 | 18 | public function setPixel(x: Int, y: Int, color: Color): Void { 19 | 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/TessellationControlShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | #if cpp 6 | extern class TessellationControlShader { 7 | public function new(source: Blob, file: String); 8 | public function delete(); 9 | } 10 | #else 11 | class TessellationControlShader { 12 | public function new(source: Blob, file: String) { 13 | 14 | } 15 | 16 | public function delete(): Void { 17 | 18 | } 19 | } 20 | #end 21 | -------------------------------------------------------------------------------- /Backends/WPF/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | class Audio { 4 | public static function play(sound: Sound, loop: Bool = false, stream: Bool = false): kha.audio1.AudioChannel { 5 | return new WpfAudioChannel(cast(sound, kha.wpf.Sound).filename); 6 | } 7 | 8 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 9 | return new WpfAudioChannel(cast(sound, kha.wpf.Sound).filename); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/BlendingFactor.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract BlendingFactor(Int) to Int { 4 | var Undefined = 0; 5 | var BlendOne = 1; 6 | var BlendZero = 2; 7 | var SourceAlpha = 3; 8 | var DestinationAlpha = 4; 9 | var InverseSourceAlpha = 5; 10 | var InverseDestinationAlpha = 6; 11 | var SourceColor = 7; 12 | var DestinationColor = 8; 13 | var InverseSourceColor = 9; 14 | var InverseDestinationColor = 10; 15 | } 16 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.arrays.Uint32Array; 4 | 5 | extern class IndexBuffer { 6 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false); 7 | public function delete(): Void; 8 | public function lock(?start: Int, ?count: Int): Uint32Array; 9 | public function unlock(?count: Int): Void; 10 | public function set(): Void; 11 | public function count(): Int; 12 | } 13 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/TessellationEvaluationShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | 5 | #if cpp 6 | extern class TessellationEvaluationShader { 7 | public function new(source: Blob, file: String); 8 | public function delete(); 9 | } 10 | #else 11 | class TessellationEvaluationShader { 12 | public function new(source: Blob, file: String) { 13 | 14 | } 15 | 16 | public function delete(): Void { 17 | 18 | } 19 | } 20 | #end 21 | -------------------------------------------------------------------------------- /Backends/Android/android/view/inputmethod/InputMethodManager.hx: -------------------------------------------------------------------------------- 1 | package android.view.inputmethod; 2 | 3 | import android.os.IBinder; 4 | 5 | extern class InputMethodManager { 6 | public static var SHOW_IMPLICIT: Int; 7 | public static var HIDE_NOT_ALWAYS: Int; 8 | public function toggleSoftInputFromWindow(windowToken: IBinder, showFlags: Int, hideFlags: Int): Void; 9 | public function hideSoftInputFromWindow(windowToken: IBinder, flags: Int): Bool; 10 | } 11 | -------------------------------------------------------------------------------- /Backends/WPF/kha/wpf/Music.hx: -------------------------------------------------------------------------------- 1 | package kha.wpf; 2 | 3 | import kha.audio1.MusicChannel; 4 | import system.io.Path; 5 | import system.Uri; 6 | import system.UriKind; 7 | import system.windows.controls.MediaElement; 8 | import system.windows.controls.MediaState; 9 | 10 | class Music extends kha.Music { 11 | public var filename: String; 12 | 13 | public function new(filename: String) : Void { 14 | super(); 15 | this.filename = filename; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/StringHelper.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | @:access(String) 4 | class StringHelper { 5 | public static inline function convert(s: String): hl.Bytes { 6 | var size = 0; 7 | return s.bytes.utf16ToUtf8(0, size); 8 | } 9 | 10 | public static inline function fromBytes(bytes: hl.Bytes): String { 11 | var s = ""; 12 | var size = 0; 13 | s.bytes = bytes.utf8ToUtf16(0, size); 14 | s.length = Std.int(size / 2); 15 | return s; 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Backends/WPF/kha/graphics4/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | import haxe.io.Float32Array; 3 | class VertexBuffer { 4 | public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, canRead: Bool = false) { } 5 | public function lock(?start: Int, ?count: Int): Float32Array { return null; } 6 | public function unlock(?count: Int): Void { } 7 | public function count(): Int { return 0; } 8 | public function stride(): Int { return 1; } 9 | } 10 | -------------------------------------------------------------------------------- /Backends/Unity/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | class Audio { 4 | public static function play(sound: Sound, loop: Bool = false, stream: Bool = false): kha.audio1.AudioChannel { 5 | return new UnitySoundChannel(cast(sound, kha.unity.Sound).filename, loop); 6 | } 7 | 8 | //public static function playMusic(music: Music, loop: Bool = false): kha.audio1.MusicChannel { 9 | // return new UnityMusicChannel(cast(music, kha.unity.Music).filename, loop); 10 | //} 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Canvas.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class Canvas { 4 | public function drawRect(x : Single, y : Single, width : Single, height : Single, paint : Paint) : Void; 5 | public function drawText(text : String, x : Single, y : Single, paint : Paint) : Void; 6 | public function drawBitmap(bitmap : Bitmap, x : Single, y : Single, paint : Paint) : Void; 7 | public function drawLine(x1 : Single, y1 : Single, x2 : Single, y2 : Single, paint : Paint) : Void; 8 | } -------------------------------------------------------------------------------- /Backends/Java/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | import kha.Sound; 4 | 5 | class Audio { 6 | public static function play(sound: Sound, loop: Bool = false, stream: Bool = false): kha.audio1.AudioChannel { 7 | return new JavaSoundChannel(cast(sound, kha.java.Sound)); 8 | } 9 | 10 | //public static function playMusic(music: Music, loop: Bool = false): kha.audio1.MusicChannel { 11 | // return new JavaMusicChannel(cast(music, kha.java.Music), loop); 12 | //} 13 | } 14 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/DepthStencilFormat.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | @:enum abstract DepthStencilFormat(Int) to Int { 4 | var NoDepthAndStencil = 0; 5 | var DepthOnly = 1; 6 | var DepthAutoStencilAuto = 2; 7 | 8 | // This is platform specific, use with care! 9 | var Depth24Stencil8 = 3; 10 | var Depth32Stencil8 = 4; 11 | var Depth16 = 5; 12 | 13 | //var StencilOnlyIndex1 = 5; 14 | //var StencilOnlyIndex4 = 6; 15 | //var StencilOnlyIndex8 = 7; 16 | //var StencilOnlyIndex16 = 8; 17 | } 18 | -------------------------------------------------------------------------------- /Sources/kha/input/Sensor.hx: -------------------------------------------------------------------------------- 1 | package kha.input; 2 | 3 | #if (cpp || hl) 4 | 5 | extern class Sensor { 6 | public static function get(type: SensorType): Sensor; 7 | 8 | public function notify(listener: Float -> Float -> Float -> Void): Void; 9 | } 10 | 11 | #else 12 | 13 | class Sensor { 14 | public static function get(type: SensorType): Sensor { 15 | return null; 16 | } 17 | 18 | public function notify(listener: Float -> Float -> Float -> Void): Void { 19 | 20 | } 21 | } 22 | 23 | #end 24 | -------------------------------------------------------------------------------- /Backends/Flash/kha/arrays/Int16Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import flash.Vector; 4 | 5 | @:forward(length) 6 | abstract Int16Array(Vector) to Vector { 7 | public inline function new(elements: Int) { 8 | this = new Vector(elements); 9 | } 10 | 11 | @:arrayAccess 12 | public inline function set(index: Int, value: Int): Int { 13 | return this[index] = value; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function get(index: Int): Int { 18 | return this[index]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Backends/Flash/kha/arrays/Int32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import flash.Vector; 4 | 5 | @:forward(length) 6 | abstract Int32Array(Vector) to Vector { 7 | public inline function new(elements: Int) { 8 | this = new Vector(elements); 9 | } 10 | 11 | @:arrayAccess 12 | public inline function set(index: Int, value: Int): Int { 13 | return this[index] = value; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function get(index: Int): Int { 18 | return this[index]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Backends/Unity/UnityBackend.hx: -------------------------------------------------------------------------------- 1 | package; 2 | 3 | import haxe.io.BytesData; 4 | import unityEngine.Texture2D; 5 | import unityEngine.AudioClip; 6 | 7 | extern class UnityBackend { 8 | public static function uvStartsAtTop(): Bool; 9 | public static function loadImage(filename: String): Texture2D; 10 | public static function loadBlob(filename: String): BytesData; 11 | public static function loadSound(filename: String): AudioClip; 12 | public static function getImageSize(asset: Texture2D): Point; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/WPF/kha/wpf/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.wpf; 2 | 3 | import kha.audio1.AudioChannel; 4 | import system.io.Path; 5 | import system.Uri; 6 | import system.UriKind; 7 | import system.windows.controls.MediaElement; 8 | import system.windows.controls.MediaState; 9 | 10 | class Sound extends kha.Sound { 11 | public var filename: String; 12 | private var channel: AudioChannel; 13 | 14 | public function new(filename: String): Void { 15 | super(); 16 | this.filename = filename; 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Backends/Flash/kha/arrays/Uint32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import flash.Vector; 4 | 5 | @:forward(length) 6 | abstract Uint32Array(Vector) to Vector { 7 | public inline function new(elements: Int) { 8 | this = new Vector(elements); 9 | } 10 | 11 | @:arrayAccess 12 | public inline function set(index: Int, value: UInt): UInt { 13 | return this[index] = value; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function get(index: UInt): UInt { 18 | return this[index]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/js/AudioElementAudio.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | @:keep 4 | class AudioElementAudio { 5 | 6 | public static function play(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 7 | return stream(sound, loop); 8 | } 9 | 10 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 11 | sound.element.loop = loop; 12 | var channel = new AEAudioChannel(sound.element, loop); 13 | channel.play(); 14 | return cast channel; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Backends/Java/kha/graphics4/Program.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class Program { 4 | public function new() { } 5 | public function setVertexShader(shader: VertexShader): Void { } 6 | public function setFragmentShader(shader: FragmentShader): Void { } 7 | public function link(structure: VertexStructure): Void { } 8 | 9 | public function getConstantLocation(name: String): ConstantLocation { return null; } 10 | public function getTextureUnit(name: String): TextureUnit { return null; } 11 | } 12 | -------------------------------------------------------------------------------- /Backends/Kore/kha/kore/Keyboard.hx: -------------------------------------------------------------------------------- 1 | package kha.kore; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:allow(kha.SystemImpl) 9 | class Keyboard extends kha.input.Keyboard { 10 | private function new() { 11 | super(); 12 | } 13 | 14 | @:functionCode('Kore::System::showKeyboard();') 15 | override public function show(): Void { 16 | 17 | } 18 | 19 | @:functionCode('Kore::System::hideKeyboard();') 20 | override public function hide(): Void { 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/kha/audio2/ogg/vorbis/data/Setting.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2.ogg.vorbis.data; 2 | 3 | /** 4 | * ... 5 | * @author shohei909 6 | */ 7 | class Setting 8 | { 9 | static public inline var MAX_CHANNELS = 16; 10 | static public inline var PUSHDATA_CRC_COUNT = 4; 11 | static public inline var FAST_HUFFMAN_LENGTH = 10; 12 | static public inline var FAST_HUFFMAN_TABLE_SIZE = (1 << FAST_HUFFMAN_LENGTH); 13 | static public inline var FAST_HUFFMAN_TABLE_MASK = FAST_HUFFMAN_TABLE_SIZE - 1; 14 | 15 | } 16 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.arrays.Float32Array; 4 | 5 | extern class VertexBuffer { 6 | public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, instanceDataStepRate: Int = 0, canRead: Bool = false); 7 | public function delete(): Void; 8 | public function lock(?start: Int, ?count: Int): Float32Array; 9 | public function unlock(?count: Int): Void; 10 | public function count(): Int; 11 | public function stride(): Int; 12 | } 13 | -------------------------------------------------------------------------------- /Backends/PSM/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | import kha.graphics4.FragmentShader; 5 | import kha.graphics4.VertexShader; 6 | import sce.playstation.core.graphics.ShaderProgram; 7 | 8 | class FragmentShader { 9 | private var shaderProgram: ShaderProgram; 10 | 11 | public function new(shader: Blob) { 12 | //shaderProgram = new ShaderProgram("/Application/shaders/Texture.cgx"); 13 | //shaderProgram.SetUniformBinding(0, "WorldViewProj"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/PSM/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.Blob; 4 | import kha.graphics4.FragmentShader; 5 | import kha.graphics4.VertexShader; 6 | import sce.playstation.core.graphics.ShaderProgram; 7 | 8 | class VertexShader { 9 | private var shaderProgram: ShaderProgram; 10 | 11 | public function new(shader: Blob) { 12 | //shaderProgram = new ShaderProgram("/Application/shaders/Texture.cgx"); 13 | //shaderProgram.SetUniformBinding(0, "WorldViewProj"); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Android/android/graphics/Paint.hx: -------------------------------------------------------------------------------- 1 | package android.graphics; 2 | 3 | extern class Paint { 4 | public function new() : Void; 5 | public function setFilterBitmap(b : Bool) : Void; 6 | public function setSubpixelText(b : Bool) : Void; 7 | public function setAntiAlias(b : Bool) : Void; 8 | public function setColor(color : Color) : Void; 9 | public function setTextSize(size : Single) : Void; 10 | public function measureText(text : String) : Float; 11 | public function setTypeface(face : Typeface) : Void; 12 | } -------------------------------------------------------------------------------- /Backends/Android/tech/kode/kha/KhaExtension.hx: -------------------------------------------------------------------------------- 1 | package tech.kode.kha; 2 | 3 | import android.content.Intent; 4 | 5 | class KhaExtension { 6 | public function new() { 7 | } 8 | 9 | public function onStart() { 10 | } 11 | 12 | public function onPause() { 13 | } 14 | 15 | public function onResume() { 16 | } 17 | 18 | public function onStop() { 19 | } 20 | 21 | public function onDestroy() { 22 | } 23 | 24 | public function onActivityResult(requestCode:Int, resultCode:Int, data:Intent):Void { 25 | } 26 | } -------------------------------------------------------------------------------- /Backends/WPF/kha/wpf/Graphics.hx: -------------------------------------------------------------------------------- 1 | package kha.wpf; 2 | 3 | class Graphics { 4 | public function new() { 5 | 6 | } 7 | 8 | //public function createTexture(width: Int, height: Int, format: TextureFormat, usage: Usage): Image { 9 | // return new Image(width, height, format); 10 | //} 11 | 12 | public function maxTextureSize(): Int { 13 | return 4096; 14 | } 15 | 16 | public function vsynced(): Bool { 17 | return true; 18 | } 19 | 20 | public function refreshRate(): Int { 21 | return 60; 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Sources/kha/CodeStyle.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class CodeStyle { //upper camel case class names 4 | public function new() { //egyptian style curly brackets 5 | 6 | } 7 | 8 | public function doIt(): Void { //lower camel case method and function names 9 | var i = 0; 10 | switch (i) { 11 | case 1: //case in same column as switch 12 | playSfx(2); 13 | } 14 | } 15 | 16 | public function playSfx(soundId: Int) { //lower camel case for parameters and locals, camel case is used for akronyms, too 17 | 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Sources/kha/vr/PoseState.hx: -------------------------------------------------------------------------------- 1 | package kha.vr; 2 | 3 | import kha.math.Vector3; 4 | 5 | // Full pose (rigid body) configuration with first and second derivatives. 6 | class PoseState { 7 | 8 | public var Pose: Pose; 9 | 10 | public var AngularVelocity: Vector3; 11 | public var LinearVelocity: Vector3; 12 | public var AngularAcceleration: Vector3; 13 | public var LinearAcceleration: Vector3; 14 | public var TimeInSeconds: Float; // Absolute time of this state sample. 15 | 16 | public function new() { 17 | 18 | } 19 | } -------------------------------------------------------------------------------- /Backends/Empty/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.graphics4.Usage; 4 | 5 | class IndexBuffer { 6 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false) { 7 | 8 | } 9 | 10 | public function lock(?start: Int, ?count: Int): Array { 11 | return null; 12 | } 13 | 14 | public function unlock(?count: Int): Void { 15 | 16 | } 17 | 18 | public function set(): Void { 19 | 20 | } 21 | 22 | public function count(): Int { 23 | return 0; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics5_/RayTraceTarget.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | #if kha_dxr 4 | 5 | @:headerCode(' 6 | #include 7 | #include 8 | ') 9 | 10 | @:headerClassCode("Kore::Graphics5::RayTraceTarget* target;") 11 | class RayTraceTarget { 12 | 13 | public function new(width: Int, height: Int) { 14 | init(width, height); 15 | } 16 | 17 | function init(width: Int, height: Int) { 18 | untyped __cpp__("target = new Kore::Graphics5::RayTraceTarget(width, height);"); 19 | } 20 | } 21 | 22 | #end 23 | -------------------------------------------------------------------------------- /Backends/Empty/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class VertexShader { 4 | public var sources: Array; 5 | public var type: Dynamic; 6 | public var shader: Dynamic; 7 | public var files: Array; 8 | 9 | public function new(sources: Array, files: Array) { 10 | 11 | } 12 | 13 | public static function fromSource(source: String): FragmentShader { 14 | return null; 15 | } 16 | 17 | public function delete(): Void { 18 | shader = null; 19 | sources = null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Backends/Empty/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class FragmentShader { 4 | public var sources: Array; 5 | public var type: Dynamic; 6 | public var shader: Dynamic; 7 | public var files: Array; 8 | 9 | public function new(sources: Array, files: Array) { 10 | 11 | } 12 | 13 | public static function fromSource(source: String): FragmentShader { 14 | return null; 15 | } 16 | 17 | public function delete(): Void { 18 | shader = null; 19 | sources = null; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/audio1/Audio.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | class Audio { 4 | public static function play(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 5 | Worker.postMessage({ command: 'playSound', id: cast(sound, kha.html5worker.Sound)._id, loop: loop }); 6 | return null; 7 | } 8 | 9 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 10 | Worker.postMessage({ command: 'streamSound', id: cast(sound, kha.html5worker.Sound)._id, loop: loop}); 11 | return null; 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Backends/WPF/kha/audio1/WpfMusicChannel.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | import system.windows.controls.MediaElement; 4 | 5 | class WpfMusicChannel extends WpfSoundChannel implements kha.audio1.MusicChannel { 6 | private var looping: Bool = false; 7 | 8 | public function new(filename: String, looping: Bool) { 9 | super(filename); 10 | this.looping = looping; 11 | } 12 | 13 | override function OnMediaEnded(obj: Dynamic, e: RoutedEventArgs): Void { 14 | if (looping) { 15 | play(); 16 | } 17 | else { 18 | hasFinished = true; 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Sources/kha/Display.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | extern class Display { 4 | public static var primary(get, never): Display; 5 | public static var all(get, never): Array; 6 | public var available(get, never): Bool; 7 | public var name(get, never): String; 8 | public var x(get, never): Int; 9 | public var y(get, never): Int; 10 | public var width(get, never): Int; 11 | public var height(get, never): Int; 12 | public var frequency(get, never): Int; 13 | public var pixelsPerInch(get, never): Int; 14 | public var modes(get, never): Array; 15 | } 16 | -------------------------------------------------------------------------------- /Backends/Android/android/view/KeyEvent.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | extern class KeyEvent { 4 | public static var KEYCODE_BACK: Int; 5 | public static var KEYCODE_DPAD_RIGHT: Int; 6 | public static var KEYCODE_DPAD_LEFT: Int; 7 | public static var KEYCODE_DPAD_CENTER: Int; 8 | public static var KEYCODE_DPAD_DOWN: Int; 9 | public static var KEYCODE_VOLUME_DOWN: Int; 10 | public static var KEYCODE_VOLUME_MUTE: Int; 11 | public static var KEYCODE_VOLUME_UP: Int; 12 | public function isAltPressed(): Bool; 13 | public function getKeyCode(): Int; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/netsync/Controller.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | @:autoBuild(kha.netsync.ControllerBuilder.build()) 6 | class Controller { 7 | private var __id: Int; 8 | public var _inputBufferIndex: Int; 9 | public var _inputBuffer: Bytes; 10 | 11 | public function new() { 12 | __id = ControllerBuilder.nextId++; 13 | _inputBuffer = Bytes.alloc(1); 14 | } 15 | 16 | public function _id(): Int { 17 | return __id; 18 | 19 | } 20 | 21 | public function _receive(bytes: Bytes): Void { 22 | 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /.github/workflows/windows.yml: -------------------------------------------------------------------------------- 1 | name: Windows 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: windows-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Compile 23 | run: .\nodejs_bin\node.exe make.js --kha . --from Tests/Empty --compile 24 | -------------------------------------------------------------------------------- /Sources/kha/Font.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import haxe.io.Bytes; 4 | 5 | extern class Font implements Resource { 6 | function height(fontSize: Int): Float; 7 | 8 | function width(fontSize: Int, str: String): Float; 9 | 10 | function widthOfCharacters(fontSize: Int, characters: Array, start: Int, length: Int): Float; 11 | 12 | function baseline(fontSize: Int): Float; 13 | 14 | function unload(): Void; 15 | 16 | // Portability warning, this works only on some platforms but can usually read ttf 17 | static function fromBytes(bytes: Bytes): Font; 18 | } 19 | -------------------------------------------------------------------------------- /Backends/PSM/system/io/File.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | import haxe.io.BytesData; 4 | 5 | @:native("System.IO.File") 6 | extern class File { 7 | public static function AppendAllText(path: String, contents: String): Void; 8 | public static function ReadAllText(filename: String): String; 9 | public static function WriteAllText(path: String, contents: String): Void; 10 | public static function ReadAllBytes(path: String): BytesData; 11 | public static function WriteAllBytes(path: String, bytes: BytesData): Void; 12 | public static function Exists(path: String): Bool; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/WPF/system/io/File.hx: -------------------------------------------------------------------------------- 1 | package system.io; 2 | 3 | import haxe.io.BytesData; 4 | 5 | @:native("System.IO.File") 6 | extern class File { 7 | public static function AppendAllText(path: String, contents: String): Void; 8 | public static function ReadAllText(filename: String): String; 9 | public static function WriteAllText(path: String, contents: String): Void; 10 | public static function ReadAllBytes(path: String): BytesData; 11 | public static function WriteAllBytes(path: String, bytes: BytesData): Void; 12 | public static function Exists(path: String): Bool; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Empty/kha/DisplayImpl.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class DisplayImpl { 4 | public static function count(): Int { 5 | return 1; 6 | } 7 | 8 | public static function width(index: Int): Int { 9 | return -1; 10 | } 11 | 12 | public static function height(index: Int): Int { 13 | return -1; 14 | } 15 | 16 | public static function x(index: Int): Int { 17 | return -1; 18 | } 19 | 20 | public static function y(index: Int): Int { 21 | return -1; 22 | } 23 | 24 | public static function isPrimary(index: Int): Bool { 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Backends/Node/kha/DisplayImpl.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class DisplayImpl { 4 | public static function count(): Int { 5 | return 1; 6 | } 7 | 8 | public static function width(index: Int): Int { 9 | return -1; 10 | } 11 | 12 | public static function height(index: Int): Int { 13 | return -1; 14 | } 15 | 16 | public static function x(index: Int): Int { 17 | return -1; 18 | } 19 | 20 | public static function y(index: Int): Int { 21 | return -1; 22 | } 23 | 24 | public static function isPrimary(index: Int): Bool { 25 | return true; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/EnvironmentVariables.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | import js.Browser; 4 | 5 | class EnvironmentVariables { 6 | public static function get(name: String): String { 7 | try { 8 | var query = Browser.location.href.substr(Browser.location.href.indexOf("?") + 1); 9 | var parts = query.split("&"); 10 | 11 | for (part in parts) { 12 | var subparts = part.split("="); 13 | if (subparts[0] == name) { 14 | return subparts[1]; 15 | } 16 | } 17 | 18 | return null; 19 | } 20 | catch (error: Dynamic) { 21 | return null; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Backends/Krom/kha/krom/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.krom; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class Sound extends kha.Sound { 6 | public function new(bytes: Bytes) { 7 | super(); 8 | 9 | var count = Std.int(bytes.length / 4); 10 | uncompressedData = new kha.arrays.Float32Array(count); 11 | for (i in 0...count) { 12 | uncompressedData[i] = bytes.getFloat(i * 4); 13 | } 14 | 15 | compressedData = null; 16 | } 17 | 18 | override public function uncompress(done: Void->Void): Void { 19 | done(); 20 | } 21 | 22 | override public function unload(): Void { 23 | super.unload(); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Sources/kha/graphics5_/Graphics.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | interface Graphics { 4 | function begin(target: RenderTarget): Void; 5 | function end(): Void; 6 | function swapBuffers(): Void; 7 | #if kha_dxr 8 | function setAccelerationStructure(accel: AccelerationStructure): Void; 9 | function setRayTracePipeline(pipe: RayTracePipeline): Void; 10 | function setRayTraceTarget(target: RayTraceTarget): Void; 11 | function dispatchRays(commandList: CommandList): Void; 12 | function copyRayTraceTarget(commandList: CommandList, renderTarget: RenderTarget, output: RayTraceTarget): Void; 13 | #end 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/audio2/Buffer.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2; 2 | 3 | class Buffer { 4 | public var channels: Int; 5 | public var samplesPerSecond: Int; 6 | 7 | public var data: kha.arrays.Float32Array; 8 | public var size: Int; 9 | public var readLocation: Int; 10 | public var writeLocation: Int; 11 | 12 | public function new(size: Int, channels: Int, samplesPerSecond: Int) { 13 | this.size = size; 14 | this.data = new kha.arrays.Float32Array(size); 15 | this.channels = channels; 16 | this.samplesPerSecond = samplesPerSecond; 17 | readLocation = 0; 18 | writeLocation = 0; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/hxsl/Types.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4.hxsl; 2 | 3 | #if false 4 | 5 | typedef Vec = h3d.Vector; 6 | typedef IVec = Array; 7 | typedef BVec = Array; 8 | typedef Matrix = h3d.Matrix; 9 | typedef Texture = h3d.mat.Texture; 10 | typedef Sampler2D = h3d.mat.Texture; 11 | typedef SamplerCube = h3d.mat.Texture; 12 | 13 | #else 14 | 15 | typedef Vec = Array; 16 | typedef IVec = Array; 17 | typedef BVec = Array; 18 | typedef Matrix = Array; 19 | typedef Texture = Dynamic; 20 | typedef Sampler2D = Dynamic; 21 | typedef SamplerCube = Dynamic; 22 | 23 | #end -------------------------------------------------------------------------------- /.github/workflows/flash.yml: -------------------------------------------------------------------------------- 1 | name: Flash 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Setup Node.js 23 | run: nodejs_bin/copysysbin.sh 24 | - name: Compile 25 | run: nodejs_bin/node make.js flash --kha . --from Tests/Empty 26 | -------------------------------------------------------------------------------- /.github/workflows/html5.yml: -------------------------------------------------------------------------------- 1 | name: HTML5 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Setup Node.js 23 | run: nodejs_bin/copysysbin.sh 24 | - name: Compile 25 | run: nodejs_bin/node make.js html5 --kha . --from Tests/Empty 26 | -------------------------------------------------------------------------------- /.github/workflows/krom.yml: -------------------------------------------------------------------------------- 1 | name: Krom 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Setup Node.js 23 | run: nodejs_bin/copysysbin.sh 24 | - name: Compile 25 | run: nodejs_bin/node make.js krom --kha . --from Tests/Empty 26 | -------------------------------------------------------------------------------- /.github/workflows/android.yml: -------------------------------------------------------------------------------- 1 | name: Android 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Setup Node.js 23 | run: nodejs_bin/copysysbin.sh 24 | - name: Compile 25 | run: nodejs_bin/node make.js android --kha . --from Tests/Empty 26 | -------------------------------------------------------------------------------- /.github/workflows/macos.yml: -------------------------------------------------------------------------------- 1 | name: macOS 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: macOS-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Get Submodules 19 | run: git submodule update --init --recursive 20 | - name: Get Node.js 21 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 22 | - name: Setup Node.js 23 | run: nodejs_bin/copysysbin.sh 24 | - name: Compile 25 | run: nodejs_bin/node make.js --kha . --from Tests/Empty --compile 26 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/Mouse.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | import js.Browser; 4 | import js.html.CanvasElement; 5 | import kha.Cursor; 6 | import kha.Image; 7 | 8 | class Mouse extends kha.Mouse { 9 | public static var SystemCursor: String = "default"; 10 | 11 | public static function UpdateSystemCursor() { 12 | 13 | } 14 | 15 | public function new() { 16 | super(); 17 | } 18 | 19 | override private function hideSystemCursor(): Void { 20 | 21 | } 22 | 23 | override private function showSystemCursor(): Void { 24 | 25 | } 26 | 27 | override public function update(): Void { 28 | 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/html5worker/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.html5worker; 2 | 3 | import haxe.io.Bytes; 4 | import haxe.ds.Vector; 5 | 6 | class Sound extends kha.Sound { 7 | public var _id: Int; 8 | public var _callback: Void->Void; 9 | 10 | public function new(id: Int) { 11 | super(); 12 | this._id = id; 13 | } 14 | 15 | override public function uncompress(done: Void->Void): Void { 16 | compressedData = null; 17 | Worker.postMessage({ command: 'uncompressSound', id: _id }); 18 | _callback = done; 19 | } 20 | 21 | override public function unload() { 22 | compressedData = null; 23 | uncompressedData = null; 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Backends/Krom/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class VertexShader { 4 | public var shader: Dynamic; 5 | 6 | public function new(sources: Array, names: Array) { 7 | if (sources != null) { 8 | shader = Krom.createVertexShader(sources[0].bytes.getData(), names[0]); 9 | } 10 | } 11 | 12 | public static function fromSource(source: String): VertexShader { 13 | var shader = new VertexShader(null, null); 14 | shader.shader = Krom.createVertexShaderFromSource(source); 15 | return shader; 16 | } 17 | 18 | public function delete() { 19 | Krom.deleteShader(shader); 20 | shader = null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics5_/AccelerationStructure.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | #if kha_dxr 4 | 5 | @:headerCode(' 6 | #include 7 | #include 8 | ') 9 | 10 | @:headerClassCode("Kore::Graphics5::AccelerationStructure* accel;") 11 | class AccelerationStructure { 12 | 13 | public function new(commandList: CommandList, vb: VertexBuffer, ib: IndexBuffer) { 14 | init(commandList, vb, ib); 15 | } 16 | 17 | function init(commandList: CommandList, vb: VertexBuffer, ib: IndexBuffer) { 18 | untyped __cpp__("accel = new Kore::Graphics5::AccelerationStructure(commandList->commandList, vb->buffer, ib->buffer);"); 19 | } 20 | } 21 | 22 | #end 23 | -------------------------------------------------------------------------------- /Backends/Node/kha/js/Sound.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | class SoundChannel extends kha.SoundChannel { 4 | public function new() { 5 | super(); 6 | } 7 | 8 | override public function play(): Void { 9 | super.play(); 10 | } 11 | 12 | override public function pause(): Void { 13 | 14 | } 15 | 16 | override public function stop(): Void { 17 | super.stop(); 18 | } 19 | 20 | override public function getCurrentPos(): Int { 21 | return 0; 22 | } 23 | 24 | override public function getLength(): Int { 25 | return 0; 26 | } 27 | } 28 | 29 | class Sound extends kha.Sound { 30 | public function new() { 31 | super(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/Krom/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class FragmentShader { 4 | public var shader: Dynamic; 5 | 6 | public function new(sources: Array, names: Array) { 7 | if (sources != null) { 8 | shader = Krom.createFragmentShader(sources[0].bytes.getData(), names[0]); 9 | } 10 | } 11 | 12 | public static function fromSource(source: String): FragmentShader { 13 | var shader = new FragmentShader(null, null); 14 | shader.shader = Krom.createFragmentShaderFromSource(source); 15 | return shader; 16 | } 17 | 18 | public function delete() { 19 | Krom.deleteShader(shader); 20 | shader = null; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Material.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | @:native('UnityEngine.Material') 4 | extern class Material { 5 | public function new(shader: Shader); 6 | public function SetPass(pass: Int): Bool; 7 | public var passCount: Int; 8 | public function SetMatrix(propertyName: String, matrix: Matrix4x4): Void; 9 | public function GetMatrix(propertyName: String): Matrix4x4; 10 | public function SetVector(propertyName: String, vector: Vector4): Void; 11 | public function SetFloat(propertyName: String, value: Single): Void; 12 | public function SetInt(propertyName: String, value: Int): Void; 13 | public function SetTexture(propertyName: String, texture: Texture): Void; 14 | } 15 | -------------------------------------------------------------------------------- /Sources/kha/audio1/AudioChannel.hx: -------------------------------------------------------------------------------- 1 | package kha.audio1; 2 | 3 | interface AudioChannel { 4 | public function play(): Void; 5 | public function pause(): Void; 6 | public function stop(): Void; 7 | public var length(get, null): Float; // Seconds 8 | private function get_length(): Float; 9 | public var position(get, set): Float; // Seconds 10 | private function get_position(): Float; 11 | private function set_position(value: Float): Float; 12 | public var volume(get, set): Float; 13 | private function get_volume(): Float; 14 | private function set_volume(value: Float): Float; 15 | public var finished(get, null): Bool; 16 | private function get_finished(): Bool; 17 | } 18 | -------------------------------------------------------------------------------- /Sources/kha/graphics1/Graphics.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics1; 2 | 3 | import kha.Color; 4 | 5 | /** 6 | * Basic graphical interface.
7 | * Represent old devices with only pixel pushing operations. 8 | */ 9 | interface Graphics { 10 | /** 11 | * Begin the graphic operations. 12 | * You MUST call this. 13 | */ 14 | public function begin(): Void; 15 | 16 | /** 17 | * Terminate all graphical operations and apply them. 18 | * You MUST call this at the end. 19 | */ 20 | public function end(): Void; 21 | 22 | /** 23 | * Set the pixel color at a specific position. 24 | */ 25 | public function setPixel(x: Int, y: Int, color: Color): Void; 26 | } 27 | -------------------------------------------------------------------------------- /Backends/Android/android/content/Context.hx: -------------------------------------------------------------------------------- 1 | package android.content; 2 | 3 | import android.content.res.AssetManager; 4 | import java.io.FileInputStream; 5 | import java.io.FileOutputStream; 6 | 7 | extern class Context { 8 | public static var MODE_PRIVATE: Int; 9 | public static var MODE_APPEND: Int; 10 | 11 | public static var BIND_AUTO_CREATE: Int; 12 | 13 | public static var INPUT_METHOD_SERVICE: String; 14 | public static var VIBRATOR_SERVICE: String; 15 | 16 | public function getAssets(): AssetManager; 17 | 18 | public function openFileOutput (name: String, mode: Int): FileOutputStream; 19 | public function openFileInput (name: String): FileInputStream; 20 | } 21 | -------------------------------------------------------------------------------- /Backends/KoreHL/kha/compute/ShaderStorageBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | import kha.graphics4.VertexData; 4 | 5 | class ShaderStorageBuffer { 6 | public var _buffer: Pointer; 7 | private var data: Array; 8 | private var myCount: Int; 9 | 10 | public function new(indexCount: Int, type: VertexData) { 11 | 12 | } 13 | 14 | private function init(indexCount: Int, type: VertexData) { 15 | 16 | } 17 | 18 | public function delete(): Void { 19 | 20 | } 21 | 22 | public function lock(): Array { 23 | return data; 24 | } 25 | 26 | public function unlock(): Void { 27 | 28 | } 29 | 30 | public function count(): Int { 31 | return myCount; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /checkstyle.json: -------------------------------------------------------------------------------- 1 | { 2 | "defaultSeverity": "INFO", 3 | "checks": [ 4 | { 5 | "type": "EmptyLines", 6 | "props": { 7 | "requireEmptyLineAfterClass": false, 8 | "requireEmptyLineAfterInterface": false, 9 | "requireEmptyLineAfterAbstract": false, 10 | "max": 1 11 | } 12 | }, 13 | { 14 | "type": "FileLength", 15 | "props": { 16 | "max": 2000 17 | } 18 | }, 19 | { 20 | "type": "IndentationCharacter", 21 | "props": { 22 | "character": "tab" 23 | } 24 | }, 25 | { 26 | "type": "LeftCurly", 27 | "props": { 28 | "option": "eol", 29 | "ignoreEmptySingleline": true 30 | } 31 | } 32 | ] 33 | } 34 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | import cs.NativeArray; 4 | import cs.types.UInt16; 5 | 6 | @:native("Sce.PlayStation.Core.Graphics.VertexBuffer") 7 | extern class VertexBuffer { 8 | public function new(vertexCount: Int, indexCount: Int, formats: NativeArray); 9 | public function SetIndices(indices: NativeArray): Void; 10 | //public function SetVertices(stream: Int, vertices: NativeArray): Void; 11 | //public function SetVertices(stream: Int, vertices: NativeArray, offset: Int, stride: Int): Void; 12 | public function SetVertices(vertices: NativeArray): Void; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Kore/kha/kore/graphics4/Graphics2.hx: -------------------------------------------------------------------------------- 1 | package kha.kore.graphics4; 2 | 3 | import kha.Canvas; 4 | import kha.graphics4.Graphics; 5 | import kha.graphics4.Graphics2; 6 | import kha.graphics4.TextureFormat; 7 | 8 | class Graphics2 extends kha.graphics4.Graphics2 { 9 | public function new(canvas: Canvas) { 10 | super(canvas); 11 | } 12 | 13 | override public function drawVideoInternal(video: kha.Video, x: Float, y: Float, width: Float, height: Float): Void { 14 | color = Color.Blue; 15 | fillRect(x, y, width, height); 16 | color = Color.White; 17 | drawScaledSubImage(Image.createFromVideo(video), 0, 0, video.width(), video.height(), x, y, width, height); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Backends/PSM/system/windows/controls/MediaElement.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | import system.Uri; 3 | 4 | @:native("System.Windows.Controls.MediaElement") 5 | extern class MediaElement { 6 | public var Volume : Float; 7 | public var Source : Uri; 8 | public var LoadedBehavior : MediaState; 9 | public var UnloadedBehavior : MediaState; 10 | 11 | public var MediaOpened : Dynamic; 12 | 13 | public function new() : Void { } 14 | 15 | public function Play() : Void { } 16 | 17 | public function Pause() : Void { } 18 | 19 | public function Stop() : Void { } 20 | } 21 | 22 | @:native("System.Windows.RoutedEventArgs") 23 | extern class RoutedEventArgs { 24 | 25 | } -------------------------------------------------------------------------------- /Backends/WPF/system/windows/controls/MediaElement.hx: -------------------------------------------------------------------------------- 1 | package system.windows.controls; 2 | import system.Uri; 3 | 4 | @:native("System.Windows.Controls.MediaElement") 5 | extern class MediaElement { 6 | public var Volume : Float; 7 | public var Source : Uri; 8 | public var LoadedBehavior : MediaState; 9 | public var UnloadedBehavior : MediaState; 10 | 11 | public var MediaOpened : Dynamic; 12 | 13 | public function new() : Void { } 14 | 15 | public function Play() : Void { } 16 | 17 | public function Pause() : Void { } 18 | 19 | public function Stop() : Void { } 20 | } 21 | 22 | @:native("System.Windows.RoutedEventArgs") 23 | extern class RoutedEventArgs { 24 | 25 | } -------------------------------------------------------------------------------- /Backends/KoreHL/kha/korehl/graphics4/Graphics2.hx: -------------------------------------------------------------------------------- 1 | package kha.korehl.graphics4; 2 | 3 | import kha.Canvas; 4 | import kha.graphics4.Graphics; 5 | import kha.graphics4.Graphics2; 6 | import kha.graphics4.TextureFormat; 7 | 8 | class Graphics2 extends kha.graphics4.Graphics2 { 9 | public function new(canvas: Canvas) { 10 | super(canvas); 11 | } 12 | 13 | override public function drawVideoInternal(video: kha.Video, x: Float, y: Float, width: Float, height: Float): Void { 14 | color = Color.Blue; 15 | fillRect(x, y, width, height); 16 | color = Color.White; 17 | drawScaledSubImage(Image.createFromVideo(video), 0, 0, video.width(), video.height(), x, y, width, height); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Backends/Unity/kha/arrays/Int32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import cs.NativeArray; 4 | 5 | abstract Int32Array(NativeArray) { 6 | public inline function new(elements: Int) { 7 | this = new NativeArray(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public function set(index: Int, value: Int): Int { 18 | this[index] = value; 19 | return value; 20 | } 21 | 22 | @:arrayAccess 23 | public inline function get(index: Int): Int { 24 | return this[index]; 25 | } 26 | 27 | public inline function data(): NativeArray { 28 | return this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Backends/Unity/unityEngine/Mesh.hx: -------------------------------------------------------------------------------- 1 | package unityEngine; 2 | 3 | import cs.NativeArray; 4 | 5 | @:native('UnityEngine.Mesh') 6 | extern class Mesh { 7 | public function new(); 8 | public var triangles: NativeArray; 9 | public var vertices: NativeArray; 10 | public var normals: NativeArray; 11 | public var tangents: NativeArray; 12 | public var uv: NativeArray; 13 | public var uv2: NativeArray; 14 | public var uv3: NativeArray; 15 | public var uv4: NativeArray; 16 | public function MarkDynamic(): Void; 17 | public function UploadMeshData(markNoLogerReadable: Bool): Void; 18 | public function Clear(keepVertexLayout: Bool): Void; 19 | } 20 | -------------------------------------------------------------------------------- /Backends/Android/android/view/MotionEvent.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | extern class MotionEvent { 4 | public static var ACTION_DOWN: Int; 5 | public static var ACTION_MOVE: Int; 6 | public static var ACTION_UP: Int; 7 | public static var ACTION_POINTER_DOWN: Int; 8 | public static var ACTION_POINTER_UP: Int; 9 | public static var ACTION_CANCEL: Int; 10 | public function getAction(): Int; 11 | public function getX(pointerIndex: Int): Single; 12 | public function getY(pointerIndex: Int): Single; 13 | public function getPointerCount(): Int; 14 | public function getPointerId(pointerIndex: Int): Int; 15 | public function getActionIndex(): Int; 16 | public function getActionMasked(): Int; 17 | } 18 | -------------------------------------------------------------------------------- /Backends/Flash/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import flash.display3D.Context3DProgramType; 4 | import flash.display3D.Program3D; 5 | import flash.utils.JSON; 6 | import kha.Blob; 7 | import kha.flash.utils.AGALMiniAssembler; 8 | import kha.graphics4.FragmentShader; 9 | import kha.graphics4.VertexShader; 10 | 11 | class VertexShader { 12 | public var source: String; 13 | public var constants: Dynamic; 14 | public var names: Dynamic; 15 | 16 | public function new(shaders: Array, files: Array) { 17 | var json = JSON.parse(shaders[0].toString()); 18 | source = json.agalasm; 19 | constants = json.consts; 20 | names = json.varnames; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Backends/Empty/kha/graphics4/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.graphics4.FragmentShader; 4 | import kha.graphics4.VertexData; 5 | import kha.graphics4.VertexShader; 6 | import kha.graphics4.VertexStructure; 7 | 8 | class PipelineState extends PipelineStateBase { 9 | public function new() { 10 | super(); 11 | } 12 | 13 | public function compile(): Void { 14 | 15 | } 16 | 17 | public function set(): Void { 18 | 19 | } 20 | 21 | public function getConstantLocation(name: String): kha.graphics4.ConstantLocation { 22 | return null; 23 | } 24 | 25 | public function getTextureUnit(name: String): kha.graphics4.TextureUnit { 26 | return null; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Backends/Flash/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import flash.display3D.Context3DProgramType; 4 | import flash.display3D.Program3D; 5 | import flash.utils.JSON; 6 | import kha.Blob; 7 | import kha.flash.utils.AGALMiniAssembler; 8 | import kha.graphics4.FragmentShader; 9 | import kha.graphics4.VertexShader; 10 | 11 | class FragmentShader { 12 | public var source: String; 13 | public var constants: Dynamic; 14 | public var names: Dynamic; 15 | 16 | public function new(shaders: Array, files: Array) { 17 | var json = JSON.parse(shaders[0].toString()); 18 | source = json.agalasm; 19 | constants = json.consts; 20 | names = json.varnames; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics5_/RayTracePipeline.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | #if kha_dxr 4 | 5 | @:headerCode(' 6 | #include 7 | #include 8 | ') 9 | 10 | @:headerClassCode("Kore::Graphics5::RayTracePipeline* pipeline;") 11 | class RayTracePipeline { 12 | 13 | public function new(commandList: CommandList, rayTraceShader: kha.Blob, constantBuffer: ConstantBuffer) { 14 | untyped __cpp__("pipeline = new Kore::Graphics5::RayTracePipeline(commandList->commandList, rayTraceShader->bytes->b->Pointer(), rayTraceShader->get_length(), constantBuffer->buffer);"); 15 | } 16 | 17 | @:keep 18 | function _forceInclude(): Void { 19 | haxe.io.Bytes.alloc(0); 20 | } 21 | } 22 | 23 | #end 24 | -------------------------------------------------------------------------------- /Backends/Krom/kha/compute/Shader.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | import haxe.io.Bytes; 4 | import kha.Blob; 5 | 6 | class Shader { 7 | public var shader_: Dynamic; 8 | 9 | public function new(sources: Array, files: Array) { 10 | shader_ = Krom.createShaderCompute(sources[0].toBytes().getData()); 11 | } 12 | 13 | public function delete(): Void { 14 | Krom.deleteShaderCompute(shader_); 15 | shader_ = null; 16 | } 17 | 18 | public function getConstantLocation(name: String): ConstantLocation { 19 | return Krom.getConstantLocationCompute(shader_, name); 20 | } 21 | 22 | public function getTextureUnit(name: String): TextureUnit { 23 | return Krom.getTextureUnitCompute(shader_, name); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Backends/Unity/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import cs.NativeArray; 4 | 5 | abstract Float32Array(NativeArray) { 6 | public inline function new(elements: Int) { 7 | this = new NativeArray(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public function set(index: Int, value: FastFloat): FastFloat { 18 | this[index] = value; 19 | return value; 20 | } 21 | 22 | @:arrayAccess 23 | public inline function get(index: Int): FastFloat { 24 | return this[index]; 25 | } 26 | 27 | public inline function data(): NativeArray { 28 | return this; 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/CubeMap.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import haxe.io.Bytes; 4 | 5 | extern class CubeMap implements Canvas implements Resource { 6 | 7 | public static function createRenderTarget(size: Int, format: TextureFormat = TextureFormat.RGBA32, depthStencil: DepthStencilFormat = NoDepthAndStencil, contextId: Int = 0): CubeMap; 8 | 9 | public function unload(): Void; 10 | public function lock(level: Int = 0): Bytes; 11 | public function unlock(): Void; 12 | 13 | public var width(get, null): Int; 14 | public var height(get, null): Int; 15 | 16 | public var g1(get, null): kha.graphics1.Graphics; 17 | public var g2(get, null): kha.graphics2.Graphics; 18 | public var g4(get, null): kha.graphics4.Graphics; 19 | } 20 | -------------------------------------------------------------------------------- /Backends/PSM/sce/playstation/core/graphics/GraphicsContext.hx: -------------------------------------------------------------------------------- 1 | package sce.playstation.core.graphics; 2 | 3 | @:native("Sce.PlayStation.Core.Graphics.GraphicsContext") 4 | extern class GraphicsContext { 5 | public function new(); 6 | public function DrawArrays(mode: DrawMode, first: Int, count: Int): Void; 7 | public function SetTexture(index: Int, texture: Texture2D): Void; 8 | public function SetVertexBuffer(index: Int, buffer: VertexBuffer): Void; 9 | public function SetShaderProgram(program: ShaderProgram): Void; 10 | public function SetBlendFunc(mode: BlendFuncMode, srcFactor: BlendFuncFactor, dstFactor: BlendFuncFactor): Void; 11 | public function Enable(mode: EnableMode, status: Bool): Void; 12 | public function SwapBuffers(): Void; 13 | } 14 | -------------------------------------------------------------------------------- /Backends/Android/kha/DisplayImpl.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class DisplayImpl { 4 | public static function count() : Int { 5 | return 1; 6 | } 7 | 8 | public static function width(index: Int ): Int { 9 | trace('TODO (DK) implement me'); 10 | return -1; 11 | } 12 | 13 | public static function height(index: Int ): Int { 14 | trace('TODO (DK) implement me'); 15 | return -1; 16 | } 17 | 18 | public static function x(index: Int ): Int { 19 | trace('TODO (DK) implement me'); 20 | return -1; 21 | } 22 | 23 | public static function y(index: Int ): Int { 24 | trace('TODO (DK) implement me'); 25 | return -1; 26 | } 27 | 28 | public static function isPrimary(index: Int ): Bool { 29 | trace('TODO (DK) implement me'); 30 | return true; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/Java/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import java.NativeArray; 4 | 5 | abstract Float32Array(NativeArray) { 6 | public inline function new(elements: Int) { 7 | this = new NativeArray(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public function set(index: Int, value: FastFloat): FastFloat { 18 | this[index] = value; 19 | return value; 20 | } 21 | 22 | @:arrayAccess 23 | public inline function get(index: Int): FastFloat { 24 | return this[index]; 25 | } 26 | 27 | 28 | public inline function data(): NativeArray { 29 | return this; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Backends/Empty/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import kha.FastFloat; 4 | 5 | abstract Float32Array(Dynamic) { 6 | public inline function new(elements: Int) { 7 | this = null; 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return 0; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function set(index: Int, value: FastFloat): FastFloat { 18 | return 0; 19 | } 20 | 21 | @:arrayAccess 22 | public inline function get(index: Int): FastFloat { 23 | return 0; 24 | } 25 | 26 | public inline function data(): Dynamic { 27 | return this; 28 | } 29 | 30 | public inline function subarray(start: Int, ?end: Int): Float32Array { 31 | return this; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/capture/VideoCapture.hx: -------------------------------------------------------------------------------- 1 | package kha.capture; 2 | 3 | import js.Browser; 4 | 5 | class VideoCapture { 6 | public static function init(initialized: kha.Video->Void, error: Void->Void): Void { 7 | var getUserMedia = untyped __js__("navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia"); 8 | getUserMedia.call(js.Browser.navigator, {audio: true, video: true}, function (stream: Dynamic) { 9 | var element: js.html.VideoElement = cast Browser.document.createElement("video"); 10 | element.srcObject = stream; 11 | element.onloadedmetadata = function (e) { 12 | initialized(kha.js.Video.fromElement(element)); 13 | } 14 | }, function () { 15 | error(); 16 | }); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Backends/Unity/kha/DisplayImpl.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | class DisplayImpl { 4 | public static function count() : Int { 5 | return 1; 6 | } 7 | 8 | public static function width( index : Int ) : Int { 9 | trace('TODO (DK) implement me'); 10 | return -1; 11 | } 12 | 13 | public static function height( index : Int ) : Int { 14 | trace('TODO (DK) implement me'); 15 | return -1; 16 | } 17 | 18 | public static function get_x( index : Int ) : Int { 19 | trace('TODO (DK) implement me'); 20 | return 0; 21 | } 22 | 23 | public static function get_y( index : Int ) : Int { 24 | trace('TODO (DK) implement me'); 25 | return 0; 26 | } 27 | 28 | public static function pixelsPerInch( index : Int ) : Int { 29 | trace('TODO (DK) implement me'); 30 | return 96; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/kha/netsync/LocalClient.hx: -------------------------------------------------------------------------------- 1 | package kha.netsync; 2 | 3 | import haxe.io.Bytes; 4 | 5 | class LocalClient implements Client { 6 | private var myId: Int; 7 | 8 | public function new(id: Int) { 9 | myId = id; 10 | } 11 | 12 | public function send(bytes: Bytes, mandatory: Bool): Void { 13 | 14 | } 15 | 16 | public function receive(receiver: Bytes->Void): Void { 17 | 18 | } 19 | 20 | public function onClose(close: Void->Void): Void { 21 | 22 | } 23 | 24 | public var controllers(get, null): Array; 25 | 26 | public function get_controllers(): Array { 27 | return null; 28 | } 29 | 30 | public var id(get, null): Int; 31 | 32 | public function get_id(): Int { 33 | return myId; 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class VertexShader { 4 | public var sources: Array; 5 | public var shader: Dynamic; 6 | public var files: Array; 7 | 8 | public function new(sources: Array, files: Array) { 9 | this.sources = []; 10 | for (source in sources) { 11 | this.sources.push(source.toString()); 12 | } 13 | this.shader = null; 14 | this.files = files; 15 | } 16 | 17 | public static function fromSource(source: String): VertexShader { 18 | var shader = new VertexShader([], ["runtime-string"]); 19 | shader.sources.push(source); 20 | return shader; 21 | } 22 | 23 | public function delete(): Void { 24 | shader = null; 25 | sources = null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics5_/ConstantBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics5; 2 | 3 | @:headerCode(' 4 | #include 5 | #include 6 | ') 7 | 8 | @:headerClassCode("Kore::Graphics5::ConstantBuffer* buffer;") 9 | class ConstantBuffer { 10 | 11 | public function new(size: Int) { 12 | init(size); 13 | } 14 | 15 | function init(size: Int) { 16 | untyped __cpp__("buffer = new Kore::Graphics5::ConstantBuffer(size)"); 17 | } 18 | 19 | public function lock(): Void { 20 | untyped __cpp__("buffer->lock()"); 21 | } 22 | 23 | public function unlock(): Void { 24 | untyped __cpp__("buffer->unlock()"); 25 | } 26 | 27 | public function setFloat(offset: Int, value: FastFloat): Void { 28 | untyped __cpp__("buffer->setFloat(offset, value)"); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /Backends/Node/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.graphics4.Usage; 4 | 5 | class IndexBuffer { 6 | private var data: Array; 7 | private var mySize: Int; 8 | 9 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false) { 10 | mySize = indexCount; 11 | data = new Array(); 12 | data[indexCount - 1] = 0; 13 | } 14 | 15 | public function delete(): Void { 16 | data = null; 17 | } 18 | 19 | public function lock(?start: Int, ?count: Int): Array { 20 | return data; 21 | } 22 | 23 | public function unlock(?count: Int): Void { 24 | 25 | } 26 | 27 | public function set(): Void { 28 | 29 | } 30 | 31 | public function count(): Int { 32 | return mySize; 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | class FragmentShader { 4 | public var sources: Array; 5 | public var shader: Dynamic; 6 | public var files: Array; 7 | 8 | public function new(sources: Array, files: Array) { 9 | this.sources = []; 10 | for (source in sources) { 11 | this.sources.push(source.toString()); 12 | } 13 | this.shader = null; 14 | this.files = files; 15 | } 16 | 17 | public static function fromSource(source: String): FragmentShader { 18 | var shader = new FragmentShader([], ["runtime-string"]); 19 | shader.sources.push(source); 20 | return shader; 21 | } 22 | 23 | public function delete(): Void { 24 | shader = null; 25 | sources = null; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Sources/kha/vr/SensorState.hx: -------------------------------------------------------------------------------- 1 | package kha.vr; 2 | 3 | // State of the sensor at a given absolute time. 4 | class SensorState { 5 | // Predicted pose configuration at requested absolute time. 6 | // One can determine the time difference between predicted and actual 7 | // readings by comparing ovrPoseState.TimeInSeconds. 8 | public var Predicted: PoseState; 9 | 10 | // Actual recorded pose configuration based on the sensor sample at a 11 | // moment closest to the requested time. 12 | public var Recorded: PoseState; 13 | 14 | // Sensor temperature reading, in degrees Celsius, as sample time. 15 | public var Temperature: Float; 16 | // Sensor status described by ovrStatusBits. 17 | public var Status: Int; 18 | 19 | public function new() { 20 | 21 | } 22 | 23 | } -------------------------------------------------------------------------------- /Sources/kha/graphics4/hxsl/ShaderList.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4.hxsl; 2 | 3 | class ShaderList { 4 | public var s : kha.graphics4.hxsl.Shader; 5 | public var next : ShaderList; 6 | public function new(s, ?n) { 7 | this.s = s; 8 | this.next = n; 9 | } 10 | public function clone() { 11 | return new ShaderList(s.clone(), next == null ? null : next.clone()); 12 | } 13 | public inline function iterator() { 14 | return new ShaderIterator(this); 15 | } 16 | } 17 | 18 | private class ShaderIterator { 19 | var l : ShaderList; 20 | public inline function new(l) { 21 | this.l = l; 22 | } 23 | public inline function hasNext() { 24 | return l != null; 25 | } 26 | public inline function next() { 27 | var s = l.s; 28 | l = l.next; 29 | return s; 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Backends/KoreHL/KoreC/indexbuffer.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" vbyte *hl_kore_create_indexbuffer(int count) { 6 | return (vbyte*)new Kore::Graphics4::IndexBuffer(count); 7 | } 8 | 9 | extern "C" void hl_kore_delete_indexbuffer(vbyte *buffer) { 10 | Kore::Graphics4::IndexBuffer* buf = (Kore::Graphics4::IndexBuffer*)buffer; 11 | delete buf; 12 | } 13 | 14 | extern "C" vbyte *hl_kore_indexbuffer_lock(vbyte *buffer) { 15 | Kore::Graphics4::IndexBuffer* buf = (Kore::Graphics4::IndexBuffer*)buffer; 16 | return (vbyte*)buf->lock(); 17 | } 18 | 19 | extern "C" void hl_kore_indexbuffer_unlock(vbyte *buffer) { 20 | Kore::Graphics4::IndexBuffer* buf = (Kore::Graphics4::IndexBuffer*)buffer; 21 | buf->unlock(); 22 | } 23 | -------------------------------------------------------------------------------- /Tests/Gamepads/src/Main.hx: -------------------------------------------------------------------------------- 1 | package; 2 | 3 | class PadExample { 4 | public function new() { 5 | kha.System.notifyOnRender(render); 6 | } 7 | 8 | function render( fb : kha.Framebuffer ) { 9 | var g = fb.g2; 10 | 11 | g.begin(true, kha.Color.Purple); 12 | for (pad in pads) { 13 | pad.render(g); 14 | } 15 | g.end(); 16 | } 17 | 18 | var pads = [new AnalogPadDisplay(0, 32, 32), new AnalogPadDisplay(1, 448, 32), new AnalogPadDisplay(2, 32, 352), new AnalogPadDisplay(3, 448, 352)]; 19 | } 20 | 21 | class Main { 22 | public static function main() { 23 | kha.System.init({ title : 'PadExample', width : 1024, height : 704 }, kha.Assets.loadEverything.bind(assets_loadedHandler)); 24 | } 25 | 26 | static function assets_loadedHandler() { 27 | new PadExample(); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Backends/Empty/kha/graphics4/VertexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.arrays.Float32Array; 4 | import kha.graphics4.Usage; 5 | import kha.graphics4.VertexStructure; 6 | import kha.graphics4.VertexData; 7 | 8 | class VertexBuffer { 9 | public function new(vertexCount: Int, structure: VertexStructure, usage: Usage, instanceDataStepRate: Int = 0, canRead: Bool = false) { 10 | 11 | } 12 | 13 | public function lock(?start: Int, ?count: Int): Float32Array { 14 | return null; 15 | } 16 | 17 | public function unlock(?count: Int): Void { 18 | 19 | } 20 | 21 | public function stride(): Int { 22 | return 0; 23 | } 24 | 25 | public function count(): Int { 26 | return 0; 27 | } 28 | 29 | public function set(offset: Int): Int { 30 | return 0; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Tests/Empty/Sources/Main.hx: -------------------------------------------------------------------------------- 1 | package; 2 | 3 | import kha.Assets; 4 | import kha.Framebuffer; 5 | import kha.Scheduler; 6 | import kha.System; 7 | 8 | class Main { 9 | static function update(): Void { 10 | 11 | } 12 | 13 | static function render(frames: Array): Void { 14 | 15 | } 16 | 17 | public static function main() { 18 | System.start({title: "Test", width: 1024, height: 768}, function (_) { 19 | // Just loading everything is ok for small projects 20 | Assets.loadEverything(function () { 21 | // Avoid passing update/render directly, 22 | // so replacing them via code injection works 23 | Scheduler.addTimeTask(function () { update(); }, 0, 1 / 60); 24 | System.notifyOnFrames(function (frames) { render(frames); }); 25 | }); 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /.github/workflows/linux.yml: -------------------------------------------------------------------------------- 1 | name: Linux 2 | 3 | on: 4 | push: 5 | branches: 6 | - master 7 | pull_request: 8 | branches: 9 | - master 10 | 11 | jobs: 12 | build: 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - uses: actions/checkout@v1 18 | - name: Apt Update 19 | run: sudo apt-get update 20 | - name: Apt Install 21 | run: sudo apt-get install libasound2-dev libxinerama-dev libgl1-mesa-dev libxi-dev --yes --quiet 22 | - name: Get Submodules 23 | run: git submodule update --init --recursive 24 | - name: Get Node.js 25 | run: git clone https://github.com/Kode/nodejs_bin.git --depth 1 26 | - name: Setup Node.js 27 | run: nodejs_bin/copysysbin.sh 28 | - name: Compile 29 | run: nodejs_bin/node make.js --kha . --from Tests/Empty --compile 30 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics4/GeometryShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import haxe.io.Bytes; 4 | import kha.Blob; 5 | 6 | @:headerCode(' 7 | #include 8 | #include 9 | ') 10 | 11 | @:headerClassCode("Kore::Graphics4::Shader* shader;") 12 | class GeometryShader { 13 | public function new(sources: Array, files: Array) { 14 | init(sources[0], files[0]); 15 | } 16 | 17 | private function init(source: Blob, file: String): Void { 18 | untyped __cpp__('shader = new Kore::Graphics4::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::Graphics4::GeometryShader);'); 19 | } 20 | 21 | public function delete(): Void { 22 | untyped __cpp__('delete shader; shader = nullptr;'); 23 | } 24 | 25 | @:keep 26 | function _forceInclude(): Void { 27 | Bytes.alloc(0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Backends/Unity/kha/graphics4/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import unityEngine.Material; 4 | import unityEngine.Shader; 5 | 6 | class PipelineState extends PipelineStateBase { 7 | public var material: Material; 8 | 9 | public function new() { 10 | super(); 11 | } 12 | 13 | public function compile(): Void { 14 | material = new Material(Shader.Find("Custom/" + vertexShader.name + "." + fragmentShader.name)); 15 | } 16 | 17 | public function getConstantLocation(name: String): ConstantLocation { 18 | return new kha.unity.ConstantLocation(name); 19 | } 20 | 21 | public function getTextureUnit(name: String): TextureUnit { 22 | return new kha.unity.TextureUnit(name); 23 | } 24 | /* 25 | public function getAttributeLocation(name: String): kha.graphics4.AttributeLocation { 26 | return null; 27 | } 28 | */ 29 | } 30 | -------------------------------------------------------------------------------- /Sources/kha/Canvas.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | /** 4 | * Interface for a generic Canvas with different APIs,
5 | * that can be used to draw graphics. 6 | */ 7 | interface Canvas { 8 | /** 9 | * The width of the canvas in pixels. 10 | */ 11 | var width(get, null): Int; 12 | /** 13 | * The height of the canvas in pixels. 14 | */ 15 | var height(get, null): Int; 16 | /** 17 | * The Graphics1 interface object.
18 | * Basic setPixel operation. 19 | */ 20 | var g1(get, null): kha.graphics1.Graphics; 21 | /** 22 | * The Graphics2 interface object.
23 | * Use this for 2D operations. 24 | */ 25 | var g2(get, null): kha.graphics2.Graphics; 26 | /** 27 | * The Graphics4 interface object.
28 | * Use this for 3D operations. 29 | */ 30 | var g4(get, null): kha.graphics4.Graphics; 31 | } 32 | -------------------------------------------------------------------------------- /Backends/Krom/kha/compute/ShaderStorageBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.compute; 2 | 3 | import kha.graphics4.VertexData; 4 | 5 | class ShaderStorageBuffer { 6 | private var data: Array; 7 | private var myCount: Int; 8 | 9 | public function new(indexCount: Int, type: VertexData) { 10 | myCount = indexCount; 11 | data = new Array(); 12 | data[myCount - 1] = 0; 13 | init(indexCount, type); 14 | } 15 | 16 | private function init(indexCount: Int, type: VertexData) { 17 | myCount = indexCount; 18 | data = new Array(); 19 | data[myCount - 1] = 0; 20 | } 21 | 22 | public function delete(): Void { 23 | 24 | } 25 | 26 | public function lock(): Array { 27 | return data; 28 | } 29 | 30 | public function unlock(): Void { 31 | 32 | } 33 | 34 | public function count(): Int { 35 | return myCount; 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Backends/Node/kha/graphics4/PipelineState.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import kha.graphics4.FragmentShader; 4 | import kha.graphics4.VertexData; 5 | import kha.graphics4.VertexShader; 6 | import kha.graphics4.VertexStructure; 7 | 8 | class PipelineState extends PipelineStateBase { 9 | public function new() { 10 | super(); 11 | } 12 | 13 | public function delete(): Void { 14 | 15 | } 16 | 17 | public function compile(): Void { 18 | 19 | } 20 | 21 | public function set(): Void { 22 | 23 | } 24 | 25 | public function getConstantLocation(name: String): kha.graphics4.ConstantLocation { 26 | return new kha.js.graphics4.ConstantLocation(); 27 | } 28 | 29 | public function getTextureUnit(name: String): kha.graphics4.TextureUnit { 30 | return new kha.js.graphics4.TextureUnit(); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Sources/kha/audio2/ogg/tools/Crc32.hx: -------------------------------------------------------------------------------- 1 | package kha.audio2.ogg.tools; 2 | import haxe.ds.Vector; 3 | 4 | /** 5 | * ... 6 | * @author shohei909 7 | */ 8 | class Crc32 9 | { 10 | static inline var POLY:UInt = 0x04c11db7; 11 | static var table:Vector; 12 | 13 | public static function init() { 14 | if (table != null) { 15 | return; 16 | } 17 | 18 | table = new Vector(256); 19 | for (i in 0...256) { 20 | var s:UInt = ((i:UInt) << (24:UInt)); 21 | for (j in 0...8) { 22 | s = (s << 1) ^ (s >= ((1:UInt) << 31) ? POLY : 0); 23 | } 24 | table[i] = s; 25 | } 26 | } 27 | 28 | public static inline function update(crc:UInt, byte:UInt):UInt 29 | { 30 | return (crc << 8) ^ table[byte ^ (crc >>> 24)]; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/Android/android/opengl/GLSurfaceView.hx: -------------------------------------------------------------------------------- 1 | package android.opengl; 2 | 3 | import android.app.Activity; 4 | import android.content.Context; 5 | import android.view.View; 6 | import java.lang.Runnable; 7 | 8 | extern class GLSurfaceView extends View { 9 | //@:overload public function new(context: Context); 10 | public function new(activity: Activity); 11 | public function queueEvent(r: Runnable): Void; 12 | public function onPause(): Void; 13 | public function onResume(): Void; 14 | public function setPreserveEGLContextOnPause(preserveOnPause: Bool): Void; 15 | public function setEGLContextClientVersion(version: Int): Void; 16 | public function setEGLConfigChooser(redSize: Int, greenSize: Int, blueSize: Int, alphaSize: Int, depthSize: Int, stencilSize: Int): Void; 17 | public function setRenderer(renderer: GLSurfaceViewRenderer): Void; 18 | } 19 | -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics4/TessellationControlShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import haxe.io.Bytes; 4 | import kha.Blob; 5 | 6 | @:headerCode(' 7 | #include 8 | #include 9 | ') 10 | 11 | @:headerClassCode("Kore::Graphics4::Shader* shader;") 12 | class TessellationControlShader { 13 | public function new(sources: Array, files: Array) { 14 | init(sources[0], files[0]); 15 | } 16 | 17 | private function init(source: Blob, file: String): Void { 18 | untyped __cpp__('shader = new Kore::Graphics4::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::Graphics4::TessellationControlShader);'); 19 | } 20 | 21 | public function delete(): Void { 22 | untyped __cpp__('delete shader; shader = nullptr;'); 23 | } 24 | 25 | @:keep 26 | function _forceInclude(): Void { 27 | Bytes.alloc(0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Sources/kha/FramebufferOptions.hx: -------------------------------------------------------------------------------- 1 | package kha; 2 | 3 | @:structInit 4 | class FramebufferOptions { 5 | @:optional public var frequency: Int = 60; 6 | @:optional public var verticalSync: Bool = true; 7 | @:optional public var colorBufferBits: Int = 32; 8 | @:optional public var depthBufferBits: Int = 16; 9 | @:optional public var stencilBufferBits: Int = 8; 10 | @:optional public var samplesPerPixel: Int = 1; 11 | 12 | public function new(?frequency: Int = 60, ?verticalSync: Bool = true, ?colorBufferBits: Int = 32, ?depthBufferBits: Int = 16, ?stencilBufferBits: Int = 8, ?samplesPerPixel: Int = 1) { 13 | this.frequency = frequency; 14 | this.verticalSync = verticalSync; 15 | this.colorBufferBits = colorBufferBits; 16 | this.depthBufferBits = depthBufferBits; 17 | this.stencilBufferBits = stencilBufferBits; 18 | this.samplesPerPixel = samplesPerPixel; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Backends/Empty/kha/arrays/Int32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | abstract Int32Array(Dynamic) { 4 | public inline function new(elements: Int) { 5 | this = null; 6 | } 7 | 8 | public var length(get, never): Int; 9 | 10 | inline function get_length(): Int { 11 | return 0; 12 | } 13 | 14 | public inline function set(index: Int, value: Int): Int { 15 | return 0; 16 | } 17 | 18 | public inline function get(index: Int): Int { 19 | return 0; 20 | } 21 | 22 | public inline function data(): Dynamic { 23 | return this; 24 | } 25 | 26 | @:arrayAccess 27 | public inline function arrayRead(index: Int): Int { 28 | return 0; 29 | } 30 | 31 | @:arrayAccess 32 | public inline function arrayWrite(index: Int, value: Int): Int { 33 | return 0; 34 | } 35 | 36 | public inline function subarray(start: Int, ?end: Int): Int16Array { 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Backends/Android/android/media/SoundPool.hx: -------------------------------------------------------------------------------- 1 | package android.media; 2 | 3 | import android.media.SoundPoolOnLoadCompleteListener; 4 | import android.content.res.AssetFileDescriptor; 5 | import java.lang.Float; 6 | 7 | extern class SoundPool { 8 | public function new(channels : Int, type : Int, loop : Int) : Void; 9 | public function load(file : AssetFileDescriptor, priority : Int) : Int; 10 | public function unload(soundId: Int): Bool; 11 | public function play(id : Int, leaftVolume : Float, rightVolume : Float, priority : Int, loop : Int, rate : Float) : Int; 12 | public function stop(id : Int): Void; 13 | public function pause(id: Int): Void; 14 | public function resume(id:Int): Void; 15 | public function setVolume(id: Int, leftVolume: Float, rightVolume: Float): Void; 16 | public function setOnLoadCompleteListener(listener: SoundPoolOnLoadCompleteListener): Void; 17 | } -------------------------------------------------------------------------------- /Backends/Kore/kha/graphics4/TessellationEvaluationShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import haxe.io.Bytes; 4 | import kha.Blob; 5 | 6 | @:headerCode(' 7 | #include 8 | #include 9 | ') 10 | 11 | @:headerClassCode("Kore::Graphics4::Shader* shader;") 12 | class TessellationEvaluationShader { 13 | public function new(sources: Array, files: Array) { 14 | init(sources[0], files[0]); 15 | } 16 | 17 | private function init(source: Blob, file: String): Void { 18 | untyped __cpp__('shader = new Kore::Graphics4::Shader(source->bytes->b->Pointer(), source->get_length(), Kore::Graphics4::TessellationEvaluationShader);'); 19 | } 20 | 21 | public function delete(): Void { 22 | untyped __cpp__('delete shader; shader = nullptr;'); 23 | } 24 | 25 | @:keep 26 | function _forceInclude(): Void { 27 | Bytes.alloc(0); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Backends/PSM/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import cs.NativeArray; 4 | import cs.types.UInt16; 5 | import kha.graphics4.Usage; 6 | 7 | class IndexBuffer { 8 | public var buffer: NativeArray; 9 | private var indices: Array; 10 | private var indexCount: Int; 11 | 12 | public function new(indexCount: Int, usage: Usage) { 13 | this.indexCount = indexCount; 14 | indices = new Array(); 15 | indices[indexCount - 1] = 0; 16 | buffer = new NativeArray(indexCount); 17 | } 18 | 19 | public function lock(?start: Int, ?count: Int): Array { 20 | return indices; 21 | } 22 | 23 | public function unlock(?count: Int): Void { 24 | for (i in 0...indexCount) { 25 | buffer[i] = cast indices[i]; 26 | } 27 | } 28 | 29 | public function count(): Int { 30 | return indexCount; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import kha.FastFloat; 4 | 5 | abstract Float32Array(js.lib.Float32Array) { 6 | public inline function new(elements: Int) { 7 | this = new js.lib.Float32Array(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function set(index: Int, value: FastFloat): FastFloat { 18 | return this[index] = value; 19 | } 20 | 21 | @:arrayAccess 22 | public inline function get(index: Int): FastFloat { 23 | return this[index]; 24 | } 25 | 26 | public inline function data(): js.lib.Float32Array { 27 | return this; 28 | } 29 | 30 | public inline function subarray(start: Int, ?end: Int): Float32Array { 31 | return cast this.subarray(start, end); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/KoreHL/KoreC/display.cpp: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | 5 | extern "C" int hl_kore_display_count() { 6 | return Kore::Display::count(); 7 | } 8 | 9 | extern "C" int hl_kore_display_width(int index) { 10 | return Kore::Display::get(index)->width(); 11 | } 12 | 13 | extern "C" int hl_kore_display_height(int index) { 14 | return Kore::Display::get(index)->height(); 15 | } 16 | 17 | extern "C" int hl_kore_display_x(int index) { 18 | return Kore::Display::get(index)->x(); 19 | } 20 | 21 | extern "C" int hl_kore_display_y(int index) { 22 | return Kore::Display::get(index)->y(); 23 | } 24 | 25 | extern "C" bool hl_kore_display_is_primary(int index) { 26 | return Kore::Display::get(index) == Kore::Display::primary(); 27 | } 28 | 29 | extern "C" int hl_kore_display_ppi() { 30 | return Kore::Display::primary()->pixelsPerInch(); 31 | } 32 | -------------------------------------------------------------------------------- /Backends/Node/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import kha.FastFloat; 4 | 5 | abstract Float32Array(js.lib.Float32Array) { 6 | public inline function new(elements: Int) { 7 | this = new js.lib.Float32Array(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function set(index: Int, value: FastFloat): FastFloat { 18 | return this[index] = value; 19 | } 20 | 21 | @:arrayAccess 22 | public inline function get(index: Int): FastFloat { 23 | return this[index]; 24 | } 25 | 26 | public inline function data(): js.html.Float32Array { 27 | return this; 28 | } 29 | 30 | public inline function subarray(start: Int, ?end: Int): Float32Array { 31 | return cast this.subarray(start, end); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/HTML5-Worker/kha/arrays/Float32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | import kha.FastFloat; 4 | 5 | abstract Float32Array(js.lib.Float32Array) { 6 | public inline function new(elements: Int) { 7 | this = new js.lib.Float32Array(elements); 8 | } 9 | 10 | public var length(get, never): Int; 11 | 12 | inline function get_length(): Int { 13 | return this.length; 14 | } 15 | 16 | @:arrayAccess 17 | public inline function set(index: Int, value: FastFloat): FastFloat { 18 | return this[index] = value; 19 | } 20 | 21 | @:arrayAccess 22 | public inline function get(index: Int): FastFloat { 23 | return this[index]; 24 | } 25 | 26 | public inline function data(): js.lib.Float32Array { 27 | return this; 28 | } 29 | 30 | public inline function subarray(start: Int, ?end: Int): Float32Array { 31 | return cast this.subarray(start, end); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/Android/kha/android/Video.hx: -------------------------------------------------------------------------------- 1 | package kha.android; 2 | 3 | import android.content.res.AssetFileDescriptor; 4 | import android.media.MediaPlayer; 5 | import java.lang.Exception; 6 | import java.lang.Throwable; 7 | 8 | class Video extends kha.Video { 9 | var mp: MediaPlayer; 10 | 11 | public function new(file: AssetFileDescriptor) { 12 | super(); 13 | try { 14 | mp = new MediaPlayer(); 15 | mp.setLooping(false); 16 | mp.setDataSource(file.getFileDescriptor(), file.getStartOffset(), file.getLength()); 17 | mp.prepare(); 18 | mp.start(); 19 | } 20 | catch (e: Exception) { 21 | e.printStackTrace(); 22 | } 23 | } 24 | 25 | override public function play(loop: Bool = false): Void { 26 | //mp.setDisplay(GameView.the().getHolder()); 27 | mp.start(); 28 | } 29 | 30 | override public function stop(): Void { 31 | mp.stop(); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/js/MobileWebAudio.hx: -------------------------------------------------------------------------------- 1 | package kha.js; 2 | 3 | import js.html.audio.AudioContext; 4 | 5 | @:keep 6 | class MobileWebAudio { 7 | @:noCompletion public static var _context: AudioContext; 8 | 9 | @:noCompletion public static function _init(): Void { 10 | try { 11 | _context = new AudioContext(); 12 | return; 13 | } 14 | catch (e: Dynamic) { 15 | 16 | } 17 | try { 18 | untyped __js__('this._context = new webkitAudioContext();'); 19 | return; 20 | } 21 | catch (e: Dynamic) { 22 | 23 | } 24 | } 25 | 26 | public static function play(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 27 | var channel = new MobileWebAudioChannel(cast sound, loop); 28 | channel.play(); 29 | return channel; 30 | } 31 | 32 | public static function stream(sound: Sound, loop: Bool = false): kha.audio1.AudioChannel { 33 | return play(sound, loop); 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /Backends/Android/android/view/View.hx: -------------------------------------------------------------------------------- 1 | package android.view; 2 | 3 | import android.os.IBinder; 4 | 5 | extern class View { 6 | public static var SYSTEM_UI_FLAG_LAYOUT_STABLE:Int; 7 | public static var SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION:Int; 8 | public static var SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN:Int; 9 | public static var SYSTEM_UI_FLAG_HIDE_NAVIGATION:Int; 10 | public static var SYSTEM_UI_FLAG_FULLSCREEN:Int; 11 | public static var SYSTEM_UI_FLAG_IMMERSIVE_STICKY:Int; 12 | public static var SYSTEM_UI_FLAG_IMMERSIVE:Int; 13 | 14 | public function setFocusable(focusable: Bool): Void; 15 | public function setFocusableInTouchMode(focusableInTouchMode: Bool): Void; 16 | public function setOnTouchListener(l: ViewOnTouchListener): Void; 17 | public function getApplicationWindowToken(): IBinder; 18 | public function setSystemUiVisibility(visibility: Int): Void; 19 | } 20 | -------------------------------------------------------------------------------- /Sources/kha/graphics4/hxsl/Serializer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4.hxsl; 2 | using kha.graphics4.hxsl.Ast; 3 | 4 | class Serializer { 5 | 6 | function new() { 7 | } 8 | 9 | #if macro 10 | function mapExpr( e : TExpr ) { 11 | var e = e.map(mapExpr); 12 | e.p = cast haxe.macro.Context.getPosInfos(e.p); 13 | return e; 14 | } 15 | #end 16 | 17 | public static function run( s : ShaderData ) { 18 | #if macro 19 | var ser = new Serializer(); 20 | var s : ShaderData = { 21 | name : s.name, 22 | vars : s.vars, 23 | funs : [for( f in s.funs ) { 24 | kind : f.kind, 25 | ref : f.ref, 26 | args : f.args, 27 | ret : f.ret, 28 | expr : ser.mapExpr(f.expr), 29 | }], 30 | }; 31 | #end 32 | var ser = new haxe.Serializer(); 33 | ser.useCache = true; 34 | ser.useEnumIndex = true; 35 | ser.serialize(s); 36 | return ser.toString(); 37 | } 38 | 39 | } -------------------------------------------------------------------------------- /Backends/Empty/kha/arrays/Int16Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | abstract Int16Array(Dynamic) { 4 | public inline function new(elements: Int) { 5 | this = null; 6 | } 7 | 8 | public var length(get, never): Int; 9 | 10 | inline function get_length(): Int { 11 | return 0; 12 | } 13 | 14 | public inline function set(index: Int, value: Int): Int { 15 | return 0; 16 | } 17 | 18 | public inline function get(index: Int): Int { 19 | return 0; 20 | } 21 | 22 | public inline function data(): Dynamic { 23 | return this; 24 | } 25 | 26 | @:arrayAccess 27 | public inline function arrayRead(index: Int): Int { 28 | return 0; 29 | } 30 | 31 | @:arrayAccess 32 | public inline function arrayWrite(index: Int, value: Int): Int { 33 | return 0; 34 | } 35 | 36 | public inline function subarray(start: Int, ?end: Int): Int16Array { 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Backends/Empty/kha/arrays/Uint32Array.hx: -------------------------------------------------------------------------------- 1 | package kha.arrays; 2 | 3 | abstract Uint32Array(Dynamic) { 4 | public inline function new(elements: Int) { 5 | this = null; 6 | } 7 | 8 | public var length(get, never): Int; 9 | 10 | inline function get_length(): Int { 11 | return 0; 12 | } 13 | 14 | public inline function set(index: Int, value: Int): Int { 15 | return 0; 16 | } 17 | 18 | public inline function get(index: Int): Int { 19 | return 0; 20 | } 21 | 22 | public inline function data(): Dynamic { 23 | return this; 24 | } 25 | 26 | @:arrayAccess 27 | public inline function arrayRead(index: Int): Int { 28 | return 0; 29 | } 30 | 31 | @:arrayAccess 32 | public inline function arrayWrite(index: Int, value: Int): Int { 33 | return 0; 34 | } 35 | 36 | public inline function subarray(start: Int, ?end: Int): Uint32Array { 37 | return this; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/graphics4/VertexShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import js.html.webgl.GL; 4 | 5 | class VertexShader { 6 | public var sources: Array; 7 | public var type: Dynamic; 8 | public var shader: Dynamic; 9 | public var files: Array; 10 | 11 | public function new(sources: Array, files: Array) { 12 | this.sources = []; 13 | for (source in sources) { 14 | this.sources.push(source.toString()); 15 | } 16 | this.type = GL.VERTEX_SHADER; 17 | this.shader = null; 18 | this.files = files; 19 | } 20 | 21 | public static function fromSource(source: String): VertexShader { 22 | var shader = new VertexShader([], ["runtime-string"]); 23 | shader.sources.push(source); 24 | return shader; 25 | } 26 | 27 | public function delete(): Void { 28 | SystemImpl.gl.deleteShader(shader); 29 | shader = null; 30 | sources = null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/Kore/kha/input/Sensor.hx: -------------------------------------------------------------------------------- 1 | package kha.input; 2 | 3 | @:keep 4 | class Sensor { 5 | private static var accelerometer: Sensor = new Sensor(); 6 | private static var gyroscope: Sensor = new Sensor(); 7 | private var listeners: Array Float -> Float -> Void> = new Array(); 8 | 9 | public static function get(type: SensorType): Sensor { 10 | switch (type) { 11 | case Accelerometer: 12 | return accelerometer; 13 | case Gyroscope: 14 | return gyroscope; 15 | } 16 | } 17 | 18 | public function notify(listener: Float -> Float -> Float -> Void): Void { 19 | listeners.push(listener); 20 | } 21 | 22 | private function new() { 23 | 24 | } 25 | 26 | public static function _changed(type: Int, x: Float, y: Float, z: Float): Void { 27 | var sensor = get(type == 0 ? SensorType.Accelerometer : SensorType.Gyroscope); 28 | for (listener in sensor.listeners) { 29 | listener(x, y, z); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/HTML5/kha/graphics4/FragmentShader.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import js.html.webgl.GL; 4 | 5 | class FragmentShader { 6 | public var sources: Array; 7 | public var type: Dynamic; 8 | public var shader: Dynamic; 9 | public var files: Array; 10 | 11 | public function new(sources: Array, files: Array) { 12 | this.sources = []; 13 | for (source in sources) { 14 | this.sources.push(source.toString()); 15 | } 16 | this.type = GL.FRAGMENT_SHADER; 17 | this.shader = null; 18 | this.files = files; 19 | } 20 | 21 | public static function fromSource(source: String): FragmentShader { 22 | var shader = new FragmentShader([], ["runtime-string"]); 23 | shader.sources.push(source); 24 | return shader; 25 | } 26 | 27 | public function delete(): Void { 28 | SystemImpl.gl.deleteShader(shader); 29 | shader = null; 30 | sources = null; 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Backends/Unity/kha/graphics4/IndexBuffer.hx: -------------------------------------------------------------------------------- 1 | package kha.graphics4; 2 | 3 | import cs.NativeArray; 4 | 5 | class IndexBuffer { 6 | public var nativeIndices: NativeArray; 7 | public var nativeCutIndices: NativeArray; 8 | private var indices: Array; 9 | private var indexCount: Int; 10 | 11 | public function new(indexCount: Int, usage: Usage, canRead: Bool = false) { 12 | this.indexCount = indexCount; 13 | indices = new Array(); 14 | nativeIndices = new NativeArray(indexCount); 15 | nativeCutIndices = new NativeArray(indexCount); 16 | } 17 | 18 | public function lock(?start: Int, ?count: Int): Array { 19 | return indices; 20 | } 21 | 22 | public function unlock(?count: Int): Void { 23 | for (i in 0...indexCount) { 24 | nativeIndices[i] = indices[i]; 25 | } 26 | } 27 | 28 | public function set(): Void {} 29 | 30 | public function count(): Int { 31 | return indexCount; 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /license.txt: -------------------------------------------------------------------------------- 1 | Copyright (c) 2017 the Kha Development Team 2 | 3 | This software is provided 'as-is', without any express or implied 4 | warranty. In no event will the authors be held liable for any damages 5 | arising from the use of this software. 6 | 7 | Permission is granted to anyone to use this software for any purpose, 8 | including commercial applications, and to alter it and redistribute it 9 | freely, subject to the following restrictions: 10 | 11 | 1. The origin of this software must not be misrepresented; you must not 12 | claim that you wrote the original software. If you use this software 13 | in a product, an acknowledgment in the product documentation would be 14 | appreciated but is not required. 15 | 16 | 2. Altered source versions must be plainly marked as such, and must not be 17 | misrepresented as being the original software. 18 | 19 | 3. This notice may not be removed or altered from any source distribution. 20 | --------------------------------------------------------------------------------