Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

549 Good

About GlenDC

  • Rank

Personal Information

  1. GlenDC

    What Language Do I Use?

    I stil llike C++ for he facts most people already know, so no reason to repeat it. It's also the language I use at my job.   I kinda want to explore the use of golang and perhaps create a nice framework to easily bind it to excisting C/C++ technology. So in that case go would only be used for the game logic. The reason is that it's quite a cool and fast language to program in and it compiles sickly fast. Debugging it is also easy and great.   Besides that I would like to explore Rust and see what it could do for the future of gamedev :)
  2. GlenDC

    What does your IDE look like?

      ByteTroll, what is the preview slider on the right of your screen? It looks similar to the thing in Sublime Text 2. 
  3. GlenDC

    What does your IDE look like?

    I love dark themes. To highlight the difference between VS and Eclipse I gave VS a more blue/cool tint, while Eclipse has the red/evil tint. (other programs like Notepad++ have the same look as VS)    
  4. GlenDC

    Did that just happen?

    Congratulations my fellow Belgian! At what University do you study?
  5. GlenDC

    [SFML] I Finished Pong! I Can't Believe It!

    Awesome man, always fun to create your first game. Btw if you share a vs project then you can delete the following files: debug ipch a big file with the extentsion .sdf Good luck on your next project!
  6. Thank you. You gave me a great idea, gonna do it slightly else, but it's based on your idea! I'll let you know if I succesfully implemented everything. ------------------------------------------------------------------------------ [UPDATE] Ok after 4 days, I finally managed to get my layer system up and running. It's stable and everything works just like I had planned. I would like to thank you all for your help and inspiration. I wrote a blog post about my final implantation which you can read here. Thanks everyone! (this topic is solved)
  7. And how exactly would you do this? I worked with an interface and a set of functors, isn't really working out. Maybe i'm doing it wrong or maybe it's just a wrong idea to go down that road for this specific concept. So if you think it is possible to do with that, please provide me some example on how to do such a thing correctly and legal.
  8. I would like to design a system, which allows me to execute my functions in "layers". So a function of layer 3 should always be executed from a function of layer 4 but before a function of layer 2. There are however some things the system has to be able to handle: The layer order should be respected, not the call order for the user. The call order only is taken into account for functions within the same layer. All the draw functions return void, BUT they all have different parameters. This means that not only the data type's of the function is different, but also the amount of parameters. I'll explain on how i tried to implement this concept, but as I said before, I really think and hope there are better ways to do things like this as basically the core thing it has to do is change the order in when specific functions get called with specific functions. How I achieve this doesn't really matter as long as it can't become a bottleneck or hostile to the memory while used for games heavy on resources. I've been working on this problem now for almost 3 days, and I still have not solved. The way I did it, was by saving all functions in a vector within a map. So every layer Is represented by one vector and these vectors are saved in a map. I've made some big Changes to my draw functions and had to create some extra things to achieve this. I think there have to be way better ways to transom this concept into C++ code. If not, I'll sum up the sort of components I have and where I do what. Every functor draw object is based on the Generic Function class: Class Generic Function { protected: GenericFunction() {} public: virtual void operator() (){} virtual void operator() (boost::any){} virtual void operator() (boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any,boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any,boost::any,boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any,boost::any,boost::any,boost::any,boost::any){} virtual void operator() (boost::any,boost::any,boost::any,boost::any,boost::any,boost::any,boost::any,boost::any){} }; An example of a private draw function, saved in the list by the public function and based on the GenericFunction class: struct dLine : public GenericFunction { virtual void operator() (float x0, float y0, float x1, float y1,float lineWidth = 1.0f, bool DoscaleOperations = true); }; The vector in the map doesn't contain a pointer to these functions, but a wrapper class, called Command: (header) class Command { public: Command(GenericFunction * f,UINT nArgs, ...); ~Command(); void Execute(); private: boost::shared_ptr<GenericFunction> _f_; std::vector<boost::any> _vaArguments_; }; (implementation) Command::Command(GenericFunction * f,UINT nArgs, ...) ctor : _f_(f) { boost::any * it; va_list args; va_start(args,it); for(unsigned int i = 0 ; i < nArgs ; ++i, ++it) _vaArguments_.push_back(&it); va_end(args); } Command::~Command() { _f_.reset(); _vaArguments_.clear(); } void Command::Execute() { auto it = _vaArguments_.begin(); switch(_vaArguments_.size()) { case 0: boost::bind<void>(*(_f_.get()))(); break; case 1: boost::bind<void>(*(_f_.get()),_1)(*(it++)); break; case 2: boost::bind<void>(*(_f_.get()),_1,_2)(*(it++),*(it++)); break; case 3: boost::bind<void>(*(_f_.get()),_1,_2,_3)(*(it++),*(it++),*(it++)); break; case 4: boost::bind<void>(*(_f_.get()),_1,_2,_3,_4)(*(it++),*(it++),*(it++),*(it++)); break; case 5: boost::bind<void>(*(_f_.get()),_1,_2,_3,_4,_5)(*(it++),*(it++),*(it++),*(it++),*(it++)); break; case 6: boost::bind<void>(*(_f_.get()),_1,_2,_3,_4,_5,_6)(*(it++),*(it++),*(it++),*(it++),*(it++),*(it++)); break; case 7: boost::bind<void>(*(_f_.get()),_1,_2,_3,_4,_5,_6,_7)(*(it++),*(it++),*(it++),*(it++),*(it++),*(it++),*(it++)); break; case 8: boost::bind<void>(*(_f_.get()),_1,_2,_3,_4,_5,_6,_7,_8)(*(it++),*(it++),*(it++),*(it++),*(it++),*(it++),*(it++),*(it++)); break; } } The map that contains everything: std::map<int,std::vector<boost::shared_ptr<Command> > > * _mPaintFunctionList_; I reset this every tick, this because parameters have maybe changed: if(_mPaintFunctionList_ != nullptr && _mPaintFunctionList_->size() != 0) { for ( auto it = _mPaintFunctionList_->begin() ; it != _mPaintFunctionList_->end() ; ++it ) { for ( auto iit = (*it).second.begin() ; iit != (*it).second.end() ; ++iit ) { (*iit).reset(); } (*it).second.clear(); } _mPaintFunctionList_->clear(); } When I want to paint my draw functions I call all the functions within that map: if(_mPaintFunctionList_ != nullptr && _mPaintFunctionList_->size() != 0) { for ( auto it = _mPaintFunctionList_->begin() ; it != _mPaintFunctionList_->end() ; ++it ) { if((*it).second.size() != 0) { for ( auto iit = (*it).second.begin() ; iit != (*it).second.end() ; ++iit ) { (*iit).get()->Execute(); } } } } An example on how I push such a function via a public function: bool WinEngine::DrawLine(float x0, float y0, float x1, float y1, float lineWidth, UINT layer, bool DoscaleOperations) { if(_bIsPainting_ | _bIsDoubleBuffering_) { (*_mPaintFunctionList_)[layer].push_back( boost::shared_ptr<Command>(new Command(new dLine(),6,x0,y0,x1,y1,lineWidth,DoscaleOperations)) ); return true; } _bPaintError_ = true; return false; } That's basicly how the implementation is. It has the following problems: The functions don't get executed, so something is wrong there. have alot of functions who get added, ( you can't fix this problem, as I didnt share all my code ) while i don't see where they can be ever added to it ( I don't think I have ever called them ) Concerns: I think this takes alot of memory ( even way to much )on the stack and heap, for something as trivial als executing a function Maybe this can become a bottleneck when I have a lot of functions in a game where I have a lot of action and things that need to be on screen
  9. Hi, recently I wrote a topic about some problems with my win32 framework. Thanks to this awesome forum I was able to solve those problems. Now I have a new Question and an optional Question: For one of my window modes I would like it that my window always has the same ratio when it's getting sized. Thus if you start with a size of 1280*720, that you can never go to another ratio when sizing. This prevents stretching while still being able to scale the content. So what's the best way on how doing it? I tried to do it and it works. However it doesn't work properly and you really see these ugly flickers. Code: if(abs(newWidth-_iWinWidth_) > abs(newHeight-_iWinHeight_)) newHeight = int((float)newWidth * _fWinRatioH_); else newWidth = int((float)newHeight * _fWinRatioW_); MoveWindow(_hWND_,rect->left,rect->top,newWidth,newHeight,true); break; newWidth is the width after the user resized the window, same for newHeight. _iWinHeight_ and _iWinWidth_ were the previous dimensions. (RECT)rect is init. by the GetClientRect(). So are there better methods to achieve this goal, or did I just make a mistake somewhere. ( Btw this code is done via a function, that function is executed whenever the window sized ( due to windows or a user action ) There is also another mode, I call it CLIENT_RATIO. This means that you can resize the window to whatever ratio you want, so you can just resize your window with no restrictions. However when you for example go from an original size of 1280*720 to 1400*720 then it will place vertical "banners" with a width of 60 left and right of the content. This so that your content will still be 1280*720. This to respect the ratio. I've tried to do this manually, but it is still bugged. I think I can get it working if I debug it. But still, I was wondering is there maybe something in WIN32 that allows this by default in a proper and correct way? --------------------------------------------- Ok that was it for the WIN32 part, Now here's a real challenge. The win32 framework is used for my 2d and 3d engine. I'm now trying to create a Console System, like you have in all the big games. ( e.g. UDK Games, Valve Games, ... ). I can create it and get it working, so what is my question? Well I would like to have a really fast way to add a function to the console function list, so that it allows me to do the following: Type the function name and parameters in console textbox field Get live code hinting while typing Execute the function with the given parameters Now I've thought of a system in which I give the function pointer and parameters manually, this is a really inconvenient way, but it works. But Like I've said before, I want a faster way. Is it possible to just pass the function pointer and to extract than the parameters from the pointer of the function, so that you can put it in strings to get some sort of code hinting. I've asked this question on IRC and these 2 solutions were given me: Work with a sort of scripting language. This could be done for example via Python, which is possible thanks to the Boost Libraries. Extract it from the pointer via stuff like function_traits ( also via the boost libraries ) I believe that both solutions can work. The problem is that I'm new to both solutions, so can someone give me some articles related to my solution in general, or if possible articles related to a solution using one of the 2 solutions listed above. If any information I've given is too vague, then please ask for what you need more, and I shall try to provide it. Thank you already! ( Oh and I'm traveling a lot these days between different locations, so it is possible that their is a long time period between my answers on this topic )
  10. Mornings kill my heart, or maybe it's the general lack of sleep. Time to continue working on my 2Dengine!
  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net 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!