FBA The Creator

The True Multiplatform PC / PocketPC Opensource Development Tool - Read Only Mode - Kept only for historical purposes - Thank you all ;)
It is currently Thu Jun 04, 2026 3:49 am

All times are UTC




Post new topic  Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Jun 20, 2008 5:15 pm 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
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.

Image

I've included a sample project to show the problem.


Attachments:
File comment: Example.
partImageTest.zip [1.03 KiB]
Downloaded 1447 times
Top
   
PostPosted: Fri Jun 20, 2008 6:20 pm 
Offline
FBA Administrator
FBA Administrator
User avatar

Joined: Fri Mar 21, 2008 11:19 pm
Posts: 238
Location: Rome - Italy
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 :D)


Top
   
PostPosted: Fri Jun 20, 2008 6:52 pm 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
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!


Top
   
PostPosted: Sat Jun 21, 2008 12:26 pm 
Offline
Feejo Member
Feejo Member
User avatar

Joined: Fri Mar 28, 2008 8:07 am
Posts: 64
Location: Italy
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? :D

Can we see some shots? I'm definitely curious.

_________________
Regards,

umbiomar
[email protected]


Top
   
PostPosted: Sat Jun 21, 2008 5:25 pm 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
:lol: Actually, I decided to help out by doing a calculator for a demonstration of user input (that came up in some other topic). I happen to be one of those weirdos who does graphics and coding, and I like everything to be exact with my interfaces (which probably comes from doing so many Winamp skins).

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).


Top
   
PostPosted: Mon Jun 23, 2008 8:10 am 
Offline
Feejo Member
Feejo Member
User avatar

Joined: Fri Mar 28, 2008 8:07 am
Posts: 64
Location: Italy
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.

_________________
Regards,

umbiomar
[email protected]


Top
   
PostPosted: Mon Jun 23, 2008 10:17 am 
Offline
Tutorials Contributor
Tutorials Contributor
User avatar

Joined: Tue Jun 17, 2008 3:39 am
Posts: 59
Location: Midwest, US
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.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 7 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Limited