• 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

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