Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 16 Aug 2012
Offline Last Active Mar 27 2016 10:18 PM

#5253917 Game Development Laptop

Posted by on 24 September 2015 - 06:37 PM

Right now is a fantastic timing to build a desktop since the new skylake intel cores were just released.

But if you absolutely need the portability, I recommend a high end ASUS or MSI gaming laptop.

#5064629 Entity-component systems and animations

Posted by on 24 May 2013 - 04:22 PM

If I implement that, the code will work just fine, but I feel like I'd have broken some golden NO-OBJECTS rule of entity design. I've implemented animations in other fashions but they don't have quite the capability --- I've not been able to put multiple animations on a single altas, or have animations where the frame width and height could change.


I don't understand why you can't have a resizable container and objects inside a component. 

Containers and objects are good way to encapsulate and store data.

Raw data doesn't mean that you only can have primitive types in a component. What you want to stay away from is having lots of functions in a component. That's system's job.

Use a vector to store each frame.

#5046293 Calling member function via nullptr

Posted by on 24 March 2013 - 01:48 PM

class A{   
void say(){std::cout<<"hi";}
int main()
    A * a=nullptr;
    a->say();   //no crash, works fine

Is this undefined behavior?

#5046136 Are pointers initialized to nullptr in a vector?

Posted by on 23 March 2013 - 11:26 PM

class A{...};

int main()
	std::vector<A*> vec;
	std::cout<<(vec[9]==nullptr); //prints 1



I want to make sure this happens on every system.

Are pointers initialized to nullptr?

#5023578 Version control for begginers

Posted by on 20 January 2013 - 12:57 PM

Git is really simple to use once you learn it.

I liked this tutorial 

#5018256 Sprite Animation - SFML

Posted by on 06 January 2013 - 12:07 PM

To me your way should work because even though the animation stops when the up key is released, it should start again because the left key is being pressed.

But this is how I implemented SFML animation in my project

It's simple. Don't start the animation only if(sf::Event::keyIsPressed).   Start the animation always even though the key is not pressed and stop it later if key is not pressed

Below code is in the main loop


        animation.start(); //Just start the animation
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Up))
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Right))
        else if(sf::Keyboard::isKeyPressed(sf::Keyboard::Down))
            animation.stop(); //   -Stop the animation when keys are not pressed



        animation.update(dt); //   -Animation only gets updated when the animation has not been stopped

#5016818 File input/output in C++ Question

Posted by on 02 January 2013 - 02:18 PM

The program will look for the file in the executable's directory.

You can't really make your level files invisible, but you can hide them by packing all your level files in a "level" folder and placing the folder in your executable's directory.

Then you can load the levels like




#5011165 Game from Scratch ? C++

Posted by on 15 December 2012 - 10:12 PM

But still on basics

If you are still on basics, you can't make a game.
Learn the language first.

#5008941 using 2d std::array

Posted by on 09 December 2012 - 07:44 PM

You can just make a std::array of std::arrays. Ex: std::array<std::array<int, 5>, 10>.

5 is the row and 10 is the column?
So I can access each element by

#5008540 C++ Job Interview Books

Posted by on 08 December 2012 - 11:42 AM

Cracking the Coding Interview is a good book

#5006790 New is SLOW!

Posted by on 03 December 2012 - 03:33 PM

I am a noob here. So I have a noobish question. I just received a downvote for this post. Is there a reason for this, and something I can avoid in the future? Because I don't like offending people or posting inappropriate content.

+1 to compensate for that downvote.
It is an obvious fact that new is slow, so someone could've thought your question was ridiculous especially when you caught attention of people by capitalizing SLOW!

#5003676 vector iterator not incrementable

Posted by on 23 November 2012 - 11:17 PM

Never mind, I found a solution

#5003504 Change the compiler of c++ 11

Posted by on 23 November 2012 - 08:20 AM

Put std::cin.get() (maybe one more) at the end of your program to pause.

#5002471 priority_queue big o notation with vector and deque

Posted by on 19 November 2012 - 04:21 PM

What's the big o notation for push() and pop() in priority_queue with vector or deque as its underlying container.
I can't find this anywhere.
I'm guessing linear complexity at worst for push() because it has to search for right place to insert.

#5002208 Best OpenGL books for beginners (C++)

Posted by on 18 November 2012 - 08:44 PM

Look at this one - OpenGL SuperBible. It's brilliant. I'm reading it now and I like it so much.

Be careful about this book. This book teaches OpenGL wrapper library, not the actual OpenGL itself.
I'm waiting for this book to come out in next February