Page 1 of 3
Arcade InterfaceTexturedRect
Posted: Tue Feb 03, 2004 3:44 pm
by LegoGirl
I'm having a little trouble with "InterfaceTexturedRect". My texture is 512x512 with 16x16pixel images on it (giving 32x32 images).
Drawing image 0 is fine so it looks like the height and width are correct. But other images (when fU and fV are not zero) don't appear correctly.
Any ideas?
Code: Select all
int nX = nImage % 32;
int nY = nImage / 32;
float fU = (1.0f/32.0f) * (float)nX;
float fV = (1.0f/32.0f) * (float)nY;
float fUWidth = 1.0f/32.0f;
float fUHeight = 1.0f/32.0f;
InterfaceTexturedRect(
0, gnSpritesOverlay,
nScreenX, nScreenY,
16, 16,
0xFFFFFFFF,
fU, fV,
fUWidth, fUHeight );
And I should probably add that the following does work....I just don't want square textures
Code: Select all
InterfaceSprite(
0, gnSpritesOverlay,
nScreenX, nScreenY,
1.0f/32.0f,
nImage,
0xFFFFFFFF,
0.0f, 0.0f );
Posted: Tue Feb 03, 2004 4:55 pm
by Mit
oooh lego playing with the arcade? wooohooo!!! :]
ah ok.. um.. thats either a docs issue or a code bug depending on which bit seems wrong
The final two parameters should actually be U2 and V2.. i.e. they're not width and height, they're the absolute positions of the bottom right hand texture coord.
soo...
float fUWidth = fU + 1.0f/32.0f;
float fUHeight = fV + 1.0f/32.0f;
..should fix it.
Any preference for whether i change the code or docs to fix that properly?
Posted: Tue Feb 03, 2004 5:00 pm
by LegoGirl
Excellent. That sorted it out.
I'd just fix the doc and header file, saves breaking the thousands of games already written
Posted: Tue Feb 03, 2004 5:03 pm
by Mit
*cough* ok :]
nice to see you around btw
cant wait to see what u come up with :].
when you next in town for a beer?
Posted: Tue Feb 03, 2004 5:10 pm
by LegoGirl
when you next in town for a beer?
Whenever the next "event" takes place. Just give us a shout.
Posted: Tue Feb 03, 2004 5:34 pm
by LegoGirl
Just got a...
Code: Select all
**** Error Message ****
Too many rectanges added to a textured overlay
...so what's the limit then?
Posted: Tue Feb 03, 2004 6:05 pm
by Mit
apparently its 64.
which is a bit crap really
is 512 enough? This patch ups the limit, as well as fixing up the other texturerect stuff in the header...
http://gameislands.net/InterfacePatch1Feb04.zip
Lemme know if you think you'll want more than that - is no problem increasing the limit some more if needs be.
and right.. i better get arrangin some sort of 'event' soon then. Isnt early march the anniversary of LMA becoming Number 1! ?
(I have no idea, of course, but any excuse for a pansy will do..)
Posted: Tue Feb 03, 2004 7:33 pm
by Mattizme
Thanks for upping it, Mit, was gonna ask that at some point myself..
Do I hear something about a pansy-up? any chance a coupla 'youths' like Me and Tom can gatecrash?
Posted: Tue Feb 03, 2004 7:41 pm
by Tom
hehe mattizme has got my back
heh you know me too well
Posted: Wed Feb 04, 2004 12:54 pm
by LegoGirl
is 512 enough?
That's just fine...for now
Thanks.
Posted: Thu Feb 05, 2004 12:04 pm
by LegoGirl
That's just fine...for now
And now it isn't...tish..
I'll just keep hitting "Ignore" for now. Could it be game selectable or will that break a whole lotta stuff?
Posted: Thu Feb 05, 2004 4:22 pm
by Mit
ooh, so what u doin thats using more than 512 sprites? :] is it pretty?
No problem to change it.
Previously it was a fixed size buffer for each layer (maximum 16 layers with 512 in each), so ive change it to a nice lil pool shared between the layers instead.
The current default is 1024 shapes max, but ya can change that at runtime using
InterfaceSetGlobalParam( INTF_TEXTURERECT_LIMIT, <Value> );
with <Value> obviously defining the maximum number of shapes ya can have on screen at once. Theres a overhead of about 48 bytes per shape so you should be safe using even pretty silly values in there. :]
Theres still the limit of 16 different layers to use - thats on a define so i can up it easily if needs be, but would be a bit trickier to make that dynamic... assuming thats not a problem yet anyway..
Heres a new zip of the arcade stuff with that and the line fix in it..
http://i-lands.net/ArcadeSource1Feb04.zip
(p.s. course.. i aint actually properly tested any of it ;] )
Posted: Thu Feb 05, 2004 5:00 pm
by LegoGirl
Um. There might be a bug in there. After playing for a little while the arcade machine screen is going blank..tho once I had a line still visible but all of the sprites and rects had gone. It seems to be getting into an infinite loop somewhere in interface.
Posted: Thu Feb 05, 2004 5:47 pm
by Mit
prolly should have properly tested it then
had a quick look for anythin obvious and tidied up so bits.. see if
http://i-lands.net/intpatch2feb04.zip
..works any better? It seems to cope with the invaders game ok but then thats not exactly pushin it. If it still dont work ill set up a more thorough test later this evenin
Posted: Thu Feb 05, 2004 7:33 pm
by LegoGirl
Ah..yes that's fixed it...ta
Does the "layer" parameter really work? I can't seem to move things forward.
Posted: Thu Feb 05, 2004 11:21 pm
by Mit
phew
um, not really
.. works for fonts on 0,1 or 2, and untextured rectangles on 0 or 1, but i only jus added it for the draw methods in general and havent done the implentation yet. Anythin ya need doin sooner rather than lata?
Posted: Fri Feb 06, 2004 10:59 am
by LegoGirl
Ah, that explains stuff. I'll just pretend they work for now. Right now I'm only using TexturedRects so when you get a sec that's the one to do (for me anyway
). 3 layers should make it look ok.
Posted: Fri Feb 06, 2004 4:25 pm
by Mit
k, will do. Im away at the weekend so it'll probably be monday before i can get that to ya.
Posted: Mon Feb 09, 2004 3:09 pm
by LegoGirl
While you're looking at it could you check to see if you're doing something
"special" when nX and nY are
both -1.
Code: Select all
InterfaceTexturedRect(
0, gnCharSetOverlay,
-1, -1, // <-- This right 'ere
8, 8,
0xFFFFFFFF,
fU1, fV1, fU2, fV2 );
Posted: Mon Feb 09, 2004 4:33 pm
by Mit
Yeh, -1, -1 is used to denote an image that should be centered on the screen. Did i not mention that in the docs? ;]
Can be changed if its a problem? .. (tho anything less than 0 really isnt a valid param for the coordinate).