• Content count

  • Joined

  • Last visited

Community Reputation

3126 Excellent

About nobodynews

  • Rank
  1. Yet another SDL question (or maybe it's not)

    Lactose is correct, but as an addendum you can do something similar to what you did (using the same variable name) if you utilize member initialization lists. So your constructor could be as follows: GameObject::GameObject(int x, int y, int w, int h) : x(x), y(y), w(w), h(h), _destroyed(false) { rect.x = x; rect.y = y; rect.w = w; rect.h = h; } Without getting into the merits of using the same name for the parameters and member variables, this is just to note that it's possible.
  2. Breaking out of for loop

    void CInputManager::SetRawButtonState(const RAW_BUTTON pButton, const bool pState, const bool pPrevState) {     for(auto &context : mContexts)     {         if(context.IsActive())         {             if(pState && !pPrevState)             {                 if(context.MapButtonToAction(pButton)) break;             }             if(context.MapButtonToState(pButton, pState)) break;         }     } } FWIW I believe this should perform the same and I find it to be simpler to read.   edit: and if you want to compress it further: void CInputManager::SetRawButtonState(const RAW_BUTTON pButton, const bool pState, const bool pPrevState) {     for(auto &context : mContexts)     {         if(context.IsActive())         {             if(pState && !pPrevState && context.MapButtonToAction(pButton)) break;             if(context.MapButtonToState(pButton, pState)) break;         }     } }
  3. read int from char * question

    I know that Visual C++ compiler extensions (in the past and maybe today) would bind temporary variables when passing by reference to non-const functions. This is different from passing a constant by non-const reference though, but maybe early compilers like Visual C++ 6.0 allowed that too for some reason. It wasn't very standard's compliant, after all. Alternately, Johnny Code is remembering wrong.
  4. This can be done in pretty much literally any programming language that you can think of. BeerNutts' suggestions might be easier to get you where you want, but I haven't used them so I can't comment on that. I really don't think switching to C++ and using 'function pointers' is good advice given you know some C#. Side note: delegates are similar to function pointers, fwiw.
  5. There's a lot of stuff that you could improve in your code, the issue you're running into now is that you aren't writing the output as a binary file:"output.txt"); Even though you're using the "write" member function, stream behaves differently since it's not binary. I tested it out and it completed successfully.
  6. Wanting to create my own Game Engine

    There's definitely truth to what L Spiro says, I just don't take as hard-line a stance on it. GLFW is a crossplatform library to make windows and get inputs. Your interests may lie elsewhere in terms of making an engine. I liken it to cooking. If you want to make an Italian dish you might just not have any interest in making homemade noodles so you buy those. Since you like making sauces you grow your own herbs and tomatoes so you have the freshest ingredients that taste how you want them. Not to say you should avoid making noodles! You might really like it and it might be worth it to bring out the flavor of your homemade sauce. I guess this is to say that not making your own noodles doesn't mean you're not cooking. But it might be better if you did.
  7. 1. Should be fine. Why wouldn't it be? 2. This is used to cap the frameTime to at most 250ms to prevent the game loop from taking longer and longer to run as it tried to catch up since the previous frame. Why 250ms? Probably no specific reason. It 'felt right'. With it, the game will update the simulation in 250ms chunks for every frame regardless of how long it takes in real-time. If it takes 1 second of real time to run 250ms worth of simulation and draw one frame then you'll get 1 frame per second and 250 worth of simulation. The experience would be terrible but if it was temporary the player could get past it. It would be a brief stutter in gameplay. If it was more common then the player would have to get a better computer (or you have to write better code). There's no real reason you couldn't change that time to 0.125 or something else. 3. Depends. If your simulation runs every 1/30 second do you want to handle events that occurred between steps? I think most people would say "yes", but its up to you. 4. You probably won't see a difference with just two sprites and without complicated simulation. The main benefits come when you have complicated simulation logic (i.e. physics that uses integration for example), if you want to easily record and play back the simulation, or with multi-player. Think about how two people playing across the planet have to keep their simulations in sync and how that is difficult if both players are running physics at different and inconsistent rates every frame. If you assume both players are on the same rate you don't have to work as hard to keep them sync'd.
  8. For what functions we use the word "On"?

    Those On* functions are event handlers that are called by the Unity engine. An event handler is just a specific type of 'callback function'. So, are your functions also event handlers? If not, I would suggest some other naming convention. If you're unsure, please explain how you plan on using those functions.
  9. Your bigger issue isn't patents its copyrights. If you want to re-use any of their work you'll need permission. If you don't have their permission you need to create original art, sound, and code. About the only thing you can typically copy is core gameplay aka make knockoff.
  10. Beginner with a dream.

      "UI" is a very broad category so it'll help if you expand on the context in which you want to create a UI. Assuming you specifically mean GUIs, there are "WYSIWYG" editors which can help make desktop application style user interfaces. Microsoft's Visual Studio lets you make these for many languages, including C#. This is supported by the Express and Community editions of Visual Studio, both of which are freely downloadable from Microsoft. However, this might not be what you actually want. Unity supports "UI" elements as well for in-game GUIs (for menus and such).   In all cases it still requires some programming knowledge to cause the UI to do something practical rather than just something you look at.
  11. Collision using rgb

    A very simple thing you can do that should work is return different numbers for the different errors instead of using the same number. Also, you should learn how to use a debugger. Vimeo is blocked at work so I can't check how useful it is, but Google suggested this video.
  12. Collision using rgb

    What compiler errors are you getting? Also, I'm confused about what the issue is with the file loading. It sounded like a bug, but then you say the code doesn't compile which implies you haven't run the code. If it is a bug, what is the behavior you are seeing?
  13. Another way of looking at it, is imagine yourself as the normal. On Earth as you walk around upright you are essentially the normal at that point on Earth because you are perpendicular to that point of the planet.   But imagine you are an astronaut and you are in zero G environment, say on the outside of some space station. Your boots let you stick to the outside so you can walk around it. If you imagine yourself trying to walk around the space station 'upright' then your orientation will be the same as the normal at that point on the space station. Doesn't matter what shape the space station is, you can be upright at any point on it provided you can stick to it.
  14. Yeah I feel the same way about books, they all just use words to tell a story, they don't do anything original. I'm looking for something new.   Ok, that's unfair, but honestly you're premise is vague. I'd like some examples of games which you consider 'too similar'. I check steam fairly often and I don't remember seeing an 'overload' of RPG Maker titles.
  15. Advice on coding style

    I hope for your sake you're using one of the updated versions of Dev C++ and not the incredibly out-of-date Bloodshed version.