public DopaScript.Value DrawImage(DopaScript.FunctionCallArgs parameters) { this.Invoke(new Action(() => { Image img = Images[(int)parameters.Values[0].NumericValue]; if (parameters.Values.Count == 3) { Graphic.DrawImage(img, new Point((int)parameters.Values[1].NumericValue, (int)parameters.Values[2].NumericValue)); } else if (parameters.Values.Count == 7) { Rectangle source = new Rectangle(); source.X = (int)parameters.Values[1].NumericValue; source.Y = (int)parameters.Values[2].NumericValue; source.Width = (int)parameters.Values[3].NumericValue; source.Height = (int)parameters.Values[4].NumericValue; Rectangle destination = new Rectangle(); destination.X = (int)parameters.Values[5].NumericValue; destination.Y = (int)parameters.Values[6].NumericValue; destination.Width = (int)parameters.Values[3].NumericValue; destination.Height = (int)parameters.Values[4].NumericValue; Graphic.DrawImage(img, source, destination, GraphicsUnit.Pixel); } })); return(null); }
public DopaScript.Value IsKeyPressed(DopaScript.FunctionCallArgs parameters) { return(new DopaScript.Value() { Type = DopaScript.Value.DataType.Boolean, BoolValue = CurrentKeyPressed.Contains((int)parameters.Values[0].NumericValue) }); }
public DopaScript.Value Flip(DopaScript.FunctionCallArgs parameters) { this.Invoke(new Action(() => { pictureBoxScreen.Image = BackBuffer; pictureBoxScreen.Refresh(); })); return(null); }
public DopaScript.Value FillRectangle(DopaScript.FunctionCallArgs parameters) { this.Invoke(new Action(() => { Brush brush = new SolidBrush(Color.FromName(parameters.Values[0].StringValue)); Rectangle rect = new Rectangle(); rect.X = (int)parameters.Values[1].NumericValue; rect.Y = (int)parameters.Values[2].NumericValue; rect.Width = (int)parameters.Values[3].NumericValue; rect.Height = (int)parameters.Values[4].NumericValue; Graphic.FillRectangle(brush, rect); })); return(null); }
public DopaScript.Value LoadImage(DopaScript.FunctionCallArgs parameters) { int imageId = 0; this.Invoke(new Action(() => { imageId = Images.Count; Images.Add(Bitmap.FromFile(Path.Combine(SelectedGame.FullName, parameters.Values[0].StringValue))); })); return(new DopaScript.Value() { Type = DopaScript.Value.DataType.Numeric, NumericValue = imageId }); }