Game Development Community

Radar Size (Matt Webster's Radar)

by Chris Byars · in Torque Game Engine · 03/03/2005 (5:26 pm) · 11 replies

The Radar Resource:
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2270

Got the radar working nicely, but when you change resolutions it messes up the image. How can I make it so the radar either remains 128x128 pixels no matter the resolution, or to resize with the screen resolution as "relative" to everything else.

(Yeah, I used "relative" for the width and height, doesn't work)

Know I need to code something in the .cc or .h.

#1
03/03/2005 (7:01 pm)
You need to change how the bitmap is projected, as a texture. I did this a few months ago but I'm not sure I still keep the changes somewhere. Anyway, if you read up abit on OpenGL and look around on the other GUI's, you will easily be able to change it so it does stretch with the res.
#2
03/04/2005 (4:14 am)
'cept I'm rather..unknowing when it comes down to the .cc files themselves. See if you can find it for me, otherwise I'll have to work on figuring out how things work in there.
#3
03/04/2005 (8:39 am)
I haven't touched C+ much before I got Torque, trust me- if you look at all radar resources (3?) and just check what opengl call they use to project the texture, you will have no problems applying it to Matt Websters Radar. I'm the traditional n00b, so you should be able to do it as well.

Edit: If I had the time, I would help you. But my codebase is currently a mess and the backups are at home. I'm not even sure the backups contain the changes.

Anyway, here is the part of the code that you need to change. Again, check the other resources (they project the textures relatively) and apply their solution to this one.

Line 240.
for(int x = 0; x < xdone; ++x) 
		{ 
			srcRegion.set(0,0,texture->bitmapWidth,texture->bitmapHeight); 
			
			dstRegion.set( ((texture->bitmapWidth*x)+offset.x)-xshift, 
		    	((texture->bitmapHeight*y)+offset.y)-yshift, 
				texture->bitmapWidth, texture->bitmapHeight); 
			dglDrawBitmapStretchSR(texture,dstRegion, srcRegion, false);
		}
#4
03/07/2005 (4:28 pm)
If you don't try you'll never learn
#5
03/15/2005 (4:00 am)
I dont have time to help you in terms of coding.

But if I were you, I would look at some of the other resources where images are scaled (e.g. the standard guiBitmapCtrl). Learn how they work, what is different in this resource and then apply the changes.

Try to understand the problem, how someone else fixed it and apply the new knowledge. Perfect little project for learning TGE code.
#6
03/17/2005 (5:42 pm)
Search the resources...
www.garagegames.com/index.php?sec=mg&mod=resource&page=view&qid=2006

The first comment entry by Matt Webster may be what you are looking for.
#7
04/16/2005 (1:34 pm)
Here's a bump.

I don't think that resource works it right. ThinkTanks seems to have gotten their radar able to resize correctly. So I bump this as to get the attention of any kind soul who has been able to successfully fix the radar. :(
#8
04/21/2005 (5:59 pm)
Alright. This is annoying. Both Leo Altmann and I, and probably many others have been straining their brains to find a solution to this radar to make it resize correctly on more than one resolution. There must be a way; Lore and ThinkTanks have done it. The only question is: How?
#9
04/21/2005 (7:48 pm)
C2... maybe it's time to storm the BT office and beat the info out of them?

Well.... that or just send a nice email :p

I could also do with finding out how.
#10
04/23/2005 (5:44 am)
Yeah, I'll drop an e-mail to them.
#11
04/23/2005 (6:43 am)
I almost gave you the solution above, if you don't try you won't ever get any serious work done.
Why don't you take a look at the code I posted, and then look at some GUI element that DOES resize with resolution, and then apply the same procedure to your radar, where I posted the code.

It's really simple. I'm not very perceptive in C++ so if you don't even want to try, then you won't get anywhere.
It's a matter of copy/paste and then tweak some values until it works like you want.