Search found 75 matches
- Mon Apr 04, 2011 6:02 pm
- Forum: Programming Discussion
- Topic: C code to strip a file's extension from a filename
- Replies: 13
- Views: 1862
Re: C code to strip a file's extension from a filename
You will have to type free() a lot - everytime you use your function. It would be a nightmare to have to change all those free()s if you changed your malloc implementation! /* ================ AllocBspFace ================ */ bspface_t *AllocBspFace( void ) { bspface_t *f; f = malloc(sizeof(*f)); me...
- Mon Apr 04, 2011 3:10 pm
- Forum: Game Development
- Topic: The 6 Indie Game Development Mistakes
- Replies: 9
- Views: 2173
Re: The 6 Indie Game Development Mistakes
If hobby programmers followed that list, then everyone would be using linux and free software.
- Mon Apr 04, 2011 3:07 pm
- Forum: Art, Music, and Design
- Topic: How do Sprite Artists Work?
- Replies: 10
- Views: 3703
Re: How do Sprite Artists Work?
You guys use photoshop and gimp? What is wrong with just paint?
- Mon Apr 04, 2011 3:02 pm
- Forum: Programming Discussion
- Topic: C code to strip a file's extension from a filename
- Replies: 13
- Views: 1862
Re: C code to strip a file's extension from a filename
stdup is not ISO C and I don't agree with it. All of string.h's functions are designed where they pass a destination pointer. They also require your destination is large enough to store the result. If you want to do what you're doing, it would make more sense to create a new type (FILENAME) as typed...
- Sun Apr 03, 2011 8:33 pm
- Forum: General Gaming
- Topic: HIT THA BLOCK with a few bucks, came back with gold
- Replies: 17
- Views: 8989
Re: HIT THA BLOCK with a few bucks, came back with gold
Puberty isn't an accomplishment, and neither is smoking pot and copulating with whores.
- Sun Apr 03, 2011 7:42 pm
- Forum: Programming Discussion
- Topic: C code to strip a file's extension from a filename
- Replies: 13
- Views: 1862
Re: C code to strip a file's extension from a filename
char *stripExt(char* destination, const char *file) { int len = strchr(file,'.') - file; strncpy(destination, file, len); return destination; } (might have errors - didn't test) This is much better way. This function will work with any type of allocated memory, and is much less likely to have memor...
- Sun Apr 03, 2011 3:30 pm
- Forum: Programming Discussion
- Topic: C code to strip a file's extension from a filename
- Replies: 13
- Views: 1862
Re: C code to strip a file's extension from a filename
Don't put calloc in functions like that.
Have it pass a pointer and store the created string into it.
Also, the fastest method would be to just return the length of filename without extension, and then use that instead of returning a new string. You could replace it with null char if you want to.
Have it pass a pointer and store the created string into it.
Also, the fastest method would be to just return the length of filename without extension, and then use that instead of returning a new string. You could replace it with null char if you want to.
- Sat Mar 26, 2011 4:52 pm
- Forum: Programming Discussion
- Topic: SDL/OpenGL Texture Padding
- Replies: 3
- Views: 742
Re: SDL/OpenGL Texture Padding
Load the image with same code as you do for power of 2 textures.
The only thing that will be different is your OpenGL code.
The only thing that will be different is your OpenGL code.
- Sat Mar 26, 2011 4:46 pm
- Forum: Programming Discussion
- Topic: SDL/OpenGL Texture Padding
- Replies: 3
- Views: 742
Re: SDL/OpenGL Texture Padding
I don't exactly get what you're trying to do.
If you want to use non power of 2 textures, just gen texture that is next largest power of 2, then upload it with glTexSubImage2D.
If you want to use non power of 2 textures, just gen texture that is next largest power of 2, then upload it with glTexSubImage2D.
- Mon Mar 21, 2011 2:21 pm
- Forum: Game Development
- Topic: Id Software on TV in 1992
- Replies: 6
- Views: 1314
Re: Id Software on TV in 1992
Cool video, Carmack is one of my favorite programmers.
BTW
Texture mapping was around much longer, however it was new for real-time video games at time.
And Wolfenstein was first 3d FPS game, not first 3d game.
BTW
Texture mapping was around much longer, however it was new for real-time video games at time.
And Wolfenstein was first 3d FPS game, not first 3d game.
- Thu Mar 17, 2011 9:44 pm
- Forum: Programming Discussion
- Topic: [SOLVED] .NET vs C languages
- Replies: 66
- Views: 6261
Re: [SOLVED] .NET vs C languages
Remember that one movie where the zebra won the big horse race?
That's how the future is going to play out.
That's how the future is going to play out.
- Thu Mar 17, 2011 7:49 pm
- Forum: Programming Discussion
- Topic: [SOLVED] .NET vs C languages
- Replies: 66
- Views: 6261
Re: [SOLVED] .NET vs C languages
+1 to christo
In practice, no.
In theory, yes.yes, except that a software-based VM by definition is incapable of running faster than actual statically compiled code.
In practice, no.
- Thu Mar 17, 2011 12:54 am
- Forum: Programming Discussion
- Topic: [SOLVED] .NET vs C languages
- Replies: 66
- Views: 6261
Re: [SOLVED] .NET vs C languages
GyroVorbis, I think you are missing the point. Yes, JIT requires static compilation, but this does not mean that it will run slower than static code. And as a side note, most machine code is JIT bytecode, as many x86 processors change it to some internal risc instructions, then move it all around be...
- Wed Mar 16, 2011 10:55 pm
- Forum: Programming Discussion
- Topic: [SOLVED] .NET vs C languages
- Replies: 66
- Views: 6261
Re: [SOLVED] .NET vs C languages
Christo is the oracle of Oracle. Very good points! I don't agree with Java using garbage collection for everything - it is inefficient more often than not. Garbage collection should be something that is optional, as many times it is much better to do without. Calling malloc() and free() isn't especi...
- Wed Mar 16, 2011 1:42 pm
- Forum: Programming Discussion
- Topic: Problem Copying SDL_Surfaces
- Replies: 10
- Views: 954
Re: Problem Copying SDL_Surfaces
I can understand using SDL for the things you mentioned, it just seems silly to me to use surfaces with OpenGL.
Why do you need to create different images? You could just set your texture coordinates to be 1 tile.
Why do you need to create different images? You could just set your texture coordinates to be 1 tile.