[Factor-talk] images: new words to handle sprites and extract parts of an image
Hi, For a small game that I was making in order to get accustomed to factor, I needed to load textures from a sprite sheet. Basically, I wanted to take an image and split it into pieces of fixed dimensions. I wasn't able to find words to help me there (may be there are and I am unaware). So I ended up introducing a few new words: new-image-like: create a new empty image having properties of an existing image but with modified dimensions image-part: extract a part of an image into a separate image generate-sprite-sheet: given an image, produce a sequence of images having fixed width and heights These new words can be seen implemented here: https://github.com/rationalrevolt/factor-practice/blob/master/images/sprites/sprites.factor A small test program using these words is present here: https://github.com/rationalrevolt/factor-practice/blob/master/sprite-test/sprite-test.factor If these are useful, could someone recommend a vocabulary that could contain them? The words new-image-like and image-part could reside in the images vocab. I'm not sure where the generate-sprite-sheet word could fit in or if it is sufficiently useful to include. Thanks, Sankar -- ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] images: new words to handle sprites and extract parts of an image
We welcome all contributions! It's alright if you want to put these words into a new vocabulary in extra and then migrate them somewhere else after you get a sense of how useful they are. Or if you feel they fit somewhere in particular, by all means send a pull request! You might want to check out Papier, which is a sprite-based game that is kinda a fun example of some Factor GL stuff: https://github.com/jckarter/papier Should run on 0.97 and latest code: "/path/to/papier" add-vocab-root "papier" run On Sun, Nov 29, 2015 at 8:48 AM, Sankaranarayanan Viswanathan < rationalrev...@gmail.com> wrote: > Hi, > > For a small game that I was making in order to get accustomed to factor, > I needed to load textures from a sprite sheet. Basically, I wanted to > take an image and split it into pieces of fixed dimensions. I wasn't > able to find words to help me there (may be there are and I am unaware). > So I ended up introducing a few new words: > > new-image-like: create a new empty image having properties of an > existing image but with modified dimensions > > image-part: extract a part of an image into a separate image > > generate-sprite-sheet: given an image, produce a sequence of images > having fixed width and heights > > These new words can be seen implemented here: > > https://github.com/rationalrevolt/factor-practice/blob/master/images/sprites/sprites.factor > > A small test program using these words is present here: > > https://github.com/rationalrevolt/factor-practice/blob/master/sprite-test/sprite-test.factor > > If these are useful, could someone recommend a vocabulary that could > contain them? The words new-image-like and image-part could reside in > the images vocab. I'm not sure where the generate-sprite-sheet word > could fit in or if it is sufficiently useful to include. > > Thanks, > Sankar > > > > -- > ___ > Factor-talk mailing list > Factor-talk@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/factor-talk > -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] images: new words to handle sprites and extract parts of an image
I don't believe I ever implemented atlases in that demo. I did write a quick and dirty atlas generator in extra/images/atlas you might be able to start with: http://docs.factorcode.org/content/vocab-images.atlas.html On Monday, November 30, 2015, John Benediktsson wrote: > We welcome all contributions! It's alright if you want to put these words > into a new vocabulary in extra and then migrate them somewhere else after > you get a sense of how useful they are. Or if you feel they fit somewhere > in particular, by all means send a pull request! > > You might want to check out Papier, which is a sprite-based game that is > kinda a fun example of some Factor GL stuff: > > https://github.com/jckarter/papier > > Should run on 0.97 and latest code: > > "/path/to/papier" add-vocab-root > > "papier" run > > > > On Sun, Nov 29, 2015 at 8:48 AM, Sankaranarayanan Viswanathan < > rationalrev...@gmail.com > > wrote: > >> Hi, >> >> For a small game that I was making in order to get accustomed to factor, >> I needed to load textures from a sprite sheet. Basically, I wanted to >> take an image and split it into pieces of fixed dimensions. I wasn't >> able to find words to help me there (may be there are and I am unaware). >> So I ended up introducing a few new words: >> >> new-image-like: create a new empty image having properties of an >> existing image but with modified dimensions >> >> image-part: extract a part of an image into a separate image >> >> generate-sprite-sheet: given an image, produce a sequence of images >> having fixed width and heights >> >> These new words can be seen implemented here: >> >> https://github.com/rationalrevolt/factor-practice/blob/master/images/sprites/sprites.factor >> >> A small test program using these words is present here: >> >> https://github.com/rationalrevolt/factor-practice/blob/master/sprite-test/sprite-test.factor >> >> If these are useful, could someone recommend a vocabulary that could >> contain them? The words new-image-like and image-part could reside in >> the images vocab. I'm not sure where the generate-sprite-sheet word >> could fit in or if it is sufficiently useful to include. >> >> Thanks, >> Sankar >> >> >> >> -- >> ___ >> Factor-talk mailing list >> Factor-talk@lists.sourceforge.net >> >> https://lists.sourceforge.net/lists/listinfo/factor-talk >> > > -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk
Re: [Factor-talk] images: new words to handle sprites and extract parts of an image
Perhaps you can add it to some of the vocabs in the images.* hierarchy? I think images.tesselation or images.processing would be suitable. Also see the tesselate word, if I'm not mistaken it does the same thing as your generate-sprite-sheet word. But there is nothing like your image-part and new-image-like words afaict, so those would be useful. But maybe you should rename image-part to crop-image? Cutting a smaller image from an existing one is a cropping operation. > For a small game that I was making in order to get accustomed to factor, > I needed to load textures from a sprite sheet. Basically, I wanted to > take an image and split it into pieces of fixed dimensions. I wasn't > able to find words to help me there (may be there are and I am unaware). > So I ended up introducing a few new words: > > new-image-like: create a new empty image having properties of an > existing image but with modified dimensions > > image-part: extract a part of an image into a separate image > > generate-sprite-sheet: given an image, produce a sequence of images > having fixed width and heights > > These new words can be seen implemented here: > https://github.com/rationalrevolt/factor-practice/blob/master/images/sprites/sprites.factor > > A small test program using these words is present here: > https://github.com/rationalrevolt/factor-practice/blob/master/sprite-test/sprite-test.factor > > If these are useful, could someone recommend a vocabulary that could > contain them? The words new-image-like and image-part could reside in > the images vocab. I'm not sure where the generate-sprite-sheet word > could fit in or if it is sufficiently useful to include. -- mvh/best regards Björn Lindqvist -- Go from Idea to Many App Stores Faster with Intel(R) XDK Give your users amazing mobile app experiences with Intel(R) XDK. Use one codebase in this all-in-one HTML5 development environment. Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs. http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140 ___ Factor-talk mailing list Factor-talk@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/factor-talk