using System; using System.Collections.Generic; using Quik.CommandMachine; using Quik.Controls; using Quik.Media; using Quik.PAL; namespace Quik { /// /// Main class for Quik applications. /// public class QuikApplication { /// /// The application platform driver. /// public IQuikPlatform Platform { get; } /// /// Title of the application. /// public string Title { get => Platform.Title; set => Platform.Title = value; } /// /// Application icon. /// public QImage Icon { get => Platform.Icon; set => Platform.Icon = value; } public View MainView { get; private set; } = null; /// /// List of media loaders, drivers that load media such as images and fonts. /// public List MediaLoaders { get; } = new List(); public QuikApplication(IQuikPlatform platform) { Platform = platform; } public void Run(View mainView) { IQuikPort port = Platform.CreatePort(); CommandQueue cmd = new CommandQueue(); MainView = mainView; port.EventRaised += (sender, ea) => mainView.NotifyEvent(sender, ea); while (port.IsValid) { Platform.ProcessEvents(false); if (port.IsValid) { MainView.Paint(cmd); port.Paint(cmd); } } } } }