Author Topic: Game Class  (Read 1615 times)

0 Members and 1 Guest are viewing this topic.

Offline crashtic

  • Visitor
  • Join Date: Mar 2014
  • Posts: 3
  • Karma: 0
  • Game: Skyrim
  • Genre: RPG
  • Platform: PC/Steam
  • Studio: ??
Game Class
« on: March 28, 2014, 08:29:27 PM »
I set up the game class the book show's in visual studio 2013 as a new class item, but I get an error that Form1 is not recognized. *public Game(Form1 form, int width, int height)*
When I open the book version of Framework Demo it appears to show Form1 as a class item in the code line.
I even tried copying the DEMO game.cs file into my folder and it shows the error for Form1 as well. Is there a sync that is missing.
 



Offline crashtic

  • Visitor
  • Join Date: Mar 2014
  • Posts: 3
  • Karma: 0
  • Game: Skyrim
  • Genre: RPG
  • Platform: PC/Steam
  • Studio: ??
Re: Game Class
« Reply #1 on: March 28, 2014, 09:40:22 PM »
I appear to have resolved the error by changing it to FrameWork.Form1. (FrameWork is the project file name)
However it seems the Game.cs class file will need this change done every time it is added to a new project.

Offline twobitcoder

  • Administrator
  • -[ EPIC MEMBER ]-
  • *****
  • Join Date: Mar 2007
  • Posts: 4,931
  • Karma: 69
    • jharbour.com
  • Game: Adventure
  • Genre: RPG
  • Platform: Atari
  • Studio: Activision
Re: Game Class
« Reply #2 on: March 29, 2014, 11:12:04 AM »
I'm glad you figure that out because I haven't tested any of the C# code in VS 2013 yet. I'm upgrading Beginning Game Programming in VS 2013 and found it to be extremely easy to use, a very good new version (like 2010 was), but I had a lot of probs with 2012.

Offline ismith

  • Visitor
  • Join Date: Jun 2014
  • Posts: 2
  • Karma: 0
  • Game: Skyrim
  • Genre: RPG
  • Platform: Other
  • Studio: Bioware
Re: Game Class
« Reply #3 on: June 05, 2014, 10:02:09 AM »
Actually, it seems that the constructor should take a parameter of type Form instead of Form1. In other words:

Code: [Select]
public Game(Form form, int width, int height)
While I know that it is valid to assign a descendant of Form to a Form variable, why bother? Of course, I'm only up to chapter 2...