Jump to content

  • Log In with Google      Sign In   
  • Create Account


MARS_999

Member Since 06 Mar 2001
Offline Last Active Jul 22 2014 01:32 PM
-----

Topics I've Started

PhysicsFS help needed to read a directories files

05 July 2014 - 04:50 PM

I am not following how one can use PhysicsFS to parse a directory for it's files and other directories... 

 

e.g. 

I want to parse my games map directory or texture directory how can I do this... I don't see a function to call to read the the directory.

 

Thanks


What are people using for a good GUI API with a layout editor...

30 June 2014 - 10:10 PM

I been looking at various GUI APIs and not really seeing much that is out there with a good tool set and works with SDL/OpenGL out of the box...

 

Anyone have any suggestions, would like a stand alone API not something like Unity ect... thanks!

 


XML reading issue help needed

28 June 2014 - 09:27 AM

Update nevermind it works already... SIgh!!!

 

 

 

I am not sure how to iterate over this XML document to get all the <tileset> fields so I can know at load time how many images to load?

 

Here is what I have but only reads the first set of data from the firstgid attribute

 

THis I can read and is all I get 

////

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="256" height="256" tilewidth="64" tileheight="64">
 <tileset firstgid="1" name="mud" tilewidth="64" tileheight="64">
  <image source="Mud.png" width="640" height="640"/>
 </tileset>
 

 

but I need to read something like this where I can load all tileset fields.

/// here is the many tileset data sets

 

<?xml version="1.0" encoding="UTF-8"?>
<map version="1.0" orientation="orthogonal" width="256" height="256" tilewidth="64" tileheight="64">
 <tileset firstgid="1" name="mud" tilewidth="64" tileheight="64">
  <image source="Mud.png" width="640" height="640"/>
 </tileset>
 <tileset firstgid="101" name="water" tilewidth="64" tileheight="64">
  <image source="Water.png" width="640" height="640"/>
 </tileset>
 <tileset firstgid="201" name="grass" tilewidth="64" tileheight="64">
  <image source="Grass.png" width="640" height="640"/>
 </tileset>
 
 
//tileset header
for (const tinyxml2::XMLElement* child = doc.FirstChildElement("map")->FirstChildElement("tileset");
child != 0; child = child->NextSiblingElement())
{
if (child->Attribute("firstgid"))
{
std::cout << "firstgid = " << child->Attribute("firstgid") << std::endl;
}
if (child->Attribute("name"))
{
std::cout << "name = " << child->Attribute("name") << std::endl;
}
if (child->Attribute("tilewidth"))
{
std::cout << "tilewidth = " << child->Attribute("tilewidth") << std::endl;
}
if (child->Attribute("tileheight"))
{
std::cout << "tileheight = " << child->Attribute("tileheight") << std::endl;
}
}

How to limit movement in glOrtho2D to only show map

18 June 2014 - 08:59 AM

How can I limit my movements when I scroll the window up/down/left/right to only show the tile map I have to render?

 

Say map is 640x640and viewport is 800x600?

 

Obviously 0, 0 is easy as that is the starting point and just test for if less than 0 but when try to move closer to the 640 width and height extent you have a -40 value... 

 

Sorry if I am not coming off clear but I am dead tired right now... :(


Best way to do mouse picking in 2D OpenGL

15 June 2014 - 01:30 AM

I am trying to decide what is the best way to do picking in OpenGL with glOrtho2D mode on a tile based game. Would using the color id method be better or would doing a ray test against each tile and sprite having an AABB around it?

 

Please advise and if possible give an example of code to do the picking based on your choice.

 

Thanks!


PARTNERS