Click here to Skip to main content
15,881,709 members
Home / Discussions / C#
   

C#

 
AnswerRe: Web Services - Error in deserializing body of request message for operation Pin
Gerry Schmitz10-Feb-16 5:13
mveGerry Schmitz10-Feb-16 5:13 
Question'ctor design and extra "cost" of using nullable ValueTypes ? Pin
BillWoodruff9-Feb-16 0:31
professionalBillWoodruff9-Feb-16 0:31 
AnswerRe: 'ctor design and extra "cost" of using nullable ValueTypes ? Pin
Pete O'Hanlon9-Feb-16 1:02
mvePete O'Hanlon9-Feb-16 1:02 
GeneralRe: 'ctor design and extra "cost" of using nullable ValueTypes ? Pin
BillWoodruff9-Feb-16 20:08
professionalBillWoodruff9-Feb-16 20:08 
GeneralRe: 'ctor design and extra "cost" of using nullable ValueTypes ? Pin
Pete O'Hanlon9-Feb-16 21:30
mvePete O'Hanlon9-Feb-16 21:30 
SuggestionRe: 'ctor design and extra "cost" of using nullable ValueTypes ? Pin
Richard Deeming9-Feb-16 1:51
mveRichard Deeming9-Feb-16 1:51 
GeneralRe: 'ctor design and extra "cost" of using nullable ValueTypes ? Pin
BillWoodruff9-Feb-16 20:09
professionalBillWoodruff9-Feb-16 20:09 
QuestionLarge terrain problem in main first game Pin
Member 122480289-Feb-16 0:25
Member 122480289-Feb-16 0:25 
I am try main first game, and have problem with terrain creatin. When i am load and use large texture is ok, when i am moving in game crash program with this message:

System.OutOfMemoryException: Out of memory.

at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at sls.go.GoPaint(Object sender, PaintEventArgs e) in c:\Users\Jozef\Documenty\SharpDevelop Projects\sls\sls\go.cs:line 93
at System.Windows.Forms.Control.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Form.OnPaint(PaintEventArgs e)
at System.Windows.Forms.Control.PaintWithErrorHandling(PaintEventArgs e, Int16 layer)
at System.Windows.Forms.Control.WmPaint(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Here is source code:

C#
/*
   Game Rise of The Synaptic 1/3
   Copyright (C) 2016 Jozef Bakoš
   Tento program je slobodný softvér: môžete ho šíriť a upravovať podľa ustanovení Všeobecnej verejnej licencie GNU 
   (GNU General Public Licence), vydávanej nadáciou Free Software Foundation a to buď podľa 3. verzie tejto Licencie, 
   alebo (podľa vášho uváženia) ktorejkoľvek neskoršej verzie. Tento program je rozširovaný v nádeji, že bude užitočný,
   avšak BEZ AKEJKOĽVEK ZÁRUKY. Neposkytujú sa ani odvodené záruky PREDAJNOSTI alebo VHODNOSTI PRE URČITÝ ÚČEL. 
   Ďalšie podrobnosti hľadajte vo Všeobecnej verejne licencii GNU.

   Kópiu Všeobecnej verejnej licencie GNU ste mali dostať spolu s týmto programom. 
   Ak sa tak nestalo, nájdete ju tu: <http://www.gnu.org/licenses/>. .
 */
 
using System;
using System.Drawing;
using System.Windows.Forms;
using PlaySound;
using System.Drawing.Drawing2D;

namespace sls
{

	/// <summary>
	/// Description of go.
	/// </summary>
	public partial class go : Form
	{
		public go()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			//
			// TODO: Add constructor code after the InitializeComponent() call.
			//
		}
		int RotatePlayerinfo = 0;
		int TempMatrixX = 0;
		int TempMatrixY = 0;
		bool left;
		bool right;
		bool up;
		bool down;
		
		
		void GoLoad(object sender, EventArgs e)
		{
			// Default setings
			this.Cursor = Cursors.Cross;
     		this.ControlBox = false;
			//this.FormBorderStyle = FormBorderStyle.None;
            this.WindowState = FormWindowState.Maximized;
            this.DoubleBuffered = true;
			
            // Timer setings
            Refresh.Interval = 50;
			Refresh.Enabled = true;
			PlayerInfo.Interval = 500;
            PlayerInfo.Enabled = true;
            PlayerMoving.Interval = 50;
            PlayerMoving.Enabled = true;
            
           
            
			// Picturebox setings
			//playerBox.BackColor = Color.Transparent;
			
			// Event setings
			this.Paint += new PaintEventHandler(GoPaint);
			
 		}
		
		void GoKeyDown(object sender, KeyEventArgs e)
		{
			if ( e.KeyCode == Keys.Left ) { left = true; }
			if ( e.KeyCode == Keys.Right) { right = true; }
			if ( e.KeyCode == Keys.Up ) { up = true; }
			if ( e.KeyCode == Keys.Down ) { down = true; }
		}
		
		void GoKeyUp(object sender, KeyEventArgs e)
		{
			if ( e.KeyCode == Keys.Left ) { left = false; }
			if ( e.KeyCode == Keys.Right) { right = false; }
			if ( e.KeyCode == Keys.Up ) { up = false; }
			if ( e.KeyCode == Keys.Down ) { down = false; }
		}
		
		void GoPaint(object sender, PaintEventArgs e)
		{
			 Image terrain = Image.FromFile(@"object\terrain.bmp");
			 e.Graphics.DrawImage(terrain, TempMatrixX, TempMatrixY);
			 
			 Image player = Image.FromFile(@"object\player1.png");
			 e.Graphics.DrawImage(player , 0, this.Height - 130, 100 , 100);
    	}
		
		void RefreshTick(object sender, EventArgs e)
		{
			this.Refresh();
		}
		
		void PlayerInfoTick(object sender, EventArgs e)
		{
			// Rotate player
			RotatePlayerinfo++;
		}
		
		void PlayerMovingTick(object sender, EventArgs e)
		{
	     	// Debug information
			this.Text="Terrain X:"+TempMatrixX+" Terrain Y:"+TempMatrixY;
			
			if ( TempMatrixX > -1 ) { TempMatrixX = -1; }
			if ( TempMatrixY > -1 ) { TempMatrixY = -1; }
			
			// Move verticaly terrainBox
			if ( up == true ) { TempMatrixY++;  }
			if ( down == true ) { TempMatrixY--; }
				
			// Move horizontaly terrainBox
			if ( left == true ) { TempMatrixX--; } 
		if ( right == true ) { TempMatrixX++;}
			
		
		}
		
	}
}




Can you please help fix this bug. Thx
AnswerRe: Large terrain problem in main first game Pin
OriginalGriff9-Feb-16 0:45
mveOriginalGriff9-Feb-16 0:45 
GeneralRe: Large terrain problem in main first game Pin
Member 122480289-Feb-16 1:03
Member 122480289-Feb-16 1:03 
QuestionCode or .NET class in C# similar to what inf2cat does ? Pin
Coding4DMasses8-Feb-16 23:07
Coding4DMasses8-Feb-16 23:07 
AnswerRe: Code or .NET class in C# similar to what inf2cat does ? Pin
Garth J Lancaster8-Feb-16 23:45
professionalGarth J Lancaster8-Feb-16 23:45 
GeneralRe: Code or .NET class in C# similar to what inf2cat does ? Pin
Coding4DMasses8-Feb-16 23:50
Coding4DMasses8-Feb-16 23:50 
Question(c#) Detection of encoding imported txt files ? Pin
Member 104109728-Feb-16 21:17
Member 104109728-Feb-16 21:17 
AnswerRe: (c#) Detection of encoding imported txt files ? Pin
Thomas Daniels8-Feb-16 21:34
mentorThomas Daniels8-Feb-16 21:34 
GeneralRe: (c#) Detection of encoding imported txt files ? Pin
Member 104109728-Feb-16 23:31
Member 104109728-Feb-16 23:31 
AnswerRe: (c#) Detection of encoding imported txt files ? Pin
Sascha Lefèvre8-Feb-16 21:54
professionalSascha Lefèvre8-Feb-16 21:54 
QuestionHow can i use instead of Sleep() method? Pin
sugarpasa8-Feb-16 10:11
sugarpasa8-Feb-16 10:11 
AnswerRe: How can i use instead of Sleep() method? Pin
Richard Andrew x648-Feb-16 11:24
professionalRichard Andrew x648-Feb-16 11:24 
GeneralRe: How can i use instead of Sleep() method? Pin
sugarpasa8-Feb-16 11:48
sugarpasa8-Feb-16 11:48 
GeneralRe: How can i use instead of Sleep() method? Pin
Richard Andrew x648-Feb-16 11:50
professionalRichard Andrew x648-Feb-16 11:50 
GeneralRe: How can i use instead of Sleep() method? Pin
sugarpasa8-Feb-16 12:41
sugarpasa8-Feb-16 12:41 
GeneralRe: How can i use instead of Sleep() method? Pin
Richard Andrew x648-Feb-16 12:15
professionalRichard Andrew x648-Feb-16 12:15 
GeneralRe: How can i use instead of Sleep() method? Pin
sugarpasa8-Feb-16 12:44
sugarpasa8-Feb-16 12:44 
GeneralRe: How can i use instead of Sleep() method? Pin
Richard Andrew x648-Feb-16 12:49
professionalRichard Andrew x648-Feb-16 12:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.