Advertisement Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

136 Neutral

About zacs7

  • Rank
  1. zacs7

    C++ & Other Languages

    Anything that is managed is usually easier, ie Perl, Python, Java or C# if you're into that "stuff". Not to mention they're mostly portable, depending on how you use them.
  2. zacs7


    > The Halflife engine was built upon the Quake2 codebase, which was written in C. Based yes. But it was "ported" to C++. Along with many new upgrades, such as network code and a new label -- "Gold Source" Engine, or GoldSrc or whatever they're calling it these days.
  3. zacs7


    > simple turbo c++ coimpliler Long dead. Don't even try use that old rusty machine. Being final year CompSci you should have sound understanding of basic maths and programming. Thus all you need is a will to learn, correct English and a few good resources such as books.
  4. zacs7


    > Was the game Conter Strike (CS) wrote in C++? Yes.
  5. zacs7

    Camera transforms

    Alloha, Just beginning programming with graphics, specifically OpenGL. Doing a bit of 2D before I dive into the deep end. Basically, I've wrapped the GL functions to provide basic sprite rendering, and a very simple camera for my application. So my question is, I move my entire scene for my camera to "move". However, I apply some rotations / etc to sprites. What's the best way to sort this out? Instead of storing and loading the matrix after each sprite, I simply reverse any rotations / transformations I did ... is this the "norm"? Basically my app, sets up * Orthographic projection, origin at (0,0) to (100, 100) * Render loop... transform the entire scene (ie, identity matrix and camera transforms on it). See [1] ** Render sprites with camera transforms. See [2] ** Load the identity matrix (ie no camera transforms) so I can draw a "overlay hud" sort of thing ** Draw the hud I'd appreciate any input! [1] Camera /* set the camera position */ void render_camera_position(float x, float y) { glTranslatef(x * -1, y, 0.0f); } /* render over the top, with 0->100% */ void render_overlay(void) { glLoadIdentity(); } [2] sprite_render() -- ignore the division! I'll precalculate this. void sprite_render(sprite_t * sprite) { /* glPushMatrix(); */ glColor3ub(0, 0, 255); /* translate */ glTranslatef(sprite->x + (sprite->width / 2), sprite->y + (sprite->height / 2), 0.0f); glRotatef(sprite->rotation, 0.0f, 0.0f, 1.0f); glTranslatef(-(sprite->width / 2), -(sprite->height / 2), 0.0f); glBegin(GL_QUADS); glVertex2f(0.0f, 0.0f); glVertex2f(0.0f, sprite->height); glVertex2f(sprite->width, sprite->height); glVertex2f(sprite->width, 0.0f); glEnd(); /* HACK: undo the matrix transforms, this is so * our camera still applies to the obj */ glTranslatef(-sprite->x, -sprite->y, 0.0f); glRotatef(-sprite->rotation, 0.0f, 0.0f, 1.0f); /* glPopMatrix(); */ } And a segment of the main loop void client_render(void) { /* move everything after here */ render_camera_position(camX, camY); /* draw sprites */ sprite_render(&test.sprite); render_overlay(); if(console) console_render(false); } Sorry for the long post! I posted here because I'm still very new at this graphics stuff :-) Zac
  6. zacs7

    Devving in Linux

    > your source code may look different and give compilations errors when moved due to the way windows and linux do line endings. C and C++ are both line ending independant. Hence the ';' to signify the end of a statement, not a line ending. CR or LF are considered whitespace.
  7. zacs7

    Code Speed Question?

    > Except for compiling, because the lexer has more work to ;-) In the case of TCC (Tiny C Compiler) -- (compiling at runtime) execution would be slower :), at least at the compiling stage. Perhaps you can benchmark? Sounds like a fun thing to do.
  8. > int secondsSinceJanuary1st1970 = time( NULL ); Not true, as per the standard: time() is system-dependant. It doesn't have to be a UNIX timestamp (although most times it is). It could even return some value that makes no sense at all. #include <ctime> Since it's C++ :)
  9. zacs7

    Visual Basic or C++?

    > Maybe you could consider C# - it's a bit nicer than C++ and people is doing wonderful stuff with it. Matter of opinion :) -- certainly not mine! Anyway, ditch VB6 at least. And the VS6 if you have it -- kind of a fossil now days. You'd probably find anything like Java, C#, etc easy to pick up. Perhaps it is wise to have a stab at C# and then move to C++ if you feel like it.
  10. zacs7

    .c and .cpp files

    hehe, at least you're on the ball (well, almost ;))
  11. zacs7

    c-strings with spaces

    Also consider using 'size_t' for the length (The largest unsigned integral type -- for your machine). As apposed to 'int', what if my string is larger than the range of an int?
  12. zacs7

    .c and .cpp files

    Quote: What's the difference between .c and .cpp files? Are they just C and C++? If I simply rename the .cpp files to .c would my code still compile or would I have to fiddle with some settings in visual studio? The extensions are for you, and the OS so it can identify the type of file. The compiler doesn't care what the extension is, it's just conventional to name C files as *.c/*.h respectivly and C++ files as *.cpp/*.h/*.hpp (the latter is not so common -- although in my opinion wise). Consider the following, #include <stdio.h> int main(void) { int new = 5; printf("new = %d\n", new); return 0; } Is a valid C program, but not a valid C++ program -- my point is, it's the contents that matter not the file extension :) Note: Considering how fast tech moves, VC6 is pretty old (Almost 12 years -- which is a long time). I'd consider it a fossil, consider upgrading: I think VS express is free?
  13. Hello, I'm new to this whole game programming thing -- but not new to programming. Basically I'm writting a little game in C, and I have a few questions that various books & tutorials I've read seem to miss. I'm managing internal engine states & looping as such, menu.h extern struct menu_s { int isAcitve; } menu; render.h extern struct render_s { int maxfps; } render; render.c void render_frame(void) { /* render everything */ if(menu.isActive) menu_render(); } think.c /* physics, animation & such (update game states) */ void think_frame(float delta) { /* ... */ if(menu.isActive) menu_think(delta); } main.c for(;;) { sTime = timenow(); think_frame(delta); if(should_render_for_maxfps(render.maxfps) == GL_TRUE) { render_frame(); } delta = timenow() - sTime; } Basically my question is, can I merge 'thinking' & 'rendering' together? And should I be limiting the FPS of my think frames? (ie using 100% of the CPU because I can seems like a waste)? Since 'think' and 'render' are in different functions I also have to check the state of the menu each frame twice, seems like a waste -- could I do: render.c void render_frame(float delta) { menu_frame(delta); /* does menu cals and renders? */ } And then limit render_frame to maxFps? Thanks in advance :) I'd hate for my game to use 100% CPU if it didn't have to.
  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!