private static string GetDisplaySetupNew(ICodeBlock fileCode) { var displaySettings = GlueState.Self.CurrentGlueProject.DisplaySettings; fileCode.Line("using Camera = FlatRedBall.Camera;"); var namespaceContents = fileCode.Namespace(ProjectManager.ProjectNamespace); GenerateCameraSetupData(namespaceContents); GenerateResizeBehaviorEnum(namespaceContents); GenerateWidthOrHeightEnum(namespaceContents); var classContents = namespaceContents.Class("internal static", "CameraSetup"); classContents.Line("static Microsoft.Xna.Framework.GraphicsDeviceManager graphicsDeviceManager;"); GenerateStaticCameraSetupData(classContents); GenerateResetMethodNew(displaySettings.GenerateDisplayCode, classContents); GenerateSetupCameraMethodNew(displaySettings.GenerateDisplayCode, classContents); GenerateResetWindow(displaySettings.GenerateDisplayCode, classContents); GenerateHandleResize(classContents); GenerateSetAspectRatio(classContents); return(fileCode.ToString()); }
public string GetCustomCodeTemplateCode(ElementSave element) { // Example: /* * using System; * using System.Collections.Generic; * using System.Linq; * * namespace DesktopGlForms.GumRuntimes.DefaultForms * { * public partial class ButtonRuntime * { * partial void CustomInitialize() * { * * } * } * } * */ var codeBlockBase = new CodeBlockBaseNoIndent(null); ICodeBlock codeBlock = codeBlockBase; var toReturn = codeBlock; codeBlock.Line("using System;"); codeBlock.Line("using System.Collections.Generic;"); codeBlock.Line("using System.Linq;"); codeBlock.Line(); codeBlock = codeBlock.Namespace( GueDerivingClassCodeGenerator.Self.GetFullRuntimeNamespaceFor(element)); { string runtimeClassName = GueDerivingClassCodeGenerator.Self.GetUnqualifiedRuntimeTypeFor(element); codeBlock = codeBlock.Class("public partial", runtimeClassName); { codeBlock = codeBlock.Function("partial void", "CustomInitialize"); } } return(toReturn.ToString()); }