• Advertisement


  • Content count

  • Joined

  • Last visited

Community Reputation

761 Good

About wqking

  • Rank

Personal Information

  1. You can install your core app to "program files" folder, which will not be updated. Then your core app installs updatable app/resources to a writable folder. Your "core app" only does two jobs: 1, Check auto update 2, Execute your main app from the writable folder.   This is how we did auto update in mobile games. Hope it helps.
  2. Will there ever be another language of the web?

    I hope in the future JavaScript becomes the "binary machine code" of the internet, similar as the real binary machine code on local machine. Then we use higher level and better language, then the language is compiled to JavaScript. Similar as we compile C++ to binary code. Seems this is the trend. Microsoft has already had TypeScript.
  3. Then the project that uses your engine has to define the macro in build configuration, or define the macro before include any headers in your engine. There is no better choice, IMHO.   There are two approaches to possible improve this, 1, Auto detect which DX version to use, if there is any version related macro in DX headers, maybe you can use it? I'm not sure if it's possible because I never used DX. 2, Change the headers in your engine DX agnostic. Thus your engine only exposes one single interface to the users. This is better API design and how a lot of cross platform open source projects do.
  4. Help with Dependency Injection Scenario

    When not add a "context" parameter to Draw? class RenderContext { public: HWND getWindowHandle() const; }; struct IRenderer { pure virtual void Draw(const RenderContext & context) =0; }; And on each render, CDesktopWindow creates a RenderContext (or reuse a cached one) and pass it to IRenderer.   EDIT: I just reallized you need window handle to intialize DX. So passing the handle to Draw may not solve your problem. Then maybe you can add an "intialize" to IRenderer. struct IRenderer { virtual void Initialize(HWND windowHandle) = 0; pure virtual void Draw() =0; };
  5. If you use seperate build configuration, it's fine to put the macros in build configuration (C++->Preprocessor) because you don't need to change the macros any more.   Your current approach, single build configuration, to make for DX9, define API_DX9 in build configuration, to make for DX11, change API_DX9 to API_DX11, whole project will be recompiled.   The seperate build configuration approach. You have two build configuration. config9 and config11. In config9, you define API_DX9 in build configuration, in config11, you define API_DX11. Now to build different target, you just select different build configuration, no need to change the macro, so only part of the project will be recompiled.
  6. If you put the macro in the project configuration C++->Preprocessor, changing the macro will cause your whole project being recompiled. You may think to put the macro to a header file, thus changing it will cause only the files that including that header being recompiled.   However, I do think you need a separate build configuration rather than using a macro.
  7. "AConnection->SetDataBufferSize(size)" is not the same thing with "rawData->SetBufferSize(size)". The former is the public interface, and the later is the internal implementation.   Today your Connection::SetDataBufferSize forwards to DataBuffer::SetBufferSize, tomorrow you may change to that your Connection::SetDataBufferSize invokes some complicated logic other than DataBuffer::SetBufferSize. Nobody cares the changes as long as the public interface is the same.   So, I don't think there is any problem with your "setter" chain.
  8. To answer OP's question, here is how I do in my code, 1, For the declarations (such as classes) in my code, I forward declare them whenever possible, in the header. Of course the source file needs to include the corresponding header, that's fine. 2, For the declarations in third party and system library, I never forward declare them. If I do, I will get a lot of trouble if the library changes the name or namespace. 3, I always try to avoid #include in the header (my point #1), but if I can't avoid, just include it (my point 2), no problem.
  9.   Then how do you use std::string in your class declaration? I don't think we should forward declare symbols in third party or even system libraries.
  10. Game engine editor design

    You should better build your editor upon your engine. Such as, your editor uses the animation system in your engine to animate the objects in the editor. That has two benefits: 1, You don't repeat yourself. 2, Using engine in your editor may help you to find defects in your engine. The easiest way to use your engine in your editor is, write your editor in C++. Qt is a good choice, and so wxWidgets.
  11. He uses (*it)-> to access the member so the widgets should be stored by pointer.
  12. I'm glad to announce cpgf library version 1.5.5 is release.   cpgf library -- free C++ open source library for reflection, serialization, Lua, Google V8 JavaScript and Python script binding, callbacks   Changes log: Added tweening and timeline library. Added generic property accessors, getter and setter. Refactored meta property to reuse generic property accessors. Fixed a bug that using function (not pointer) as property accessor may cause wrong address crash in VC. Fixed a bug that using policy GMetaRuleExplicitThis on property setter may cause wrong argument being selected. Fixed a compile error in gstdint.h in VC 2012. Sample code to create tween animation // Define a sprite somewhere. FooSprite mySprite; // Setup the tween GTween & tween = GTweenList::getInstance()->createTween() .duration(2.0f) .ease(ElasticEase::easeIn()) // We can use getter/setter functions .target(createAccessor(&mySprite, &FooSprite::getX, &FooSprite::setX), 100) // We can also use property address directly, as long as the property is public. .target(createAccessor(&mySprite, &FooSprite::y, &FooSprite::y), 200) ; // The main tick function void gameLoop(float frameDuration) { GTweenList::getInstance()->tick(frameDuration); } The library web site: http://www.cpgf.org/   Tween library documentation http://www.cpgf.org/document/cpgf-tween-library.html  
  13. Since there is no "correct" answer, I will share my experience.   I only use STL to implement the library, I don't expose STL to public API.   If a function returns a string, I will return a char * rather than std::string.   Also even if STL is platform independent, I would not expose a function to return a list or vector. If you return a list or vector, the user can do much more than you expect, such as insert an invalid object, etc. I would simply wrap a list or vector to simple non-template class to access the elements and element count.
  14. As far as I understand (same as others), that should be invalid syntax. Variable 'I" should be only valid in the for loop. Also, even it's valid syntax, I would never write that kind of code because it's so confusing. Indeed I would not spend my any time on studying "goto". I will stop here, otherwise will bring a flame war of "goto" discussion.
  15. Irrlicht and GUI libs?

    Your question is not Irrlicht specified, but some general UI code design question.   I don't know if there is any tutorial, but I myself often use the concept of "scene".   A scene is a virtual concept that you draw on. A scene is an object, it renders any stuff that should display on the scene, and never cares how other scenes work. So in your question, you may have a main menu scene, an options menu scene, a credits scene, a game scene (the game scene is so complicated that you may want to split it to loading scene, game play scene, etc).   In your main menu scene, the scene only renders all the buttons you mentioned above, of course beside the background. In credits scene, the scene may animate your credits names.   When "credits" button is clicked on main menu scene, the scene is swtiched to credit scene. That's to say, your whole game is just switching between scenes.   Just some basic beginning ideas.
  • Advertisement