Looking for a little error support

The Partridge Family were neither partridges nor a family. Discuss.
Post Reply
ThimbleFire
Posts: 2
Joined: April 19th, 2019, 4:34 pm

Looking for a little error support

Post by ThimbleFire » April 19th, 2019, 4:53 pm

Hi, I've been following along with Chili's intermediate tutorial. I started his text drawing video but since he didn't write out a lot of the code during the video I thought I'd snatch it up from github. A lot of the methods had changed since that video however, so I tried amending the missing draw methods in the Graphics class.

I then very stupidly copy pasted his entire graphics.h and .cpp into my project, only to realise a lot of the methods were missing, like PutPixel, GetPixel, DrawSprite and BeginFrame.

Anyway, I'm quite capable of backing up and rewatching those videos or even winging it.
Since adding the SpriteEffects class I've been getting errors in my graphics class and can't for the life of me figure out why. I assumed it was something to do with looping dependencies so I removed the prototypes for the DrawSprite method using templates seen at the bottom of the graphics header.

So I removed those and made it so the draw method only works with the Chroma SpecialEffect.

Anyway TL;DR Help me figure out why I have this error:
syntax error: identifier 'Graphics' (compiling source file <every source file>)
'gfx': undeclared identifier (compiling source file <every source file>)

Here's a download link (dropbox) to a zip containing the project: https://www.dropbox.com/s/l3tgjzbpxcagd ... e.zip?dl=0

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Looking for a little error support

Post by chili » April 19th, 2019, 4:58 pm

ThimbleFire wrote:
April 19th, 2019, 4:53 pm
A lot of the methods had changed since that video however, so I tried amending the missing draw methods in the Graphics class.
A piece of advice: use the git history to go to any point in the evolution of the codebase. Don't limit yourself to just the head of branch master.
Chili

ThimbleFire
Posts: 2
Joined: April 19th, 2019, 4:34 pm

Re: Looking for a little error support

Post by ThimbleFire » April 23rd, 2019, 12:56 pm

chili wrote:
April 19th, 2019, 4:58 pm
ThimbleFire wrote:
April 19th, 2019, 4:53 pm
A lot of the methods had changed since that video however, so I tried amending the missing draw methods in the Graphics class.
A piece of advice: use the git history to go to any point in the evolution of the codebase. Don't limit yourself to just the head of branch master.
Yeah I really ought to get a better grasp on github and visual studio.

User avatar
chili
Site Admin
Posts: 3948
Joined: December 31st, 2011, 4:53 pm
Location: Japan
Contact:

Re: Looking for a little error support

Post by chili » April 23rd, 2019, 3:14 pm

You still struggling with this one or have you figured it out already on your own?
Chili

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

Re: Looking for a little error support

Post by albinopapa » April 23rd, 2019, 9:46 pm

The issue is your SpriteEffects.h stuff doesn't know about Graphics, and you have it included in Graphics.h so you can't just include Graphics.h in SpriteEffects.h or else you end up with a circular dependency.

I believe the way chili handled this was with templates. Instead of making a function for each sprite effect, you create a template function that takes an effect function object ( SpriteEffect::Chroma for instance ). This way, Graphics.h doesn't need to know about any of the effects.
Attachments
Sprite.zip
Check out the commit history to see a log of changes
(5.32 MiB) Downloaded 134 times
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