Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package;
- import com.helpers.Point;
- import kha.Color;
- import kha.Framebuffer;
- import kha.Image;
- import com.imageAtlas.AtlasGenerator;
- import kha.Assets;
- import com.gEngine.tempStructures.Bitmap;
- class AtlasTest{
- var bitmapA:Bitmap = new Bitmap();
- var bitmapB:Bitmap = new Bitmap();
- var img:kha.Image = Image.createRenderTarget(2024,2024);
- var atlas:Image;
- var atlas2:Image;
- public function new(){
- Assets.loadEverything(onDone);
- }
- function onDone(){
- bitmapB.image = Assets.images.hero;
- bitmapB.width = bitmapB.image.width;
- bitmapB.height = bitmapB.image.height;
- bitmapB.x = 0;
- bitmapB.y = 0;
- bitmapB.extrude = 0;
- bitmapB.maxUV = new Point(1.0,1.0);
- bitmapB.minUV = new Point(0.0,0.0);
- bitmapA.image = Assets.images.tiles;
- bitmapA.width = bitmapB.image.width;
- bitmapA.height = bitmapB.image.height;
- bitmapA.x = 0;
- bitmapA.y = 0;
- bitmapA.extrude = 0;
- bitmapA.maxUV = new Point(1.0,1.0);
- bitmapA.minUV = new Point(0.0,0.0);
- atlas = AtlasGenerator.generate(2024,2024,[bitmapA,bitmapB]);
- atlas2 = AtlasGenerator.generate(2024,2024,[bitmapB,bitmapA]);
- kha.System.notifyOnFrames(onFrames);
- }
- function onFrames(a:Array<Framebuffer>){
- var g = a[0].g2;
- g.begin(true,Color.Cyan);
- g.drawImage(atlas,0,0);
- g.drawImage(atlas2,0,0);
- g.end();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement