public bool Frame() { // Read the user input. if (!DApplication.Input.Frame() || DApplication.Input.IsEscapePressed()) { return(false); } // Update the system stats. Timer.Frame2(); if (DPerfLogger.IsTimedTest) { DPerfLogger.Frame(Timer.FrameTime); if (Timer.CumulativeFrameTime >= DPerfLogger.TestTimeInSeconds * 1000) { return(false); } } // Do the frame processing for the applicatioin object. if (!DApplication.Frame()) { return(false); } return(true); }
// Methods public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds) { bool result = false; if (Configuration == null) { Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync); } // Initialize Window. InitializeWindows(title); // Create the application object. DApplication = new DApplication(); // Initialize the application object. if (!DApplication.Initialize(Configuration, RenderForm.Handle)) { return(false); } DPerfLogger.Initialize("RenderForm C# SharpDX: " + Configuration.Width + "x" + Configuration.Height + " VSync:" + DSystemConfiguration.VerticalSyncEnabled + " FullScreen:" + DSystemConfiguration.FullScreen + " " + RenderForm.Text, testTimeSeconds, Configuration.Width, Configuration.Height);; // Create and initialize Timer. Timer = new DTimer(); if (!Timer.Initialize()) { MessageBox.Show("Could not initialize Timer object", "Error", MessageBoxButtons.OK); return(false); } return(result); }
public static EApplication GetByName(string _Name, DBEngine _DatabaseEngine) { return(DApplication.GetByName(new EApplication() { Name = _Name }, _DatabaseEngine)); }
public void ShutDown() { ShutdownWindows(); // Release the graphics object. DApplication?.ShutDown(); DApplication = null; Configuration = null; }
public void ShutDown() { ShutdownWindows(); DPerfLogger.ShutDown(); // Release the Timer object Timer = null; // Release the graphics object. DApplication?.Shutdown(); DApplication = null; Configuration = null; }
// Methods public virtual bool Initialize(string title, int width, int height, bool vSync, bool fullScreen, int testTimeSeconds) { bool result = false; if (Configuration == null) { Configuration = new DSystemConfiguration(title, width, height, fullScreen, vSync); } // Initialize Window. InitializeWindows(title); // Create the application object. DApplication = new DApplication(); // Initialize the application object. if (!DApplication.Initialize(Configuration, RenderForm.Handle, RenderForm.Text, testTimeSeconds)) { return(false); } return(result); }
private void Build(DApplication node, Hints hints, CompilerContext ctx) { var name = node.Target.NodeType == NodeType.Name ? node.Target.GetName() : null; var sv = name != null?GetVariable(name, node, err : false) : ScopeVar.Empty; var newHints = hints.Remove(Last); //Check if an application is in fact a built-in operator call if (name != null && sv.IsEmpty() && node.Arguments.Count == 1) { if (name == "nameof") { var push = GetExpressionName(node.Arguments[0]); AddLinePragma(node); cw.Push(push); return; } else if (name == "valueof") { Build(node.Arguments[0], newHints.Append(Push), ctx); AddLinePragma(node); cw.Unbox(); return; } else if (name == "new") { if (ctx.Function?.TypeName == null) { AddError(CompilerError.CtorNoMethod, node.Location); return; } if (ctx.Function.TypeName.Parent != null || !TryGetLocalType(ctx.Function.TypeName.Local, out var ti)) { AddError(CompilerError.CtorOnlyLocalType, node.Location, ctx.Function.TypeName); return; } Build(node.Arguments[0], newHints.Append(Push), ctx); AddLinePragma(node); cw.Aux(GetMemberNameId(ctx.Function.Name)); cw.NewType(ti.TypeId); return; } } //This is a special optimization for the 'toString', 'has' and 'len' methods //If we see that it is called directly we than emit a direct op code if (node.Target.NodeType == NodeType.Access && !options.NoOptimizations) { var meth = (DAccess)node.Target; if (meth.Name == Builtins.ToStr && node.Arguments.Count == 0) { Build(meth.Target, newHints.Append(Push), ctx); AddLinePragma(node); cw.Str(); PopIf(hints); return; } if (meth.Name == Builtins.Len && node.Arguments.Count == 0) { Build(meth.Target, newHints.Append(Push), ctx); AddLinePragma(node); cw.Len(); PopIf(hints); return; } if (meth.Name == Builtins.Has && node.Arguments.Count == 1 && node.Arguments[0].NodeType == NodeType.String && node.Arguments[0] is DStringLiteral str && str.Chunks == null) { Build(meth.Target, newHints.Append(Push), ctx); AddLinePragma(node); cw.HasMember(GetMemberNameId(str.Value)); PopIf(hints); return; } } //Tail recursion optimization if (!options.NoOptimizations && hints.Has(Last) && !sv.IsEmpty() && ctx.Function != null && !ctx.Function.IsMemberFunction && !ctx.Function.IsIterator && name == ctx.Function.Name && node.Arguments.Count == ctx.Function.Parameters.Count && (ctx.FunctionAddress >> 8) == (sv.Address >> 8) && (ctx.FunctionAddress & byte.MaxValue) == (counters.Count - (sv.Address & byte.MaxValue)) && !ctx.Function.IsVariadic() && !HasLabels(node.Arguments)) { for (var i = 0; i < node.Arguments.Count; i++) { Build(node.Arguments[i], newHints.Append(Push), ctx); } for (var i = 0; i < ctx.Function.Parameters.Count; i++) { var p = ctx.Function.Parameters[ctx.Function.Parameters.Count - i - 1]; var pv = GetVariable(p.Name, p); cw.PopVar(pv.Address); } AddLinePragma(node); cw.Br(ctx.FunctionStart); } else { if (!sv.IsEmpty()) { cw.PushVar(sv); } else { Build(node.Target, newHints.Append(Push), ctx); } AddLinePragma(node); cw.FunPrep(node.Arguments.Count); Dictionary <string, object> dict = null; for (var i = 0; i < node.Arguments.Count; i++) { var a = node.Arguments[i]; if (a.NodeType == NodeType.Label) { if (dict == null) { dict = new Dictionary <string, object>(); } var la = (DLabelLiteral)a; if (dict.ContainsKey(la.Label)) { AddError(CompilerError.NamedArgumentMultipleTimes, la.Location, la.Label); } else { dict.Add(la.Label, null); } Build(la.Expression, newHints.Append(Push), ctx); cw.FunArgNm(la.Label); } else { Build(a, newHints.Append(Push), ctx); cw.FunArgIx(i); } } AddLinePragma(node); cw.FunCall(node.Arguments.Count); } PopIf(hints); }