void Awake() { if(Instance != null && Instance != this) { Destroy(gameObject); } Instance = this; gameObject.AddComponent<AudioSource>(); }
public FormC64Screen(C64 c64) { InitializeComponent(); _osdManager = new OsdManager(); _osdManager.AddItem("Power On"); C64 = c64; _crtImage = Image.FromFile("Images\\crt-overlay-03.png"); _bC64ScreenBuffer = new Bitmap(VicIi.FULL_WIDTH, VicIi.FULL_HEIGHT_PAL, PixelFormat.Format24bppRgb); _gC64ScreenBuffer = Graphics.FromImage(_bC64ScreenBuffer); _bC64ScreenOutputBuffer = new Bitmap(pScreen.Width, pScreen.Height, PixelFormat.Format24bppRgb); _gC64ScreenOutputBuffer = Graphics.FromImage(_bC64ScreenOutputBuffer); _uiRefreshTimer = new Timer((e) => { try { Invoke(new Action(() => { lblClockSpeed.Text = $"{c64.CpuClockSpeedHz / 1000000:F4} MHz"; lblClockSpeedReal.Text = $"{c64.CpuClockSpeedRealHz / 1000000:F4} MHz"; lblClockSpeedRealPercent.Text = $"{c64.CpuClockSpeedPercent:F2} %"; lblCpuClockSpeedMultiplier.Text = $"x{c64.CpuClockSpeedMultiplier:F2}"; lblCycles.Text = $"{c64.Cpu.TotalCycles:N0} cycles"; lblInstructions.Text = $"{c64.Cpu.TotalInstructions:N0} instructions"; lblIllegalInstructions.Text = $"{c64.Cpu.TotalIllegalInstructions:N0} illegal instructions"; lblKeyboardDisabled.Visible = !c64.KeyboardActivated; lblFps.Text = $"{((int)_fpsActual):D2} fps"; lblVicCycles.Text = $"{c64.Vic.TotalCycles:N0} cycles"; lblVicCurrentLine.Text = $"Line: {c64.Vic.CurrentLine:D3}"; lblVicCurrentLineCycle.Text = $"Pos: {c64.Vic.CurrentLineCycle:D2}"; lblVicGraphicsMode.Text = "Mode: " + C64.Vic.GetCurrentGraphicsMode().ToString(); lblVicScreenOn.Text = C64.Vic.ScreenControlRegisterScreenOffOn ? "Screen: On" : "Screen: Off"; })); } catch { } }, null, TimeSpan.FromMilliseconds(1000), TimeSpan.FromMilliseconds(50)); c64.PowerOn(); _isInitialized = true; }