• What are you working on? V7
    2,001 replies, posted
Well I was working on some OpenGL, trying to get my matrix classes to play nice. ( it's supposed to be translating that square left and right :P ) Edit: It was a long shot for HTML5 in the media tags, but oh well. [url]http://sliceofmuffin.com/awesum.ogv[/url] Then Kylegar had some homework so I did that for kicks. [cpp] #include "sorted_array.h" #include <stdio.h> #include <string.h> static int compare(void *a, void *b) { int c = *(int *)a; int d = *(int *)b; if(c == d) return 0; else if(c < d) return -1; else return 1; } int main() { SortedArray *array = sorted_array_new(sizeof(int), compare); int n = 18; sorted_array_insert(array, &n); n = 16; sorted_array_insert(array, &n); n = 15; sorted_array_insert(array, &n); sorted_array_insert(array, &n); n = 17; sorted_array_insert(array, &n); printf("Array before:\n"); for(int i = 0; i < sorted_array_length(array); i++) { int *num = sorted_array_at(array, i); printf("Number %i is %i\n", i, *num); } sorted_array_remove_at(array, 3); printf("Array after:\n"); for(int i = 0; i < sorted_array_length(array); i++) { int *num = sorted_array_at(array, i); printf("Number %i is %i\n", i, *num); } n = 15; sorted_array_remove(array, &n); printf("Array after after:\n"); for(int i = 0; i < sorted_array_length(array); i++) { int *num = sorted_array_at(array, i); printf("Number %i is %i\n", i, *num); } sorted_array_free(array); return 0; } [/cpp] [code] Array before: Number 0 is 15 Number 1 is 15 Number 2 is 16 Number 3 is 17 Number 4 is 18 Array after: Number 0 is 15 Number 1 is 15 Number 2 is 16 Number 3 is 18 Array after after: Number 0 is 16 Number 1 is 18 [/code]
Needs more macro templating!
[cpp] if(c == d) return 0; else if(c < d) return -1; else return 1; [/cpp] Why not.. [cpp]return ((c == d) ? 0 : ((c < d) ? -1 : 1));[/cpp]
[QUOTE=Eleventeen;20021116][cpp] if(c == d) return 0; else if(c < d) return -1; else return 1; [/cpp] Why not.. [cpp]return ((c == d) ? 0 : ((c < d) ? -1 : 1));[/cpp][/QUOTE] Because it produces the same code, while the former is instantly readable and much less error prone.
Oh, okay.
[QUOTE=gparent;20009099] Class definitions should be in a header file ("C.hpp"). That header file should also include any other file necessary for the [i]definition of the [b]class[/b][/i] to compile properly. This means that if we use the example above, in "C.hpp" you would have [b]no[/b] includes, only header guards. In [b]C.cpp[/b], you would #include "C.hpp", as well as <iostream>, because C::foo() uses std::cout. But you shouldn't include iostream in "C.hpp", because it's not needed there.[/QUOTE] A bit late but I have a question: Is there any real difference between .h and .hpp? I don't know if this is a wrong method, but I put my class definitions in Class.h and include that in Class.cpp, then include Class.h in any program that needs it etc. Or is it just a naming convention for header files?
[QUOTE=gilly_54;20021703]A bit late but I have a question: Is there any real difference between .h and .hpp? I don't know if this is a wrong method, but I put my class definitions in Class.h and include that in Class.cpp, then include Class.h in any program that needs it etc. Or is it just a naming convention for header files?[/QUOTE] No real difference, the general pairing is .h with .c files and .hpp with .cpp files. Won't make any difference though. You can give your files any extension you wish and they should still compile fine (ie you could name them class.jpg and class.mp3 if you wanted to). A lot of c++ tutorials use cpp and h, and the only example of hpp being used is in the SFML headers.
[QUOTE=Mattz333;20021857]No real difference, the general pairing is .h with .c files and .hpp with .cpp files. Won't make any difference though. You can give your files any extension you wish and they should still compile fine (ie you could name them class.jpg and class.mp3 if you wanted to). A lot of c++ tutorials use cpp and h, and the only example of hpp being used is in the SFML headers.[/QUOTE] Erm, Boost? You know, *the* most important 3rd party C++ library. That's where I picked it up from. But as you said, it's unimportant, I just use it as a nice hint that "This header file won't work in C".
[QUOTE=gparent;20022046]Erm, Boost? You know, *the* most important 3rd party C++ library. That's where I picked it up from. But as you said, it's unimportant, I just use it as a nice hint that "This header file won't work in C".[/QUOTE] I've never used boost, is it any good? :v:
[QUOTE=Mattz333;20022114]I've never used boost, is it any good? :v:[/QUOTE] [url]http://www.boost.org/[/url] It's almost like an extended standard library.
[img]http://cdn.solidfiles.net/i/Nyj4.png[/img] I set him on fire and trapped him inside ice. Then I realize I should probably make the ice melt if you hit a fireball on it. Maybe, maybe...
[IMG]http://img684.imageshack.us/img684/8024/screenshot0183.png[/IMG] [IMG]http://img208.imageshack.us/img208/6867/screenshot0185.png[/IMG] I can only imagine that fleet captain staring in horror as that swarm of ships floods into their home system, purging everything with huge red lasers. Anywho[i][sic][/i], turns out the movement system isn't perfect just yet. As you can see, not all the ships are 'participating' in the big 'welcome party' being hosted in the enemy's home system. Whenever they get outside the system they're attacking they sort of stop and scratch their heads, confused as to what they were doing. I think I know what the problem is but I found it kind of funny that half the fleet is just sitting back, relaxing, and enjoying the fireworks.
[QUOTE=garry;20010631]Performance is lowish in the editor - because of the font rendering, so it isn't unknown to go as low as 60fps. In game those scenes are 200fps+ (but I need to fix a bug with brush rendering that should double that)[/QUOTE] What sort of spec is the machine you are testing it on though. I'm sure it won't run quite so well on my machine.
[QUOTE=Firgof Umbra;20024222] *Space Images* I can only imagine that fleet captain staring in horror as that swarm of ships floods into their home system, purging everything with huge red lasers. Anywho[i][sic][/i], turns out the movement system isn't perfect just yet. As you can see, not all the ships are 'participating' in the big 'welcome party' being hosted in the enemy's home system. Whenever they get outside the system they're attacking they sort of stop and scratch their heads, confused as to what they were doing. I think I know what the problem is but I found it kind of funny that half the fleet is just sitting back, relaxing, and enjoying the fireworks.[/QUOTE] IMO you can't see what's going on there in any way...
[quote]IMO you can't see what's going on there in any way... [/quote] Well, not the red lasers or anything certainly. Too far away. But the first image is the fleet just hanging out outside the system that's under attack; the second is looking at the fleet from another system. If they were behaving properly, they would all be 'snaking' rather than there being a big clump outside the system. (The system ends where that ring's border ends) Hm. On a second stare, I can see why you wouldn't be able to tell the clumping from the snaking other than the more obvious first snake. Perhaps that ought to be improved too.
[QUOTE=garry;20010631]Performance is lowish in the editor - because of the font rendering, so it isn't unknown to go as low as 60fps. In game those scenes are 200fps+ (but I need to fix a bug with brush rendering that should double that)[/QUOTE] Why would the text slow it down? The GUI is only rendered once and then everytime something changes, right?
[QUOTE=Robber;20025151]Why would the text slow it down? The GUI is only rendered once and then everytime something changes, right?[/QUOTE] I think he said it was something to do with d3dx's text rendering.
[QUOTE=blankthemuffin;20020974]Well I was working on some OpenGL, trying to get my matrix classes to play nice. ( it's supposed to be translating that square left and right :P ) Edit: It was a long shot for HTML5 in the media tags, but oh well. [url]http://sliceofmuffin.com/awesum.ogv[/url] Then Kylegar had some homework so I did that for kicks. [/quote] The fun part was inserting 80000 elements into it, then searching 80000 times.
[QUOTE=Eleventeen;20021116][cpp] if(c == d) return 0; else if(c < d) return -1; else return 1; [/cpp] Why not.. [cpp]return ((c == d) ? 0 : ((c < d) ? -1 : 1));[/cpp][/QUOTE] Personally, I prefer [cpp] if( c == d ) return 0; return ( c < d ) ? -1 : 1; [/cpp] But to each his own
[QUOTE=Firgof Umbra;20024222]*outerspace* I can only imagine that fleet captain staring in horror as that swarm of ships floods into their home system, purging everything with huge red lasers. Anywho[i][sic][/i], turns out the movement system isn't perfect just yet. As you can see, not all the ships are 'participating' in the big 'welcome party' being hosted in the enemy's home system. Whenever they get outside the system they're attacking they sort of stop and scratch their heads, confused as to what they were doing. I think I know what the problem is but I found it kind of funny that half the fleet is just sitting back, relaxing, and enjoying the fireworks.[/QUOTE] There you are, where's my beta key? :v: Also, all of those overlay icons are way too big. To say the screen was cluttered would be a huge understatement.
Making a particle editor for my game, it should make some stuff easier for me [IMG]http://i49.tinypic.com/2agqk39.png[/IMG]
8000 elements ey? Yeah I'd probably want to make the allocator more efficient and insert using a binary search.
[QUOTE=Xerios3;20029287]Making a particle editor for my game, it should make some stuff easier for me [IMG]http://i49.tinypic.com/2agqk39.png[/IMG][/QUOTE] Did you code that in .net gdi? I mean the renderwindow, what are you drawing it with, or (as you used xna for your game) did you code it in xna with some gui library?
[QUOTE=s0ul0r;20030680]Did you code that in .net gdi? I mean the renderwindow, what are you drawing it with, or (as you used xna for your game) did you code it in xna with some gui library?[/QUOTE] AFAIK you can include XNA into a windows forms project i think theres a tutorial on the XNA website
I was thinking about getting into Unity, is it a good game engine?
[QUOTE=SolidusBlack;20030981]I was thinking about getting into Unity, is it a good game engine?[/QUOTE] I saw a demonstration of it at my college, it looks really nice but I have no personal experience to base that off of.
[QUOTE=CammieDee666;20030795]AFAIK you can include XNA into a windows forms project i think theres a tutorial on the XNA website[/QUOTE] Oh... my.... god, if that is true, you saved my day... struggling around making a gui :biggrin:
[quote]There you are, where's my beta key? [/quote] There I am? There you are! :lol: We sent you one a while back; didn't you get it? (Sure you gave us the right e-mail?) [quote]Also, all of those overlay icons are way too big. To say the screen was cluttered would be a huge understatement. [/quote] Which? All of them, the ships, the system icon indicators?
[QUOTE=Robber;20006521]You should never use goto if you don't absolutely have to (=never) and the last else if could be replaced by a simple else.[/QUOTE] There's nothing wrong with a properly used goto.
Really if you "need" to use goto, you should probably rethink your design. I cannot think of any situation were it would be useful.
Sorry, you need to Log In to post a reply to this thread.