internal void RemoveAssetDescription(AssetDescription description) { LogEmitter.Apply(LogLevel.Information, "[Remove Asset Description] [Type = {0}] [Name = {1}] from [{2}]", description.Type, description.Name, Name); description.Package = null; mPackageComponent.RemoveAssetDescription(description); }
public Package(string name, string path) : base(name) { AddComponent(mPackageComponent = new PackageComponent()); Path = path; LogEmitter.Apply(LogLevel.Information, "[Initialize PackageProvider Finish] from [{0}]", Name); }
public EngineWindow(string name, string icon, Size size) { Name = name; Icon = icon; Size = size; mWndProc = WindowProc; LogEmitter.Apply(LogLevel.Information, "[Start Create Window] [Name = {0}] from [EngineWindow]", Name); //get instance var hInstance = APILibrary.Win32.Internal.GetModuleHandle(null); //create app info(WNDCLASS)s, default setting var appInfo = new APILibrary.Win32.AppInfo() { style = (uint)APILibrary.Win32.AppInfoStyle.CS_DBLCLKS, lpfnWndProc = mWndProc, cbClsExtra = 0, cbWndExtra = 0, hInstance = hInstance, hIcon = APILibrary.Win32.Internal.LoadImage(IntPtr.Zero, Icon, 1, 0, 0, 0x00000010), hbrBackground = APILibrary.Win32.Internal.GetStockObject(0), hCursor = APILibrary.Win32.Internal.LoadCursor(IntPtr.Zero, (uint)APILibrary.Win32.CursorType.IDC_ARROW), lpszMenuName = null, lpszClassName = Name }; //register app info(WNDCLASS) APILibrary.Win32.Internal.RegisterAppinfo(ref appInfo); APILibrary.Win32.Rect rect = new APILibrary.Win32.Rect() { top = 0, left = 0, right = Size.Width, bottom = Size.Height }; //get real rect APILibrary.Win32.Internal.AdjustWindowRect(ref rect, (uint)APILibrary.Win32.WindowStyles.WS_OVERLAPPEDWINDOW, false); //create window mHandle = APILibrary.Win32.Internal.CreateWindowEx(0, Name, Name, (uint)APILibrary.Win32.WindowStyles.WS_OVERLAPPEDWINDOW, 0x80000000, 0x80000000, rect.right - rect.left, rect.bottom - rect.top, IntPtr.Zero, IntPtr.Zero, hInstance, IntPtr.Zero); LogEmitter.Apply(LogLevel.Information, "[Finish Create Window] [Width = {0}] [Height = {1}] from [EngineWindow]", Size.Width, Size.Height); //get window rect property APILibrary.Win32.Internal.GetWindowRect(mHandle, ref rect); //set event forwarder mEventForwardInputEmitter = new EventForwardInputEmitter(this); //set position and size Position = new Point2(rect.left, rect.top); Size = new Size(rect.right - rect.left, rect.bottom - rect.top); IsExisted = true; }
public static void Initialize(GameStartInfo gameStartInfo) { GameName = gameStartInfo.Name; IsExist = true; InitializeRuntime(gameStartInfo); Gui.Initialize(); LogEmitter.Apply(LogLevel.Information, "[Initialize Game Systems Finish] from [GameSystems]"); }
internal void AddAssetDescription(AssetDescription description) { LogEmitter.Apply(LogLevel.Information, "[Add Asset Description] [Type = {0}] [Name = {1}] from [{2}]", description.Type, description.Name, Name); //if the asset has been in the other package //we change the package asset in if (description.Package != null) { LogEmitter.Apply(LogLevel.Warning, "[Add Asset Description and Change the Package] [Type = {0}] [Name = {1}] from [{2}]", description.Type, description.Name, Name); description.Package.RemoveAssetDescription(description); } description.Package = this; mPackageComponent.AddAssetDescription(description); }
public static void Initialize(GameStartInfo gameStartInfo) { GameName = gameStartInfo.GameName; BehaviorSystems = new List <BehaviorSystem>(); IsExist = true; SystemScene = new GameScene("SystemScene"); InitializeRuntime(gameStartInfo); //add system AddBehaviorSystem(AssetSystem = new AssetSystem()); AddBehaviorSystem(LogicGuiSystem = new LogicGuiSystem()); AddBehaviorSystem(VisualGuiSystem = new VisualGuiSystem(GpuDevice, new Rectangle <int>(0, 0, EngineWindow.Size.Width, EngineWindow.Size.Height))); EngineWindow.AddEventListener(LogicGuiSystem); LogEmitter.Apply(LogLevel.Information, "[Initialize GameSystems Finish] from [GameSystems]"); }
internal static void Initialize() { mRender = new GuiRender(GameSystems.GpuDevice); ///auto size, if true means when window size is changed, the canvas size is also changed. ///false means we do not change the size when window size changed. AutoSize = true; ///resize the canvas size ReSizeCanvas(GameSystems.EngineWindow.Size); GameSystems.EngineWindow.OnSizeChangeEvent += (sender, eventArg) => { if (AutoSize == false) { return; } ReSizeCanvas(eventArg.After); }; ///add input mapped ///axis input mapped InputMapped.Mapped(InputProperty.MouseX, GuiProperty.InputMoveX); InputMapped.Mapped(InputProperty.MouseY, GuiProperty.InputMoveY); InputMapped.Mapped(InputProperty.MouseWheel, GuiProperty.InputWheel); ///button input mapped InputMapped.Mapped(InputProperty.LeftButton, GuiProperty.InputClick); ///mapped the keycode to input key foreach (var keycode in InputProperty.KeyCodeMapped) { InputMapped.Mapped(keycode.Value, GuiProperty.InputKey); } LogEmitter.Apply(LogLevel.Information, "[Initialize Gui System Finish] from [Gui]"); }
public static void RemoveBehaviorSystem(BehaviorSystem behaviorSystem) { BehaviorSystems.Remove(behaviorSystem); LogEmitter.Apply(LogLevel.Information, "[Remove Behavior System] [Name = {0}] from [GameSystems]", behaviorSystem.Name); }