| FBA The Creator http://www.fbacreator.com/fbaforum/ |
|
| drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) http://www.fbacreator.com/fbaforum/viewtopic.php?f=2&t=57 |
Page 1 of 1 |
| Author: | phrebh [ Fri Jun 20, 2008 5:15 pm ] | ||
| Post subject: | drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) | ||
I've come across some strange behavior when specifying parts of the image to draw. If cx2 and cy2 are not the right- and bottom-most edges of the image (respectively) then you need to add 1 to the values of each of them to get the part you want. In other words, cx1 and cy1 are using (0,0) for the upper-left corner of the source image, but cx2 and cy2 are using (1,1) for the upper-left corner of the source image. The really strange thing is that if cx2 is at the bottom-most part of the image it reverts back to the standard limit of (image width)-1, and if cy2 is at the right-most part of the image it reverts back to the standard limit of (image height)-1 In the image below, the blue lines cross at cx1, cy1, and the red lines cross at cx2, cy2, but in order to get the red lines to show up, you've got to use cx2+1 and cy2+1. ![]() I've included a sample project to show the problem.
|
|||
| Author: | evilmaio [ Fri Jun 20, 2008 6:20 pm ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
Yes, that's behaviour from gfx lib used (pocketfrog). I don't know why, but it works so I don't know if it's wanted by its original author ..but maybe in this way you can cut a part of a tile (let's say width/height: 30 pixel) without -1, for example: CELLWIDTH=30 CELLHEIGHT=30 XINDEX=4 YINDEX=3 drawimage(0,50,50,XINDEX*CELLWIDTH, YINDEX, XINDEX*CELLWIDTH+CELLWIDTH, YINDEX+CELLHEIGHT) (just a supposition, we should ask to Thierry |
|
| Author: | phrebh [ Fri Jun 20, 2008 6:52 pm ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
That makes a weird kind of sense. For now, I'm just going to add an offset when I call the function. This is one of those cases where it's more important to know how it works than to have the functionality "fixed". Thanks! |
|
| Author: | umbiomar [ Sat Jun 21, 2008 12:26 pm ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
WOW phrebh! i use that gfx lib since 2004 and i never discovered that. Are you stressing this smarty tool for the next cutting edge game? Can we see some shots? I'm definitely curious. |
|
| Author: | phrebh [ Sat Jun 21, 2008 5:25 pm ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
I am working on a game, too, but it's not cutting edge. I'll post it when I've got a working alpha version (probably not for a couple of weeks). |
|
| Author: | umbiomar [ Mon Jun 23, 2008 8:10 am ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
Nice to know you and welcome, we are game coders too like the majority of fba users. Just one question to leverage your knowledge about interfaces I recognize that, although focused on game programming, fba lacks of functions/api to build user interfaces (i mean input fields, buttons...). Do you know any libraries/technique to easily integrate skinnable GUI to fba? It will be great to have a set of lua modules (written in fba?) that read GUI info from an xml file. I know the author is busy at the moment enhancing fba providing such infos will free him some time googling around. |
|
| Author: | phrebh [ Mon Jun 23, 2008 10:17 am ] |
| Post subject: | Re: drawimage(handle, sx, sy, cx1, cy1, cx2, cy2) |
I wouldn't call myself a game coder, per se. I did have a game published, but as it was written in VB3, it doesn't have the credibility of most games, at least not anymore. I do a lot of php programming nowadays, so I can really appreciate scripting languages like Lua (which I had never heard of before FBA). I think it's made the transition to a new language easier. Even though I have little background in anything useful for FBA, I did spend some time looking around for some things. It looks like IrrLua might work. As far as using XML as a source for GUI stuff, I saw an article that talked about using XSLT to convert an XML document to a Lua table. This suggests to me that it might be better to just dispense with the XML all together and just use tables. Still it would be nice to have a collection of GUI items that we could just drop in to our code. It shouldn't be too hard to do in FBA, but it would require a lot of work. Since I am already working on an OSK module for my game, maybe when I'm done with the game I can work on an entire GUI module for all of the general things that are good to have. |
|
| Page 1 of 1 | All times are UTC |
| Powered by phpBB® Forum Software © phpBB Limited https://www.phpbb.com/ |
|