Recent Posts

Sure, drawSubImage() is used in this way. To set a color to tint the tile just use g2.color before your draw call...

public function render(framebuffer: Framebuffer): Void {

framebuffer.g2.begin();
framebuffer.g2.color = Color.Red;
framebuffer.g2.drawSubImage(Assets.images.tileset, 256, 256, 0, 0, 32, 16);
framebuffer.g2.end();

}

This would draw a red tinted 32 pixel by 16 pixel tile from the upper left of the tileset to the position of (256, 256) in the display window. Hope that gives you what you're looking for.

Cheers

posted in Kha read more

Yes Robert, thank you. Your suggestion indeed worked.

For convenience I split my assets up into two categories, one for images I wish to have access to pixel data (eg. sprite) and another for those which the data is not required (eg. logos, backgrounds) and composed it in the khafile like so.

...
projectName.addAssets('Assets/Resources/** ' )
projectName.addAssets('Assets/Readable/** ', {readable: true});
...

I appreciate your insight, cheers.

posted in Kha read more

I'm looking to use isOpaque on C++ and see that an Image must be loaded with readable=true to be accessed this way. I have been using Assests.loadeverything, but for this functionality I've implemented Assets.loadImageFromPath. It feels less graceful though and if the file path resides in Assests is it not double loaded and would not be accessed through Assests.images.Image?

Is there a way to set readable to true for a partiular image before loadeverything or change it afterwards?

Thanks in advance!

posted in Kha read more

Brilliant! That did the trick. Thank you for the quick response.
Kode Studio outputs...

Compiling...
Visual Studio not found.
--compile not yet implemented for this platform
Done.

Though, the VS project files are created and I'm able to open and compile them properly in VS 2017. Have a wonderful evening.

Cheers

posted in Kode Studio read more

Greets,

I'm trying to compile to a Visual Studio project from Kode Studio and receive...

"ERROR: Cannot determine the location of the VS Common Tools folder."

I've Visual Studio 2017 installed and believe Microsoft no longer adds ...\Common7\Tools\ to Windows environment variables. Might this be my problem, does Kode Studio use vswhere to find VS 2017 path? Any insight into how I can Kode Studio to compile is greatly appreciated.

Thanks in advance!

posted in Kode Studio read more