First commit

This commit is contained in:
2021-03-07 05:58:59 +01:00
commit 8204c6b556
18475 changed files with 3309357 additions and 0 deletions

28
hGameTest/src/App.hx Normal file
View File

@@ -0,0 +1,28 @@
import openfl.display.Sprite;
import openfl.display.Stage;
import openfl.events.Event;
class App extends Sprite {
public function new () {
super ();
var game:Game = new Game(stage);
game.onInit();
stage.addEventListener(Event.ENTER_FRAME, game.onEnterFrame);
}
static function main () {
var stage = new Stage (550, 400, 0xFFFFFF, App);
js.Browser.document.body.appendChild (stage.element);
}
}

33
hGameTest/src/Game.hx Normal file
View File

@@ -0,0 +1,33 @@
import openfl.display.Bitmap;
import openfl.display.Stage;
import openfl.display.Bitmap;
import openfl.display.BitmapData;
import openfl.display.Sprite;
import openfl.events.Event;
import openfl.Assets;
class Game
{
public var stage:Stage;
public function new(_stage:Stage){
stage = _stage;
}
public var player:Sprite;
public function onInit():Void
{
player = new Sprite();
stage.addChild(player);
//player.graphics.lineStyle(2,0xFF0000);
//player.graphics.drawRect(0,0,16,16);
var bitmapData:BitmapData = Assets.getBitmapData("sprites/character.png");
var playerBitmap:Bitmap = new Bitmap(bitmapData);
playerBitmap.scaleX = playerBitmap.scaleY = 10;
player.addChild(playerBitmap);
//Sys.
}
public function onEnterFrame(e:Event):Void
{
//player.x++;
//player.y++;
}
}

21
hGameTest/src/Main.hx Normal file
View File

@@ -0,0 +1,21 @@
import openfl.display.Sprite;
import openfl.display.Stage;
import openfl.events.Event;
class Main extends Sprite {
public function new () {
super ();
stage.frameRate = 1000;
var game:Game = new Game(stage);
game.onInit();
stage.addEventListener(Event.ENTER_FRAME, game.onEnterFrame);
stage.addEventListener(Event.RESIZE,onResize);
stage.application.window.resize(1920, 1080);
stage.application.window.title = "Kanker";
}
private function onResize (event:Event):Void {
//Here we can do shit with window scaling
//stage.stageWidth;
//stage.stageHeight;
}
}

View File

@@ -0,0 +1,16 @@
import openfl.display.BitmapData;
import openfl.display.Bitmap;
class SpriteSheet{
public static var spriteSheetArray:Array<SpriteSheet> = [];
public var sprites:Array<Bitmap> = [];
public function new(bmp:Bitmap = null, sprWidth:Int = 16, sprHeight:Int = 16){
spriteSheetArray.push(this);
var columns:Int = cast((bmp.width / sprWidth),Int);
var rows:Int = cast((bmp.height / sprHeight),Int);
for(i in 0...columns){
for (j in 0...rows){
}
}
}
}