protected override void Initialize() { SfxrSynth.AudioPlayerFactory = new Audio.AudioPlayerFactory(); base.Initialize(); engineRef = new EngineReference(); displayTarget = new DisplayTarget(engineRef, Window, graphics); textureFactory = new TextureFactory(this.GraphicsDevice); spriteBatch = new SpriteBatch(GraphicsDevice); inputFactory = new InputFactory(displayTarget); runner = new RunnerWrapper("./Content/MusicDemo.pv8", engineRef, displayTarget, textureFactory, inputFactory); runner.Initialize(); // forces viewport adapter to refresh position/scaling graphics.PreferredBackBufferWidth = graphics.PreferredBackBufferWidth; graphics.PreferredBackBufferHeight = graphics.PreferredBackBufferHeight; graphics.ApplyChanges(); }
/// <summary> /// We'll use the Start method to configure our PixelVisionEngin and load a game. /// </summary> public virtual void Start() { // Pixel Vision 8 doesn't have a frame per second lock. It's up to the runner to // determine what that cap should be. Here we'll use Unity's Application.targetFrameRate // to lock it at 60 FPS. Application.targetFrameRate = 60; // By changing Unity's Cursor.visible property to false we'll be able to hide the mouse // while the game is running. Cursor.visible = false; // By setting the Texture2D filter mode to Point, we ensure that it will look crisp at any size. // Since the Texture will be scaled based on the resolution, we want it always to look pixel perfect. fileSystem = new FileSystemService(); displayTarget = new DisplayTarget(rawImage, this); inputFactory = new InputFactory((DisplayTarget)displayTarget); textureFactory = new TextureFactory(true); // colorFactory = new ColorFactory(); audioClipFactory = new AudioClipFactory(); runner = new Runner(textureFactory); }
public MouseInput(DisplayTarget displayTarget) { this.displayTarget = displayTarget; }
public override void OnInspectorGUI() { // psuedo custom inspector SerializedProperty prop = serializedObject.GetIterator(); Holoplay hp = (Holoplay)target; // account for the first prop being the script bool firstProp = true; GUI.enabled = false; if (prop.NextVisible(true)) { do { // sections if (!advanced.DoSection(prop)) { continue; } if (!quilt.DoSection(prop)) { continue; } if (!gizmo.DoSection(prop)) { continue; } if (!events.DoSection(prop)) { continue; } if (!optimization.DoSection(prop)) { continue; } // skip custom quilt settings if preset not set to custom if (prop.name == "customQuiltSettings" && hp.quiltPreset != Quilt.Preset.Custom) { var qs = Quilt.GetPreset(hp.quiltPreset); EditorGUILayout.LabelField("Quilt Size: ", qs.quiltWidth + " x " + qs.quiltHeight); EditorGUILayout.LabelField("View Size: ", qs.viewWidth + " x " + qs.viewHeight); EditorGUILayout.LabelField("Tiling: ", qs.viewColumns + " x " + qs.viewRows); EditorGUILayout.LabelField("Views Total: ", "" + qs.numViews); continue; } // don't let quiltRT be editable if (prop.name == "quiltRT") { GUI.enabled = false; EditorGUILayout.PropertyField(prop, true); GUI.enabled = true; continue; } // target display if (prop.name == "targetDisplay") { DisplayTarget dt = (DisplayTarget)hp.targetDisplay; EditorGUI.BeginChangeCheck(); dt = (DisplayTarget)EditorGUILayout.EnumPopup("Target Display", dt); if (EditorGUI.EndChangeCheck()) { Undo.RecordObject(hp, "Change Target Display"); hp.targetDisplay = (int)dt; Preview.HandlePreview(false); } continue; } // if all's normal, just draw the property like normal EditorGUILayout.PropertyField(prop, true); // after script name, re-enable GUI if (firstProp) { // version EditorGUILayout.LabelField("Version", Holoplay.version.ToString() + Holoplay.versionLabel, EditorStyles.miniLabel); // re-enable gui and continue GUI.enabled = true; firstProp = false; } }while (prop.NextVisible(false)); } // because it's the last section and doesn't get closed out automatically, force this section to end optimization.ForceEnd(); serializedObject.ApplyModifiedProperties(); // toggle preview button if (GUILayout.Button(Preview.togglePreviewShortcut)) { Preview.HandlePreview(); } // reload calibration button if (GUILayout.Button("Reload Calibration")) { hp.ReloadCalibration(); int calibrationCount = Plugin.CalibrationCount(); string logStr = calibrationCount == 0 ? "[HoloPlay] No calibration found" : string.Format("[HoloPlay] Calibration reloaded! Found {0} calibrations", calibrationCount); Debug.Log(logStr); } // version // var versionStyle = new GUIStyle(EditorStyles.miniLabel); // EditorGUILayout.LabelField("Version", Holoplay.Version.AsString, versionStyle); }
public virtual void ConfigureDisplayTarget() { // Create the default display target displayTarget = new DisplayTarget(graphics, 512, 480); }
public InputFactory(DisplayTarget displayTarget) { this.displayTarget = displayTarget; }