• Content count

  • Joined

  • Last visited

Community Reputation

108 Neutral

About Grantax

  • Rank
  1. Performance Programming Applied to C++

    Code readability is a lot more important than these unnecessary optimizations. In addition to the fact that bit shifting doesn't offer noticable performance improvements (if any at all), it also harms code readability, and you have to use "magic numbers" in your code. Good compilers will probably output better assembly than most people, and can also unroll your loops, you don't have to make your code look like a mess.
  2. Porting code to windows 7

    Quote:Original post by ernow Read this to get an idea of what you are in for Tbh that article is really bad. *Example 1: Trying to fit a 64-bit pointer in 32 bits, which worked when you tested it on your 32-bit system. *Example 2: Example 1, just with different code. *Example 3: Example 1, with different code. My point? I'll summarize the entire article for you: "Pointers are 64-bits wide in 64-bit systems."
  3. Fast fonts in ogl

    Quote:Original post by Katie We're using cairo/pango. Cairo does general drawing management, pango does text formatting for it (including international stuff). Underneath it uses freetype for some of the work. Cairo's output is a 32 bit canvas which conveniently can simply be uploaded as a texture. I used cairo for svg rendering, but I had to change to freetype because of a big problem. The problem I had with cairo was that it seemed to ignore the alpha value of the surface it rendered onto (I considered it to be opaque): I had an "empty" surface (color rgba(0, 0, 0, 0), that's 100% transparent "black"). I then rendered rgba(1, 1, 1, 0.5) all over it. In my head, the new color should be a 50% transparent white color. Yet in cairo, it was rendered as a 50% transparent gray color (50% white mixed with 50% black background). None of cairo's blending methods seemed to solve this problem. Have nobody else noticed this, or am I doing something wrong?
  4. Fast fonts in ogl

    I'm rendering the text (all the glyphs) into it's own texture before rendering to the framebuffer, so I don't have to redo it every frame. I'm assuming that's something "everyone" does, but I don't know since I've never read anything on the subject.
  5. The C++ equiv of C# (int)

    Quote:Original post by way2lazy2care shwoops. I am but a novice pointer reader :(. char (*foobar)[] = { "foo", "bar", "123", "abc" }; <that's a pointer to the array right? :-/ First of all, you probably meant char *(*foobar)[] (Or else you'd have a pointer to an array of char instead of char*) Though you can't initialize it like that, because it's the value of the pointer you're initializing: char *foobar[] = { "a", "b", "c", "d" }; char **pFoobar = foobar; //I can't think of any reason you would use (*pFoobar)[]
  6. The C++ equiv of C# (int)

    Quote:Original post by way2lazy2care Wouldn't the first one just return the size of the pointer to the array? Don't you want to do sizeof(*foobar) or not declare foobar as a pointer to the array. It's not a pointer to an array, it's an array of pointers. :)
  7. The C++ equiv of C# (int)

    C++: //In this case you don't know the size of the array, so you'd use sizeof char *foobar[] = { "foo", "bar", "123", "abc" }; int foobar_size = sizeof(foobar) / sizeof(foobar[0]); //Here you decide what the size will be, so there's really no need to do it the way you did in C#. You'll also want to avoid using magic numbers. const int mapWidth = 5, mapHeight = 5; int map[mapWidth * mapHeight]; jyk: I've never used C#, but I'll assume that the second code snippet only works on 2-dimensional arrays, whereas the first code snippet initializes a 1-dimensional array, so in a way you're right. :)
  8. I didn't find any mirrors of the updated source code. Maybe he didn't update it. Quote:Original post by Aju Does anyone know where to find the source code from this book ? I'm 90% certain that it's included in a CD that came with the book.
  9. Simple Error Help

    int Length = GetWindowTextLength(nWind); wchar_t Buffer = new wchar_t[Length]; GetWindowText(nWind, Buffer, Length); Remember to delete or use a smart_ptr. Or using Brother Bob's example you might use File << &Buffer[0];
  10. How to validate player positions?

    The server will need to have the map as well.
  11. Getting a job without an education

    Sure, I could get an E if I spent more time, but at the moment I can't afford the exams, so I was just asking if there was a way around. Thank you for all the answers, I had pretty much given up getting an education, but I guess I'll have to give it another shot.
  12. Getting a job without an education

    Quote:Original post by Rycross Quote:Original post by Grantax I flunked out of high school (I think it corresponds to high school..) last year because I got an F in history, and religion. I have issues with learning stuff that's totally uninteresting, and not related to the job I want in any way. I hate to be blunt, but that attitude makes you unsuited for any sort of professional development work. Even game programming requires work that is uninteresting and monotonous from time to time. Failing out of things because they're uninteresting and you don't want to put in the effort is a huge black mark, and you'll have to fix that if you want employers to take you seriously. I've had several jobs I've found utterly boring, but I still didn't mind. Having to read, understand and remember 500 pages of several uninteresting books on the other hand, is just too difficult. Does that make me unable to make games? No, it doesn't.
  13. Getting a job without an education

    I flunked out of high school (I think it corresponds to high school..) last year because I got an F in history, and religion. I have issues with learning stuff that's totally uninteresting, and not related to the job I want in any way. Quote:Original post by Yasir Just intrested, how long did you spend teaching yourself C++ and how hard was it? Im 19 and im intrested in learning it but im not in college or any education at the moment I started learning C++ when I was 15, and I didn't find it hard at all. My problem isn't understanding c++, it's all the problems I have to solve when making games. (Which isn't really an issue, you'll always have to learn new things when programming new games)
  14. I'm 19 years old, and for a couple of years I've been coding using c++. I don't have an education, and I was wondering how hard it is to get a job without an education, and what I should do next. I mostly do game programming (because it's more fun :) ), and I'm coding alone, so I have to do everything myself (Graphics, sound, networking, physics etc.), but I've come to believe that people specialize in a field, though at this point I don't really prefer one over the other. So what I'm asking is: What should I do to get into the industry? And would I normally have to specialize in a specific field like networking or graphics?
  15. problem with the gameloop

    The length of the animation doesn't matter, you don't render the whole animation each loop, you render 1 frame (or whatever) of the animation each loop.