• X
    x17head

    The main page says it does(did?) support swf profiling, but he's switched to haxe from flash so it doesnt look like swf will get updated any time soon. swf is version 0.1.

    posted in Kode read more
  • X
    x17head

    Thanks for the explanation Robert.

    posted in Kode read more
  • X
    x17head

    Awesome, thanks Rob. So whats happening between startrender and endrender? Am i just copying an image buffer to the screen (and scaler.scale is making it "look right") I know theres alot more going on in g4 but for the sake of g2 is that the basic idea?

    posted in Kode read more
  • X
    x17head

    package;

    import kha.Game;
    import kha.Framebuffer;
    import kha.Color;
    import kha.graphics2.Graphics;
    import kha.Image;
    import kha.Loader;
    import kha.Scaler;
    import kha.math.FastMatrix3;
    import kha.Scheduler;
    import kha.Configuration;
    import kha.LoadingScreen;
    import kha.input.Mouse;
    import kha.input.Surface;
    import haxe.ds.Vector;

    class Empty extends Game {
    var backbuffer:Image;
    var g:Graphics;

    var mouse:kha.input.Mouse;
    var mouseX:Int = 0;
    var mouseY:Int = 0;
    var mouseButton:Bool = false;
    
    //touch vars
    var __touch:Surface;
    var touch:Vector<Bool>;
    var touchX:Vector<Int>;
    var touchY:Vector<Int>;
    
    public function new() {
    	super("Empty", false);
    }	
    
    override function init(): Void
    {
    	//setup mouse
    	mouse = kha.input.Mouse.get(0);
    	if (mouse != null)mouse.notify(TestMouseDown, TestMouseUp, TestMouseMove, TestMouseWheel);
    	
    	//setup touch
    	touch = new Vector(10);
    	touchX = new Vector(10);
    	touchY = new Vector(10);
    	__touch = Surface.get(0);
    	if (__touch != null)__touch.notify(touchDown, touchUp, touchMove);
    	for (i in 0...10)
    	{
    		touch[i] = false;
    	}
    	
    	backbuffer = Image.createRenderTarget(width, height);
    	Configuration.setScreen(this);
    }
    
    override function render(frame: Framebuffer): Void 
    {	
    	g = backbuffer.g2; 
    	g.begin();
    	g.clear(Color.Black);
    	
    	g.transformation = FastMatrix3.identity();
    	
    	if (mouseButton)
    	{
    		g.set_color(Color.Blue);
    		g.fillRect(mouseX -20, mouseY -20, 40, 40);
    	}
    	
    	for (i in 0...10)
    	{
    		if (touch[i])
    		{
    			g.set_color(Color.Red);
    			g.fillRect(touchX[i] -20, touchY[i] -20, 40, 40);
    		}
    	}
    	
    	g.end(); 
    	 		 
    	startRender(frame);
    	Scaler.scale(backbuffer, frame, kha.Sys.screenRotation);
    	endRender(frame);
    }
    
    override function update()
    {
    	
    }
    
    //<mouse stuff>
    private function TestMouseDown(button:Int, x:Int, y:Int)
    {
    	mouseButton = true;
    	mouseX = x;
    	mouseY = y;
    }
    
    private function TestMouseUp(button:Int, x:Int, y:Int)
    {
    	mouseButton = false;
    	mouseX = x;
    	mouseY = y;
    }
    
    private function TestMouseMove(x:Int, y:Int,xMovement:Int,yMovement:Int)
    {
    	mouseX = x;
    	mouseY = y;
    }
    
    private function TestMouseWheel(wheel:Int)
    {
    	//not done...
    }
    //</mouse stuff>
    
    //<touch stuff>
    
    public function touchDown(touchNum:Int,x:Int,y:Int)
    {
    	touch[touchNum] = true;
    	touchX[touchNum] = x;
    	touchY[touchNum] = y;
    }
    
    public function touchUp(touchNum:Int,x:Int,y:Int)
    {
    	touch[touchNum] = false;
    	touchX[touchNum] = x;
    	touchY[touchNum] = y;
    }
    
    public function touchMove(touchNum:Int,x:Int,y:Int)
    {
    	touch[touchNum] = true;
    	touchX[touchNum] = x;
    	touchY[touchNum] = y;
    }
    //</touch stuff>
    

    }

    posted in Kode read more
  • X
    x17head

    Touch(surface) on android does not give accurate touch coordinates, and multitouch is not tracked(beyond touch #0) It does work in chrome on android, html5.

    Also how does the screensize work on android. It seems like its just scaled and centered but its hard to tell. Thanks. Example code below.

    posted in Kode read more
  • X
    x17head

    I am building a game with it 🙂 I've found the workflow very interesting, when I can't do something, or something s broken it my fault 😉 I've tried to make it as generic as I can.

    posted in Kode read more
  • X
    x17head

    ...im also learning git, so dont read the commit history, it will only break your heart.

    posted in Kode read more
  • X
    x17head

    Ive been writing a small 2d engine to help me learn kha and haxe and was was hoping for some feedback. Hateful venomous comments are welcome as long as you explain why im an explative deleted 🙂

    https://github.com/x17head/libdrp

    I appreciate all comments!

    posted in Kode read more
  • X
    x17head

    Pardon my phrasing. Something like SDL_GameControllerName:
    https://wiki.libsdl.org/SDL_GameControllerName?highlight=(\bCategoryGameController\b)|(CategoryEnum)

    So that we can identify different controllers and map the different axis and buttons accordingly.

    posted in Kode read more
  • X
    x17head

    Enable gamepad api to detect gamepad type (gamepad id?)

    posted in Kode read more
  • X
    x17head

    Thanks Robert! Fyi the audio was generated from http://www.bfxr.net/ a web based sfxr. Dont know if that could help?

    posted in Kode read more
  • X
    x17head

    Confirmed 🙂 The lack of music is a Microsoft Edge issue.

    posted in Kode read more
  • X
    x17head

    I tried with both (haxelib and git) and for flash it was the standalone version (18) for html5 I use the edge browser... downloading chrome now to test. I'm on windows 10.

    posted in Kode read more
  • X
    x17head

    when I try to compile my kha project for flash I get an error upon launch:

    RangeError: Error #1125: The index 7 is out of range 7.
    at kha.audio2.ogg.vorbis.data::Residue/decode()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\data\Residue.hx:268]
    at kha.audio2.ogg.vorbis::VorbisDecoder/decodePacketRest()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\VorbisDecoder.hx:707]
    at kha.audio2.ogg.vorbis::VorbisDecoder/decodePacket()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\VorbisDecoder.hx:496]
    at kha.audio2.ogg.vorbis::VorbisDecoder/pumpFirstFrame()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\VorbisDecoder.hx:395]
    at kha.audio2.ogg.vorbis::VorbisDecoder$/start()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\VorbisDecoder.hx:77]
    at kha.audio2.ogg.vorbis::Reader$/readAll()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Sources\kha\audio2\ogg\vorbis\Reader.hx:104]
    at kha.flash::Sound()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Backends\Flash\kha\flash\Sound.hx:76]
    at MethodInfo-1014()[C:\Users\Nate\Documents\Projects\libdrpEmpty\kha\Backends\Flash\kha\flash\Loader.hx:145]
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at flash.net::URLLoader/onComplete()

    this happens whenever I try to load music or sound, also the sound WILL play on html5 but not music even when both are the same .wav file. both work on windows.

    the full source: https://github.com/x17head/libdrpEmpty

    posted in Kode read more
  • X
    x17head

    Its like posting in this forum is my therapy. So I created a new project and copied the source, project.kha, and the assets folder and now it builds. I'm glad I'm not crazy but lols.

    posted in Kode read more
  • X
    x17head

    My kha app crashes on start up nd for the life of me I cant figure out why. Here is the error in flash:

    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at kha::Loader/loadRoomAssets()[C:\HaxeToolkit\haxe\lib\kha\15,8,0\Sources\kha\Loader.hx:315]
    at kha::Loader/loadRoom()[C:\HaxeToolkit\haxe\lib\kha\15,8,0\Sources\kha\Loader.hx:322]
    at Duck/init()[C:\Users\Nate\Documents\Duck\Sources\Duck.hx:21]
    at kha::Game/loadFinished()[C:\HaxeToolkit\haxe\lib\kha\15,8,0\Sources\kha\Game.hx:66]
    at kha::Starter/onReady()[C:\HaxeToolkit\haxe\lib\kha\15,8,0\Backends\Flash\kha\Starter.hx:87]

    here is my app:

    class Duck extends Game {
    var backbuffer:Image;
    var loaded = false;
    public function new() {
    super("Duck");
    }

    override function init(): Void {
    	
    	backbuffer = Image.createRenderTarget(width, height);
    	Loader.the.loadRoom("default", Loaded);
    	
    }
    
    private function Loaded() {
    	loaded = true;
    }
    
    override function update(): Void {
    
    }
    
    override function render(frame: Framebuffer): Void {
    	
    	if (!loaded) return;
    	
    	var g = backbuffer.g2; 
    	g.begin();
    	g.clear(Color.Black);
    	
    	g.transformation = FastMatrix3.identity();
    	
    	g.drawImage(Loader.the.getImage("stuff"), 100, 100);
    	
    	g.color = Color.White;
    	
    	g.fillRect(20, 20, 40, 40);
    	
    	g.end(); 
    	 		 
    	startRender(frame);
    	Scaler.scale(backbuffer, frame, kha.Sys.screenRotation);
    	endRender(frame); 
    	
    }
    

    }

    and here is my project.kha file

    {
    "format": 3,
    "game": {
    "name": "Duck",
    "width": 640,
    "height": 480
    },
    "assets": [
    {
    "type": "image",
    "file": "stuff.png",
    "name": "stuff"
    }
    ],
    "rooms": [

    {
            "name": "default",
            "parent": null,
            "neighbours": [],
            "assets":
            [
                "stuff"
            ]
        }
    
    ]
    

    }

    thanks for your time.
    Nate

    I'm sorry it late and I cant figure out how to make the formatting look better.

    posted in Kode read more
  • X
    x17head

    To answer my own question, you don't have to 😛 I misunderstood how the project structure works. My source files are under the references instead of in a folder like how other haxe frameworks projects look in flashdevelop.

    posted in Kode read more
  • X
    x17head

    Hello all! First off I'm using the haxelib version. I can create and compile projects for my targets, but I can't for the life of me figure out how to make the 'core' flashdevelop project file. I'm using the empty project generated by the haxelib version. Thanks.

    posted in Kode read more

Looks like your connection to Kode Forum was lost, please wait while we try to reconnect.