![]() |
Optimizing drag function - Printable Version +- Mirage Source (https://mirage-engine.uk/forums) +-- Forum: Mirage Source (Nostalgia) (https://mirage-engine.uk/forums/forumdisplay.php?fid=61) +--- Forum: Archive (2006-2011) (https://mirage-engine.uk/forums/forumdisplay.php?fid=18) +---- Forum: General (https://mirage-engine.uk/forums/forumdisplay.php?fid=17) +---- Thread: Optimizing drag function (/showthread.php?tid=1590) |
Optimizing drag function - Stomach Pulser - 02-03-2008 Well, I am adding a custom top bar to my game (the bar at the top of everything with a minimize, maximize, and exit button). I am coding it myself and made this code to drag it. It occurs when you click on the label that is over the dragable part of the bar. x2 and y2 are integers to store the original location of the cursor (when the user clicks on the bar). Code: Private Sub lblDragBar_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) Is there any way to optimize this? Re: Optimizing drag function - Anthony - 03-03-2008 This is a good place for my question I have been wondering forever haha. Do With statements actually optimize anything? Re: Optimizing drag function - Dr. Spoon - 03-03-2008 simply yes in stead of evaluating/reading the part multiple times it reads With once and reuses what it read the first time Re: Optimizing drag function - Stomach Pulser - 03-03-2008 So this: [code]Public Sub ItemEditorInit() '**************************************************************** '* WHEN WHO WHAT '* ---- --- ---- '* 07/12/2005 Shannara Added gfx constant. '**************************************************************** frmItemEditor.picItems.Picture = LoadPicture(App.Path & GFX_PATH & "items" & GFX_EXT) frmItemEditor.txtName.Text = Trim(Item(EditorIndex).Name) frmItemEditor.scrlPic.Value = Item(EditorIndex).Pic frmItemEditor.cmbType.ListIndex = Item(EditorIndex).Type If (frmItemEditor.cmbType.ListIndex >= ITEM_TYPE_WEAPON) And (frmItemEditor.cmbType.ListIndex = ITEM_TYPE_POTIONADDHP) And (frmItemEditor.cmbType.ListIndex Re: Optimizing drag function - Dr. Spoon - 03-03-2008 basically yes.. Re: Optimizing drag function - Kousaten - 07-03-2008 Interesting. Any clue as to how much improvement we're looking at if one was to optimize all of the initializations with 'With'? |