Jump to content

  • Log In with Google      Sign In   
  • Create Account

Awesome job so far everyone! Please give us your feedback on how our article efforts are going. We still need more finished articles for our May contest theme: Remake the Classics

ultramailman

Member Since 13 Oct 2012
Offline Last Active May 21 2013 03:12 PM
-----

#5040220 Best way to check endianness at run-time?

Posted by ultramailman on 06 March 2013 - 08:02 PM

char isn't guranteed to be one byte

I remember from somewhere that char is always one byte. Then short <= int <= long <= long long.
 
If you are worrying about this, why not use long or long long instead of int? They might be bigger than int.
 
int endianess(void)
{
        union{
                long long l;
                char c[sizeof(long long)];
        } n = {1};
        return n.c[0];
}
Also check out stdint.h, if the compiler you use supports it.


#5040048 Program won't show picture OR stop when told

Posted by ultramailman on 06 March 2013 - 11:16 AM

//quit the program
Quit == true;

 

This part needs some fixing.




#5039814 starting over

Posted by ultramailman on 05 March 2013 - 07:46 PM

Well, no one is stopping you (except yourself). : /




#5037930 Trouble with importing my own modules

Posted by ultramailman on 01 March 2013 - 01:10 AM

You are not using the variable WHITE anywhere though. If you want the surface to be white, you have to call fill on DISPLAY, then call flip.

 

Each file will have a separate, distinct pygame object (or whatever it is).

 

I think multiple imports of the same module will only have the effect of one import. The first will add the module object to a dict, and any other times it will just do a look up.




#5037890 What GUI Toolkit Would Be Best For My Game Editor?

Posted by ultramailman on 28 February 2013 - 09:48 PM

Ah, good for you. What made you decide to do this?




#5035948 What GUI Toolkit Would Be Best For My Game Editor?

Posted by ultramailman on 23 February 2013 - 07:05 PM

Have you used it? Which one do you recommend? Why?

I have not used GTK+ before. In fact, I have no experience with GUI programming. However, I have noticed a majority of programs on linux uses GTK+ or QT. Qt is C++, so that leaves GTK+. And like what Bearhugger said, GIMP is an example of a program that uses GTK+. Take a look at that to see if you like it.


#5035842 What GUI Toolkit Would Be Best For My Game Editor?

Posted by ultramailman on 23 February 2013 - 01:56 PM

Here you go
http://en.wikipedia.org/wiki/List_of_widget_toolkits#Based_on_C_.28including_bindings_to_other_languages.29

GTK is pretty common on linux, so maybe that?


#5034421 Pointers To Appendage Of File?

Posted by ultramailman on 19 February 2013 - 11:34 PM

fseek can be used to set the position of an open file stream, but it is only portable if your file is read and written in binary mode.

 

Is this what you mean?




#5033951 Putting pieces inside a board

Posted by ultramailman on 18 February 2013 - 05:36 PM

Ok, now I see what you mean. The array you are looking for is in the Grid class. You don't see it in the Board class because Grid has it. Is the Grid class available to you? You will have to see which methods of the Grid class allows you to change the array.


#5033836 Putting pieces inside a board

Posted by ultramailman on 18 February 2013 - 12:03 PM

If you mean writing the contents of a piece array into the board array, I think it should happen only when the pieces settles down, and not when it is still moving. So I don't think it belongs in the moveLeft method, unless I am misunderstanding you again.


#5033651 Putting pieces inside a board

Posted by ultramailman on 18 February 2013 - 01:10 AM

I guess I am confused again. When you say "putting a piece inside the board", do you mean when a new pieces comes into the view at the top? Or do you mean when the piece finally settles down and becomes a part of the board landscape?


#5033638 Putting pieces inside a board

Posted by ultramailman on 18 February 2013 - 12:18 AM

Oh I see what you mean, after thinking about how I would make a tetris clone.

I suppose I would keep the position of the shape that is currently dropping down, and not write the shape array into the content array until the shape hits bottom and becomes part of the unmoving blocks.


#5033125 Collision detection

Posted by ultramailman on 16 February 2013 - 02:02 PM

You can try checking for collision after the movement is done. If there is a collision, then undo the move. I think that will work for all three directions.


#5031174 Why isn't my array working?

Posted by ultramailman on 11 February 2013 - 02:01 PM

also,
for(i = 0; i < SIZE; i++)
    {
    array[i] = 0 //<- missing a semicolon here!
    }



#5030438 Frame rate handling

Posted by ultramailman on 09 February 2013 - 01:00 PM

Let's say we want 60 fps. 60 fps means 60 frames per 1000 milliseconds. That's around 16 or 17 milliseconds of time to update and render. If updating and rendering takes less than 16 milliseconds, then wait the remaining time to keep fps near 60.

Thats the gist of it. For further reading, check out an article called "Fix your Timestep!". It's more advanced, but don't let it confuse you.




PARTNERS