/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected async Task LoadContent() { pointerTexture = await LoadImage("pointer"); runningTexture = await LoadImage("running"); breakpointTexture = await LoadImage("breakpoint"); runTexture = await LoadImage("run"); stepInTexture = await LoadImage("stepin"); stepOverTexture = await LoadImage("stepover"); stepOutTexture = await LoadImage("stepout"); restartTexture = await LoadImage("restart"); //ui.Add(new UIButton("Run (F5)", runTexture, new Rectangle(100, 650, 120, 40), defaultButtonStyle, DoRun)); //ui.Add(new UIButton("Step In (F11)", stepInTexture, new Rectangle(240, 650, 120, 40), defaultButtonStyle, DoStepIn)); //ui.Add(new UIButton("Step Over (F10)", stepOverTexture, new Rectangle(380, 650, 120, 40), defaultButtonStyle, DoStepOver)); //ui.Add(new UIButton("Step Out (^F11)", stepOutTexture, new Rectangle(520, 650, 120, 40), defaultButtonStyle, DoStepOut)); //ui.Add(new UIButton("Restart", restartTexture, new Rectangle(660, 650, 120, 40), defaultButtonStyle, DoRestart)); await DoRestart(); }
public async Task <Texture2D> LoadImage(string v) { Texture2D image = new Texture2D { Src = $"Content/{v}.png" }; image.OnLoad = e => ImageLoaded(image); task = new TaskCompletionSource <Texture2D>(); return(await task.Task); }
public void DrawImage(Texture2D image, Vector2 position) { context.DrawImage(image, position.X, position.Y); }
static void ImageLoaded(Texture2D image) { task.SetResult(image); }