private static void Script_ResetTime(idWindow window, List <idWinGuiScript> source) { idWinString parameter = (source.Count > 0) ? source[0].Variable as idWinString : null; DrawWindow drawWindow = null; if ((parameter != null) && (source.Count > 1)) { drawWindow = window.UserInterface.Desktop.FindChildByName(parameter); parameter = source[1].Variable as idWinString; } int tmp; int.TryParse(parameter, out tmp); if ((drawWindow != null) && (drawWindow.Window != null)) { drawWindow.Window.ResetTime(tmp); drawWindow.Window.EvaluateRegisters(-1, true); } else { window.ResetTime(tmp); window.EvaluateRegisters(-1, true); } }
private void ExternalMenuView_ClosingDisposeEvent() { if (DrawWindow != null) { DrawWindow.Close(); DrawWindow = null; } }
public override idWindowVariable GetVariableByName(string name, bool fixup, ref DrawWindow owner) { if (name.ToLower() == "bind") { return(_bindName); } return(base.GetVariableByName(name, fixup, ref owner)); }
private void CreateStandardControls() { m_solutionExplorer = new SolutionExplorer(); m_propertyWindow = new PropertyWindow(); m_toolbox = new Toolbox(); m_outputWindow = new OutputWindow(); m_taskList = new TaskList(); m_drawWindow = new DrawWindow(); }
// отрисовка уже нарисованного изображения private void PaintSavedImage() { graphicsField.Clear(Color.White); foreach (Figure figure in figureList) { figure.Draw(); //Console.WriteLine(figure.FigureName); } DrawWindow.Invalidate(); }
public PaintTool(DrawWindow parent, IBrush brush) { _parent = parent; _brush = brush; var map = _parent.TilerMap; if (_brush == null) _brush = new NormalBrush(map != null ? map.TileResolution : 1, TileTexture.None); }
private void Button_StopDraw_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); if (DrawWindow != null) { DrawWindow.Close(); DrawWindow = null; } }
public FillTool(DrawWindow parent, NormalBrush brush) { _parent = parent; var map = _parent.TilerMap; _brush = brush; if (_brush == null) _brush = new NormalBrush(map != null ? map.TileResolution : 1, TileTexture.None); _brush.BrushSize = new Point(1, 1); }
public PaintTool(DrawWindow parent, IBrush brush) { _parent = parent; _brush = brush; var map = _parent.TilerMap; if (_brush == null) { _brush = new NormalBrush(map != null ? map.TileResolution : 1, TileTexture.None); } }
private void Button_RunDraw_Click(object sender, RoutedEventArgs e) { AudioUtil.ClickSound(); Memory.SetForegroundWindow(); if (DrawWindow == null) { DrawWindow = new DrawWindow(); DrawWindow.Show(); } }
private static void Script_SetFocus(idWindow window, List <idWinGuiScript> source) { idWinString parameter = source[0].Variable as idWinString; if (parameter != null) { DrawWindow drawWindow = window.UserInterface.Desktop.FindChildByName(parameter.ToString()); if ((drawWindow != null) && (drawWindow.Window != null)) { window.SetFocus(drawWindow.Window); } } }
public FillTool(DrawWindow parent, NormalBrush brush) { _parent = parent; var map = _parent.TilerMap; _brush = brush; if (_brush == null) { _brush = new NormalBrush(map != null ? map.TileResolution : 1, TileTexture.None); } _brush.BrushSize = new Point(1, 1); }
private void updateScreen() { //Setting up the canvas every time to allow for dynamic screen width DrawWindow.Width = this.Width - 15; DrawWindow.Height = this.Height - 15; screenWidth = DrawWindow.Width; screenHeight = DrawWindow.Height; sPicture = new Bitmap(screenWidth, screenHeight); sCanvas = Graphics.FromImage(sPicture); canvas = DrawWindow.CreateGraphics(); //Reset the canvas (mainly in case of moving images so its not super important here (I don't like the idea of having thousands of the same square drawn in the same space even though it makes no difference to the code or performance whatsoever) sCanvas.Clear(Color.FromArgb(29, 17, 66)); sf.LineAlignment = StringAlignment.Center; sf.Alignment = StringAlignment.Center; sCanvas.DrawString(attemptsRemaining.ToString(), tFont, tBrush, screenWidth - 60, 60, sf); //Cheaty Cheaty sCanvas.DrawString("Totally not " + word.getWord(), smallTFont, tBrush, 10, 10); //Draw all the stuff int charX = 40; int charY = 80; foreach (char c in attemptedChars) { sCanvas.DrawString(c.ToString(), tFont, tBrush, charX, charY, sf); if (charX >= screenWidth - 180) { charX = 40; charY += 60; } else { charX += 60; } } for (int i = 1; i < word.length() + 1; i++) { letterX[i - 1] = (screenWidth / 2) - ((textWidth + textPadding) * i) + (((textWidth + textPadding) * word.length() / 2) + textPadding / 2); letterY[i - 1] = screenHeight - 50; sCanvas.FillRectangle(tBrush, letterX[i - 1], screenHeight - 50, textWidth, 4); //Draw attempts remaining and the succeeded letters sCanvas.DrawString(buildingChars[word.length() - i].ToString(), tFont, tBrush, letterX[i - 1] + 30, letterY[i - 1] - 30, sf); } if (attemptsRemaining < 10) { try { State = Image.FromFile(@"Assets\Step" + (10 - attemptsRemaining) + ".png"); } catch { } sCanvas.DrawImage(State, screenWidth / 2 - 250, screenHeight / 2 - 350, 500, 500); } canvas.DrawImage(sPicture, 0, 0, screenWidth, screenHeight); }
private void reset() { //Graphics setup screenWidth = DrawWindow.Width; screenHeight = DrawWindow.Height; sPicture = new Bitmap(screenWidth, screenHeight); sCanvas = Graphics.FromImage(sPicture); canvas = DrawWindow.CreateGraphics(); //Word and text recording setup word.PickNew(); textWidth = 60; textPadding = 10; buildingChars = new char[word.length()]; attemptedChars = new List <char>(); attemptsRemaining = 10; //Letter underline X and Y letterX = new int[word.length()]; letterY = new int[word.length()]; updateScreen(); }
public MainForm() { InitializeComponent(); CvInvoke.UseOpenCL = false; _drawWindow = new DrawWindow(); _drawWindow.Show(this); _strokeRecognizer.OnStrokeUpdated += StrokeUpdated; _strokeRecognizer.OnClearZoneHit += ClearZoneHit; _drawing.OnBitmapChanged += () => { _drawWindow.Image = _drawing.Bitmap; }; _drawing.RecreateBitmap(); drawWindowPropertyGrid.PropertyValueChanged += (o, args) => _drawWindow.RefreshSoon(); UpdatePropertyGrids(); _tuioReceiver.PointReceived += TuioReceiverOnPointReceived; tuioCheckbox.Checked = true; TuioChanged(null, null); StartOrStopCapture(captureCheckbox.Checked); _uiUpdateTimer.Tick += (sender, args) => UpdateUI(); }
public override idWindowVariable GetVariableByName(string name, bool fixup, ref DrawWindow owner) { string nameLower = name.ToLower(); if (nameLower == "model") { return(_modelName); } else if (nameLower == "anim") { return(_animationName); } else if (nameLower == "lightorigin") { return(_lightOrigin); } else if (nameLower == "lightcolor") { return(_lightColor); } else if (nameLower == "modelorigin") { return(_modelOrigin); } else if (nameLower == "modelrotate") { return(_modelRotate); } else if (nameLower == "viewoffset") { return(_viewOffset); } else if (nameLower == "needsrender") { return(_needsRender); } return(base.GetVariableByName(name, fixup, ref owner)); }
public override idWindowVariable GetVariableByName(string name, bool fixup, ref DrawWindow owner) { string nameLower = name.ToLower(); if (nameLower == "value") { return(_value); } else if (nameLower == "cvar") { return(_cvarStr); } else if (nameLower == "liveupdate") { return(_liveUpdate); } else if (nameLower == "cvargroup") { return(_cvarGroup); } return(base.GetVariableByName(name, fixup, ref owner)); }
public override idWindowVariable GetVariableByName(string name, bool fixup, ref DrawWindow owner) { if (this.Disposed == true) { throw new ObjectDisposedException(this.GetType().Name); } string nameLower = name.ToLower(); if (nameLower == "choices") { return(_choicesStr); } else if (nameLower == "values") { return(_choiceValues); } else if (nameLower == "cvar") { return(_cvarStr); } else if (nameLower == "gui") { return(_guiStr); } else if (nameLower == "liveupdate") { return(_liveUpdate); } else if (nameLower == "updategroup") { return(_updateGroup); } return(base.GetVariableByName(name, fixup, ref owner)); }
private IDockContent GetContentFromPersistString(string persistString) { if (persistString == typeof(SolutionExplorer).ToString()) { return(m_solutionExplorer); } else if (persistString == typeof(PropertyWindow).ToString()) { return(m_propertyWindow); } else if (persistString == typeof(Toolbox).ToString()) { return(m_toolbox); } else if (persistString == typeof(OutputWindow).ToString()) { return(m_OutputWindow); } else if (persistString == typeof(DrawWindow).ToString()) { return(m_DrawWindow); } else if (persistString == typeof(TaskList).ToString()) { return(m_taskList); } else { // DummyDoc overrides GetPersistString to add extra information into persistString. // Any DockContent may override this value to add any needed information for deserialization. string[] parsedStrings = persistString.Split(new char[] { ',' }); if (parsedStrings.Length != 5) { return(null); } if (parsedStrings[0] != typeof(Doc).ToString()) { return(null); } Doc dummyDoc = new Doc(); if (parsedStrings[1] != string.Empty) { dummyDoc.FileName = parsedStrings[1]; } if (parsedStrings[2] != string.Empty) { dummyDoc.Text = parsedStrings[2]; } DrawWindow drawWindow = new DrawWindow(); if (parsedStrings[3] != string.Empty) { drawWindow.FileName = parsedStrings[3]; } drawWindow.Text = parsedStrings[4]; return(dummyDoc); } }
/*public static DrawTileSetWindow Create(DrawWindow draw) * { * var window = GetWindow<DrawTileSetWindow>(); * window.title = "Tilesets"; * window._draw = draw; * return window; * }*/ public DrawTileSetWindow(DrawWindow draw) { _draw = draw; OnEnable(); }
public BrushWindow(DrawWindow draw) { _draw = draw; }
public void FixupParameters(idWindow window) { if (_handler == Script_Set) { bool precacheBackground = false; bool precacheSounds = false; idWinString str = (idWinString)_parameters[0].Variable; idWindowVariable dest = window.GetVariableByName(str.ToString(), true); if (dest != null) { _parameters[0].Variable = dest; _parameters[0].Owner = false; if (dest is idWinBackground) { precacheBackground = true; } } else if (str.ToString().ToLower() == "cmd") { precacheSounds = true; } int parameterCount = _parameters.Count; for (int i = 1; i < parameterCount; i++) { str = (idWinString)_parameters[i].Variable; string strValue = str.ToString(); if (strValue.StartsWith("gui::", StringComparison.InvariantCultureIgnoreCase) == true) { // always use a string here, no point using a float if it is one // FIXME: This creates duplicate variables, while not technically a problem since they // are all bound to the same guiDict, it does consume extra memory and is generally a bad thing idWinString defVar = new idWinString(null); defVar.Init(strValue, window); window.AddDefinedVariable(defVar); _parameters[i].Variable = defVar; _parameters[i].Owner = false; //dest = win->GetWinVarByName(*str, true); //if (dest) { // delete parms[i].var; // parms[i].var = dest; // parms[i].own = false; //} // } else if (strValue.StartsWith("$") == true) { // // dont include the $ when asking for variable dest = window.UserInterface.Desktop.GetVariableByName(strValue.Substring(1), true); // if (dest != null) { _parameters[i].Variable = dest; _parameters[i].Owner = false; } } else if (strValue.StartsWith("#str_") == true) { str.Set(idE.Language.Get(strValue)); } else if (precacheBackground == true) { idE.DeclManager.FindMaterial(strValue).Sort = (float)MaterialSort.Gui; } else if (precacheSounds == true) { idConsole.Warning("TODO: PrecacheSounds"); // Search for "play <...>" /*idToken token; * idParser parser( LEXFL_NOSTRINGCONCAT | LEXFL_ALLOWMULTICHARLITERALS | LEXFL_ALLOWBACKSLASHSTRINGCONCAT ); * parser.LoadMemory(str->c_str(), str->Length(), "command"); * * while ( parser.ReadToken(&token) ) { * if ( token.Icmp("play") == 0 ) { * if ( parser.ReadToken(&token) && ( token != "" ) ) { * declManager->FindSound( token.c_str() ); * } * } * }*/ } } } else if (_handler == Script_Transition) { if (_parameters.Count < 4) { idConsole.Warning("Window {0} in gui {1} has a bad transition definition", window.Name, window.UserInterface.SourceFile); } idWinString str = (idWinString)_parameters[0].Variable; // DrawWindow destOwner = null; idWindowVariable dest = window.GetVariableByName(str.ToString(), true, ref destOwner); // if (dest != null) { _parameters[0].Variable = dest; _parameters[0].Owner = false; } else { idConsole.Warning("Window {0} in gui {1}: a transition does not have a valid destination var {2}", window.Name, window.UserInterface.SourceFile, str); } // // support variables as parameters for (int c = 1; c < 3; c++) { str = (idWinString)_parameters[c].Variable; idWinVector4 v4 = new idWinVector4(null); _parameters[c].Variable = v4; _parameters[c].Owner = true; DrawWindow owner = null; if (str.ToString().StartsWith("$") == true) { dest = window.GetVariableByName(str.ToString().Substring(1), true, ref owner); } else { dest = null; } if (dest != null) { idWindow ownerParent; idWindow destParent; if (owner != null) { ownerParent = (owner.Simple != null) ? owner.Simple.Parent : owner.Window.Parent; destParent = (destOwner.Simple != null) ? destOwner.Simple.Parent : destOwner.Window.Parent; // if its the rectangle they are referencing then adjust it if ((ownerParent != null) && (destParent != null) && (dest == ((owner.Simple != null) ? owner.Simple.GetVariableByName("rect") : owner.Window.GetVariableByName("rect")))) { idRectangle rect = ((idWinRectangle)dest).Data; ownerParent.ClientToScreen(ref rect); destParent.ScreenToClient(ref rect); v4.Set(dest.ToString()); } else { v4.Set(dest.ToString()); } } else { v4.Set(dest.ToString()); } } else { v4.Set(str.ToString()); } } } else { int c = _parameters.Count; for (int i = 0; i < c; i++) { _parameters[i].Variable.Init(_parameters[i].Variable.ToString(), window); } } }
/*public static DrawTileSetWindow Create(DrawWindow draw) { var window = GetWindow<DrawTileSetWindow>(); window.title = "Tilesets"; window._draw = draw; return window; }*/ public DrawTileSetWindow(DrawWindow draw) { _draw = draw; OnEnable(); }