gonutz / prototype

Simple 2D game prototyping framework.

Home Page:https://pkg.go.dev/github.com/gonutz/prototype/draw

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Draw specific portion of image

mchampaneri opened this issue · comments

I want to use png sprit sheet. How I can render specific rectangle from sprit sheet in prototype ?

On it, wait for the next commit. This is one I wanted to do for some time now.

Are you on Windows? In that case you can try the new DrawImageFilePart function right now. Non-Windows builds will be fixed in a bit.

There is also a new sample in
https://github.com/gonutz/prototype/tree/master/samples/DrawImageFile
demonstrating a character animation from a texture atlas.

You can scale, flip and rotate sub-images with DrawImageFilePart.

@gonutz
I am using mac os x.

Oh great! I have actually never used a Mac and I do not test my library on mac. The GLFW and SDL2 backends should work, is it running fine for you? Do you get all input, can you render images and play sounds? I have not talked to a Mac user before about this library.

I am still trying to get any Linux up and running for fixing the GLFW and SDL2 ports. I just tried some Ubuntus but have to try something else now...

Alright, Linux Mint did the trick, I was able to fix the GLFW and SDL2 ports. They should work on Mac OS too. Could you try them out for me? GLFW is the default and for SDL2 you have to build with tag sdl2 like this:

go run -tags sdl2 main.go

I would really appreciate your feedback, thank you very much!

Oh great! I have actually never used a Mac and I do not test my library on mac. The GLFW and SDL2 backends should work, is it running fine for you? Do you get all input, can you render images and play sounds? I have not talked to a Mac user before about this library.

I have only tried mouse input and images. Will be trying keyboard and sound soon. But for image and mouse input it works fine.

Cool, thanks! I am going to leave this issue open until I hear back from you. You could try the shooter sample program. You move a rectangle with LEFT/RIGHT and shoot with SPACE. Every shot and every hit should output a sound. Thanks again, I really appreciate your help!

Cool, thanks! I am going to leave this issue open until I hear back from you. You could try the shooter sample program. You move a rectangle with LEFT/RIGHT and shoot with SPACE. Every shot and every hit should output a sound. Thanks again, I really appreciate your help!

Hi @gonutz ,

All left - right - spacebar keys are working. Sound output is even working. But Resource path function is not working for mac. Have make a pull-request please review and merge.

And yes,

There is also a new sample in
https://github.com/gonutz/prototype/tree/master/samples/DrawImageFile

This sample working on mac as well