A little Help beginner C++ series, Fart Annoyed - Ball trouble

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
SamCam
Posts: 20
Joined: January 8th, 2020, 3:24 pm

A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by SamCam » January 9th, 2020, 2:19 am

Hey there forum, I'm really enjoying the beginner C++ series. The immediate visual way into looking at C++ is soo much better than anything I've tried before.

I'm just now trying to code up Fart Annoyed without peeking too much at the videos, I've got a pretty good start, I have the RectF function and my bricks all behaving as far as I can tell.

I'm stuck on the Ball. It's all drawn and rendering fine, Update() is providing it with a velocity as I'd like. I cannot for the life of me get it to take a RectF with which to make it rebound off of the "window" RectF which I've setup in Game. Currently, it doesn't seem to be initialising the ball boundary with any real values (position, radius, radius) so the ball vibrates madly on the screen?

Also, I would love to share the solution folder but I'm having trouble slimming down my Solution folder which is currently running at 1.02Gb?! Any suggestions greatly received.

Many thanks to all! ;)

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by albinopapa » January 9th, 2020, 3:55 am

Files you need for the solution:

\Chili Framework 2016.sln <- Loads the Engine.vcxproj file
\Engine\*.h <- all header files
\Engine\*.cpp <- all source files
\Engine\*.res <- all windows resource files
\Engine\Engine.vcxproj.filter <- stores any filter folders and their structure
\Engine\Engine.vcxproj <- main project settings...THIS ONE IS MOST IMPORTANT to load project aside from headers and source files

If you have any sounds or images in a sub folder for your project, you'll need those also.
If you have the version of the framework that has the XAudio subfolder you'll need that one as well.

Any folders marked as .vs, Debug, Release, x64 are not needed.

The .vs folder alone is probably going to be the folder with the biggest size which can be left behind. It gets recreated each time you open the project in VS.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by albinopapa » January 9th, 2020, 3:55 am

You could also create a free GitHub account, upload your stuff to there and just share a link to the repository.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by albinopapa » January 9th, 2020, 4:10 am

I have the RectF function
RectF should be a struct or class, not a function.

I'm guessing you are making the same mistake others have made on here with their Rect constructors.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

SamCam
Posts: 20
Joined: January 8th, 2020, 3:24 pm

Re: A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by SamCam » January 9th, 2020, 6:01 pm

Thanks Albinopapa! a beginners wrong turn of phrase there, I did mean RectF is a class.

Those links you sent me very much helped, I hadn't written the constructors correctly. Having 'solved' that, I'm now having trouble making the ball rebound properly, it feels as though my X and Y's are getting mixed up somewhere.

How much time do you spend banging your head against a wall before asking for help, I've put in a couple of hours...

I hope I've managed to push successfully to my own git repo, if anyone has any suggestions as to what I've fucked up I would be grateful!

https://github.com/SamuelLouisCampbell/Fart_Annoyed.git

albinopapa
Posts: 4373
Joined: February 28th, 2013, 3:23 am
Location: Oklahoma, United States

Re: A little Help beginner C++ series, Fart Annoyed - Ball trouble

Post by albinopapa » January 9th, 2020, 9:39 pm

How much time do you spend banging your head against a wall before asking for help?
LOL, what a question. It depends I suppose. Anywhere from a couple of minutes to a couple of days.

For me specifically, there are probably only a handful of people in this forum that can help me with the stuff I am working on. So if it's something like template meta programming I'll ask after a couple days and then finally hope cyboryxmen is feeling generous. If it's just me not getting the results I'm looking for in Visual Studio I may only spend a few hours before asking for someone to take a look. A fresh pair of eyes is sometimes all you need; so not much skill needed, just a little understanding of the language and experience with debugging.

My gotos are
  • cppreference.com ( it use to be cplusplus.com, but they haven't updated their website since C++11 came out )
  • stackoverflow.com ( might have to check a few of the answers to find what fits your situation )
  • msdn.com ( if it's Windows specific )
  • github.com ( if I want examples of how other people implemented something similar )
  • forum.chili.net ( when all else fails )
I have tried others like gamedev.net when I was learning D3D on my own and had issues.

These resources are mostly used in this order when I'm trying to learn something new. While I'm sure a lot of people on here have gained skills not necessarily taught by chili, I still consider most of the forum members as beginners.

cyboryxmen is a great source for learning about templates and multi-threading
cameron has done some multi-threading, networking and custom allocators
pindrought if I recall correctly has a tutorial on windows networking up on youtube
There was a moderator here by the name of Luis that helped with just about everything code related
Another old moderator Lux use to help out quite a bit with general programming stuff
So far, I don't really have a specialty. I have done a fair bit of messing around with SSE and templates, and a bit of multi-threading, but not at the level Cameron or Cyborxmen have in either multi-threading or template meta-programming.

So if/when I get around to wanting to do some mutli-threading I'll probably give it a go and share on here to get feedback from either of them. Sripting is another area that I have shied away from as well. I haven't found a huge need, but I see the appeal actually. Even in my current project I could be using scripts for my entities once I have the core game logic solidified. This way I can compile once and then edit behavior on the fly or at the very least just restart the game.
If you think paging some data from disk into RAM is slow, try paging it into a simian cerebrum over a pair of optical nerves. - gameprogrammingpatterns.com

Post Reply