[QUOTE=Rowley;16383052][img]http://img370.imageshack.us/img370/3798/27247171.png[/img]
I got into the whole iso-madness. :D
Can anyone give me an idea on how to find which tile is being hovered over with the mouse?[/QUOTE]
( By the way this is from a [url=http://www.ziggyware.com/readarticle.php?article_id=244]tutorial[/url] I found in case anyone wants it )
[QUOTE=Catdaemon;16381464]I dunno. I just really, really hate XML. It's so much extra work on both ends for most purposes.
Personally I'd use the old fashioned ini style for what you're doing.
[code]
[skin]
name = awesome
[panel]
top_left = awesome_deco_tl.png
top_right = awesome_deco_tr.png
[/code][/QUOTE]
Eh, the NSCoder protocol reads straight from plists which is nice, but I just wish [i]it would indent things so the only way I can read it out isn't via the same goddamn code[/i]
[QUOTE=Rowley;16383052][img]http://img370.imageshack.us/img370/3798/27247171.png[/img]
I got into the whole iso-madness. :D
Can anyone give me an idea on how to find which tile is being hovered over with the mouse?[/QUOTE]
That makes me hot in my pants
I used a mask to do the tile selecting, I'm trying to find the gamedev article now.
[img]https://files.getdropbox.com/u/99765/selectionmask.png[/img]
I would suggest using tiles that don't overlap :
[img]http://cubeupload.com/files/c14400nonoverlapping.png[/img]
If you start adding objects that fit a whole grid square, this means none of it will end up getting a line of the ground drawn over it. The ground tile itself actually counts as that of course.
Also some of the tables have ground over them, but you probably realised.
There's ways around that
Like what?
[QUOTE=nullsquared;16381925]Because there's only a single [skin] category in the file :downs:. It's not hierarchical.[/QUOTE]
You could have [skin1], [skin2], [skin3], etc. And just a numSkins variable in another fixed category, or you just iterate over the categories, that way the category names doesn't matter.
[QUOTE=Z_guy;16392194]You could have [skin1], [skin2], [skin3], etc. And just a numSkins variable in another fixed category, or you just iterate over the categories, that way the category names doesn't matter.[/QUOTE]
I could either do that, or I could stop abusing categories and INI files, and instead use what was meant for the job - XML :downs:
[QUOTE=Rowley;16383052][img]http://img370.imageshack.us/img370/3798/27247171.png[/img]
I got into the whole iso-madness. :D
Can anyone give me an idea on how to find which tile is being hovered over with the mouse?[/QUOTE]
Did you ever get around to fixing the problem on the right?
Look:
[cpp]
skin::skin(const string &n):
_name(n)
{
txml::document doc;
doc.LoadFile((engine::DATA_DIR + "gui/skins/" + _name + "/" + _name + ".xml").c_str());
if (doc.Error())
{
engine::log("failed to load GUI skin " + _name);
return;
}
txml::element *rootElem = doc.RootElement();
for (txml::node *i = rootElem->FirstChild(); i; i = i->NextSibling())
{
pieceList &pl = _elements[i->Value()];
for (txml::node *j = i->FirstChild(); j; j = j->NextSibling())
{
txml::element *element = j->ToElement();
if (element)
{
piece &p = pl[element->Value()];
string tex = element->attrib<string>("image", string());
if (!tex.empty())
{
p.tex = "gui/skins/" + _name + "/" + tex;
Ogre::TexturePtr tex = gfx::getTexture(p.tex);
if (tex.get())
p.size = vec2(tex->getWidth(), tex->getHeight());
else
p.size = vec2(0, 0);
}
}
}
}
}
[/cpp]
It doesn't deal with multiple skins, but it automatically deals with any element type (widget type) and any piece type required for that element.
[b]Edit:[/b] Broke my automerge :P
[QUOTE=bigdoggie;16381371]Sounds like a book I should start reading, then :buddy:[/QUOTE]
Here is the 4th edition. You can preview a few hundred pages to see if it fits you. [url]http://books.google.com/books?id=zuyAIZ9ZIskC&printsec=frontcover&dq=stephen+prata&ei=JPVySumaOZv2ygSmrOzVAg&hl=sv#v=onepage&q=&f=false[/url]
[QUOTE=nullsquared;16380612]Working on skinning the GUI for portalized to make it more user friendly:
[code]
<skin name="awesome">
<panel>
<top_left image="awesome_deco_tl.png"/>
<top image="awesome_deco_t.png"/>
<top_right image="awesome_deco_tr.png"/>
<right image="awesome_deco_r.png"/>
<bottom_right image="awesome_deco_br.png"/>
<bottom image="awesome_deco_b.png"/>
<bottom_left image="awesome_deco_bl.png"/>
<left image="awesome_deco_l.png"/>
<middle image="awesome_deco_mi.png"/>
</panel>
</skin>
[/code][/QUOTE]
Thank you very much :D
[QUOTE=jmanmc;16392418]Did you ever get around to fixing the problem on the right?[/QUOTE]
Not yet. Just messing around with this in my spare time.
I've been doing some testing with 3D stuff in XNA.
[img]http://img370.imageshack.us/img370/5492/3dtest.jpg[/img]
Ha that looks so cool :D
[QUOTE=qurl;16390148]That makes me hot in my pants
I used a mask to do the tile selecting, I'm trying to find the gamedev article now.
[img]https://files.getdropbox.com/u/99765/selectionmask.png[/img][/QUOTE]
Hm that is an awesome idea, instead of checking every single tile, you only have to check one...
Well unfortunately, that doesn't work for square pieces :(
What I did for my tower defense, my tiles (square pieces) are basically stored in a 2d Array, and I transform the mouse position into a single tile by dividing the mouse position by the numbers of tiles on the screen.
Then I can access the exact tile that is on the mouse position in the array.
[editline]02:52PM[/editline]
[QUOTE=Dlaor;16393220]I've been doing some testing with 3D stuff in XNA.
[img]http://img370.imageshack.us/img370/5492/3dtest.jpg[/img][/QUOTE]
Nice, is that a model or a alpha mask? or what?
[QUOTE=s0ul0r;16393295]
Nice, is that a model or a alpha mask? or what?[/QUOTE]
It's an extremely high-poly model :v: And it doesn't even lag, while every polygon is drawn twice (reflection) and another time as shadow :buddy:
Starting A* pathfinding motherfucker
Flinging /dev/random into NSData objects into NSString objects into an NSKeyArchiver motherfucker
(holy shit, try to read 4096 bytes from an NSFileHandler and you leak memory like crazy and lock up)
[QUOTE=qurl;16393544]Starting A* pathfinding motherfucker[/QUOTE]
I tried that once, but they always ran into walls and got stuck, I did something wrong I guess.
I gave up after that, maybe I should try again...
[QUOTE=nullsquared;16380612]Working on skinning the GUI for portalized to make it more user friendly:
[code]
<skin name="awesome">
<panel>
<top_left image="awesome_deco_tl.png"/>
<top image="awesome_deco_t.png"/>
<top_right image="awesome_deco_tr.png"/>
<right image="awesome_deco_r.png"/>
<bottom_right image="awesome_deco_br.png"/>
<bottom image="awesome_deco_b.png"/>
<bottom_left image="awesome_deco_bl.png"/>
<left image="awesome_deco_l.png"/>
<middle image="awesome_deco_mi.png"/>
</panel>
</skin>
[/code][/QUOTE]
xml sucks
[QUOTE=garymode;16394557]xml sucks[/QUOTE]
What's the better alternative?
Cortex Command has a nice system, looks like this:
[code]AddAmmo = MOSParticle
PresetName = 10 oz Gold Brick
Mass = 0.283495
HitsMOs = 1
GetsHitByMOs = 0
SpriteFile = ContentFile
FilePath = Base.rte/Devices/10GoldBrick.bmp
FrameCount = 1
SpriteOffset = Vector
X = -3
Y = -2
AngularVel = 6
Atom = Atom
Material = Material
CopyOf = Gold
TrailLength = 0
Framerate = 10
AddAmmo = MOSParticle
PresetName = 24 oz Gold Brick
Mass = 0.680388
Sharpness = 0.8
HitsMOs = 1
GetsHitByMOs = 0
SpriteFile = ContentFile
FilePath = Base.rte/Devices/24GoldBrick.bmp
FrameCount = 1
SpriteOffset = Vector
X = -4
Y = -4
AngularVel = 6
Atom = Atom
Material = Material
CopyOf = Gold
TrailLength = 0
Framerate = 10
AddAmmo = MOSRotating
PresetName = 10 Gold Brick
Mass = 0.283495
HitsMOs = 0
GetsHitByMOs = 0
SpriteFile = ContentFile
FilePath = Base.rte/Devices/15GoldBrick.bmp
FrameCount = 1
SpriteOffset = Vector
X = -3
Y = -3
AtomGroup = AtomGroup
AutoGenerate = 1
Material = Material
CopyOf = Gold
Resolution = 2
Depth = 0
DeepGroup = AtomGroup
AutoGenerate = 1
Material = Material
CopyOf = Gold
Resolution = 6
Depth = 5
DeepCheck = 1[/code]
Not sure if it would be useful for your purpose.
Yes the indentation matters.
[QUOTE=Swebonny;16392521]Here is the 4th edition. You can preview a few hundred pages to see if it fits you. [url]http://books.google.com/books?id=zuyAIZ9ZIskC&printsec=frontcover&dq=stephen+prata&ei=JPVySumaOZv2ygSmrOzVAg&hl=sv#v=onepage&q=&f=false[/url][/QUOTE]
Thanks :buddy:
[QUOTE=nullsquared;16394704]What's the better alternative?[/QUOTE]
JSON, YAML, SXML, XSLT and many more.
Always an alternative.
[QUOTE=Rowley;16395057]JSON, YAML, SXML, XSLT and many more.
Always an alternative.[/QUOTE]
What's the [b]better[/b] alternative? What do any of those have over XML?
JSON is easier to parse I guess.
I've actually toyed around with idea of making a markup language heavily based on inheritance.
Something like
[code]
Pistol = Gun: //Inheritance from the gun object
{
Damage = 10
Name = "hurrr desurt eagul"
Position = vector:{x = 10, y = 100}
}[/code]
Edit: That would be called a data serialization language instead, apparently.
-snip-
[QUOTE=nullsquared;16395188]What's the [b]better[/b] alternative? What do any of those have over XML?[/QUOTE]
yaml is designed to be human readable, which can be an interesting feature when dealing with customization files (like VALVe's VMT files)
Sorry, you need to Log In to post a reply to this thread.