I'M reading this tutorial at http://www.tuxradar.com/beginnerscode at all I have done thus far is enough for an empty game window built with two small .cs files.

Here are the error messages.

Line=15, Column=72, Type=Error, Priority=Normal, Description=An object reference is required to access non-static member TroutWars.MainClass.Quit(object, SdlDotNet.Core.QuitEventArgs)'(CS0120)]

&

Description=`System.EventArgs' does not contain a definition for `Run'(CS0117)]

Here are the files

Main.cs

using System;
using SdlDotNet;
using SdlDotNet.Core;
using SdlDotNet.Graphics;
using System.Drawing;

namespace TroutWars
{
	class MainClass
	{
		public static void Main(string[] args)
		{
			TroutWars game = new TroutWars();
			Video.SetVideoMode(1024, 768);
			Events.Quit += new EventHandler<QuitEventArgs>(Quit);
			EventArgs.Run();
		}
		
		void Quit(object sender, QuitEventArgs e)
		{
			Events.QuitApplication();
		}
	}
}

TroutWars.cs

using System;
using SdlDotNet;
using SdlDotNet.Core;
using SdlDotNet.Graphics;
using System.Drawing;

namespace TroutWars
{
	
	
	public class TroutWars
	{
		
		public TroutWars()
		{
			Console.WriteLine("Hello World!");
		}
	}
}

Any help would be greatly appreciated, thanks.

Recommended Answers

All 2 Replies

The error means that on line 16 of your first code, the class EventArgs does not contain a method Run
I looked at the link you gave: change line 16 to Events.Run().

The error means that on line 16 of your first code, the class EventArgs does not contain a method Run
I looked at the link you gave: change line 16 to Events.Run().

Thanks, that took away one error message, but now I'M getting this one.

[Task:File=/home/developer/Projects/TroutWars/TroutWars/Main.cs, Line=15, Column=72, Type=Error, Priority=Normal, Description=

An object reference is required to access non-static member `TroutWars.MainClass.Quit(object, SdlDotNet.Core.QuitEventArgs)'(CS0120)]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.