Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - UglyIgloo

Pages: [1] 2
1
General / Re: GUI C++ game World Editor based on SFML
« on: December 01, 2014, 10:03:27 pm »
What you'll want to do is either program your own parser or download an XML library for your base engine. After that, look into SFML mouse events. You can set your program to snap to a 32/32 grid if you know how to round numbers in C++.


Good luck!

2
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 27, 2014, 12:30:14 am »
Ha, I've actually been meaning to get my hand on "Effective C++" ever since Tommy Refenes publicly recommended it.

Thank you!


- UglyIgloo

3
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 10:48:31 pm »
My book was " Game Development through C++" by Michael Dawson when I was 12. Didn't feel like I was learning much from it, but then again, I kind of only had the intention of working towards too big of a goal. What book would you recommend?

4
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 10:10:50 pm »
Just one more question:

Like I said before, this is pretty much a scene manager, which means that all the sprites in one scene are stored in this class until they're deleted. If I'm copying, how will I make a reference to a specific instance of a sprite?


Thanks for bearing with me for this long. :P

5
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 03:35:58 pm »
Sorry for the stupid questions.


Isn't copying kind of "bad" practice for something like managing sprites in a scene class?

6
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 03:29:35 pm »
I'm at that frustrating stage of C++ where I "know" the language well enough to pretty much make anything, but not enough to do it right. Going through any crash course/ tutorial series/ C++ book would just be a bore for me since it will be covering the stuff I already know.

7
General / Re: Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 03:14:17 pm »
I'm using Visual Studio 2010, sorry. :(


Also, I thought that you couldn't store objects in vectors without calling new? Every time I try storing sprites in vectors without it, I would get errors, which is why I make it a unique pointer.

8
General / Re: Issues constructing a unique pointer to sf::Sprite
« on: October 26, 2014, 03:30:29 am »
This worked. Thank you!

9
General / Re: Help with understanding the tutorials
« on: October 26, 2014, 02:09:10 am »
Hi.


You'll have to be a little more descriptive in your post. I don't know C#, but I do know that it uses standard programming syntax as seen in most mainstream programming languages. (Java, C++, C#, etc.)


sf:: is a namespace to SFML, which means that it holds a variety of classes and functions that the SFML library uses. You could call "using" at the head of your file instead of calling the namespace, but I wouldn't recommend it, considering namespaces are convenient for creating new functions with similar names.

10
General / Issues constructing a unique pointer to sf::Sprite (Solved)
« on: October 26, 2014, 02:03:41 am »
Hi, I'm having trouble putting an sf::Sprite inside of a unique pointer.

The following code will compile just fine without warnings or errors:

void SpriteManager::attachSprite(sf::Sprite sprite)
{
        Ptr p;
        mSprites.push_back(std::move(p));
}


Ptr is a typedef to this:
typedef std::unique_ptr<sf::Sprite>             Ptr;

When I try to construct a Ptr p with a sf::Sprite like this, however, I get an error.

void SpriteManager::attachSprite(sf::Sprite sprite)
{
        Ptr p(sprite);
        mSprites.push_back(std::move(p));
}
 

Quote
1>SpriteManager.cpp(12): error C2664: 'std::unique_ptr<_Ty>::unique_ptr(std::nullptr_t)' : cannot convert parameter 1 from 'sf::Sprite' to 'std::nullptr_t'

Which I don't really understand, because I thought arguments taken from a unique_ptr's constructor defined their pointer. If someone could help address this issue, that'd be great.


Thanks!

11
General / Re: Custom sleeping function freezes the game
« on: September 15, 2014, 12:32:46 am »
How would I utilize less of the CPU?


Quote
The proper way to pause execution and let the system utilize the cpu for something else is by sleeping your thread.


Not entirely sure what you mean by that. I can only guess you're suggesting I use windows.h's "Sleep" function, which yields the same results.

12
General / Custom sleeping function freezes the game
« on: September 14, 2014, 11:52:51 pm »
void GSleep
{
        sf::Clock clock;
        sf::Time time = sf::seconds(0);

        while(x > time)
        {
                time = clock.getElapsedTime();
        }
}

This function was created to make the game wait for a certain amount of time before carrying out the next order. Unfortunately, this causes the entire game to freeze until it is done waiting. I only want it to prevent the next line of code from happening until it is done. Thanks.

13
General / Re: Collision... yer driving me crazy
« on: September 12, 2014, 03:22:00 am »
Thanks for the help so far. I recently got back my internet connection and I've made some major alterations to my collision code while I was away.

bool player::collision(entity* cEntity)
{
        if(right < cEntity->left || left > cEntity->right ||
                 top > cEntity->bottom || bottom < cEntity->top )
        {
                return false;
        }

        velocity = -velocity;

        return true;
}

When a player presses the WSAD keys, their sf::Vector2f velocity changes to a certain value. The game is constantly updating to move() the player based on their velocity vector.

Right now, one major issue I'm experiencing with this code is that it will make sure the players controls are reversed until it is no longer intersecting with CEntity. I just can't wrap my head around collision response and I don't know how to use Box2D.


My collision code is loosely based off of this tutorial by CodingMadeEasy.


14
General / Re: Collision... yer driving me crazy
« on: September 01, 2014, 01:50:01 am »
Have any suggestions for fixing it?

15
General / Re: Collision... yer driving me crazy
« on: August 31, 2014, 01:55:51 am »
Hi, thanks for responding. Sadly, I'm on mobile right now and will probably stay in mobile for about a week because I just moved. The most I can say is that the vertical code is literally just the horizontal code with the variables switched. I can confirm that the variable are right because when I remove the horizontal code, it works fine.

Pages: [1] 2