Click here to Skip to main content
15,880,469 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Large terrain problem in main first game Pin
OriginalGriff9-Feb-16 0:45
mveOriginalGriff9-Feb-16 0:45 
Not in the least surprised, to be honest.
Start by not creating huge numbers of Images.
Because you add your handler to teh Paint event:
C#
this.Paint += new PaintEventHandler(GoPaint);
Every time you move it will get called. And what does it do?
C#
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);
}
Loads two images from files and draws them.
Start by moving those loads out of the paint handler and into the Load event handler via private member variables and use those in your paint event. See what happens.
If that fixes it - and it's quite likely it will - handle the paint event and move your code into that instead of adding a second handler to the chain. It's a lot more obvious to readers what is going on.
And...if that terrain image is the whole background the user is moving across, then I'd strongly suggest you look at redrawing a small part of a move instead of invalidating the whole image and redrawing the lot - it's going to get very slow, very quickly once you have more than one moving object. And it's going to flicker horribly!
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...

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 
GeneralRe: How can i use instead of Sleep() method? Pin
sugarpasa9-Feb-16 6:12
sugarpasa9-Feb-16 6:12 

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.