Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 18 Mar 2012
Offline Last Active Dec 25 2013 01:03 PM

Posts I've Made

In Topic: Best way to check endianness at run-time?

10 March 2013 - 12:49 PM

Thanks for all the info, you've all gave me different aspects to consider when I decide to switch my map format over to binary.  Think I'm gonna save that task for after mid-terms though.

In Topic: How Do I Make a Level Editor

10 March 2013 - 12:07 PM

A level editor is just a program that creates files.  How it does this is totally up to you.  You pick what data is necessary to save from the map (images to load, positions of objects, etc.).  You either have your level editor save this as plain text, or you save it as binary (raw bytes).


Your game will have a function for loading the map from a file.  How this function works will depend completely on how you wrote your save function (since it's effectively reversing it). 


If you're asking how to create the GUI for the level editor, then it depends.  You can use SDL, SFML, Allegro, or any other graphics library if you're up for creating a bunch of form elements (picture boxes, menus, textboxes, etc.)  I think SDL has some 3rd party add-ons that help with that, not 100% on that though, haven't used it in a while.  Last I knew, SDL was capable of loading PNG's through SDL_image.  (windows binaries should be pre-built with it, in linux I assume it would have it as long as it compiled succesfully and found an appropriate version of libpng). 


Another option would be to use something like FLTK (pronounced full-tick).  This is a library for creating GUI's and would probably make creating your level editor a lot quicker.



As for tutorials...googling SDL tutorials dropped these as the first two links:


but it's always good to read the API:
So in short, what you want to learn:
SDL, SFML, Allegro (your game, maybe your level editor, research these libraries, pick the best one for what you're making)
C++ filestreams (loading and saving files)
GUI-creation (graphic user interface for your level editor)
How to use libraries (SDL is a library, FLTK is a library...libraries are your friend, learn to use them)
How to read and understand API manuals (A library could be the most amazing thing on earth, if it doesnt have good documentation its useless)
Or you could just use someone elses level editor and just have a function in your game that knows how to read their map files.


In Topic: Best way to check endianness at run-time?

06 March 2013 - 11:50 PM

Yeah the bool endianness was something I found online - ENDIAN getEndian() is what I was planning on calling it, returning an enumerated type defined right above it.

Am I developing on multiple machines? No - I would like to develop with more than just my machines architecture in mind though. The library I'm more or less extending does all the low-level stuff inside. Not a whole lot of binary manipulation going on at my end. Except I am designing a binary file format to store map data and if someone creates a map on a big-endian system, and someone else loads it on a little-endian system it's either going to crash, or load something crazy.

Awesome point about the constant sized data types - I will probably go that route.

I have very little experience in cross-platform support, so if you wanna throw some links at me with some essential "you should know this so you don't f*ck everything up" type of info in it, I'd be appreciative, but other than loading binary file formats and data types being different sizes on different platforms I don't really see what platform specific code I'd need.

I'll do more research later, right now I need to get to bed though...2 back to back math tests in 6 hours...yay *sarcasm*

Edit: Cornstalks - just saw your post - awesomely informative and cleared up a lot of the gray area

In Topic: Best way to check endianness at run-time?

06 March 2013 - 08:34 PM

@ultramailman: Because so far I've read about systems with 16-bit, 24-bit, and 32-bit chars, some having a int the same size as char, and some having the same size long as int (though I don't really know the point of that) I agree that it should work with most systems if i were to evaluate something the size of char out of something the size of long long, it just seems bad practice to write something I know won't work in every situation. 


@Bregma: No, I suppose this could happen at compile time, not sure how to go about that either though.  Seems like it'd be easier to do at run-time.

In Topic: Possible C++ scope issue with class and vector of pointers

12 January 2013 - 08:26 PM

You guys are awesome, thanks for all the info and quick response times.  The problem is now completely fixed and I learned a bit more about vectors.  I'll definitely be coming back next time I hit another snag I can't figure out.