public App() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); form = new Form1(); graphics = new Graphics.GraphicsModule(form.Handle, form.ClientSize.Width, form.ClientSize.Height); ui = new UIManager(); form.Load += Form_Load; form.FormClosed += Form_FormClosed; }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { startupPath = Environment.CurrentDirectory; slnDir = startupPath + "\\..\\..\\.."; graphics.PreferredBackBufferWidth = 1280; graphics.PreferredBackBufferHeight = 720; screenInfo.virtualScreenDimensions.X = 1920; screenInfo.virtualScreenDimensions.Y = 1080; // Camera and Independent Resolution Renderer Setup irr = new ResolutionRenderer(this, (int)screenInfo.virtualScreenDimensions.X, (int)screenInfo.virtualScreenDimensions.Y, graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); // Move the window. TODO center the window in the users screen System.Windows.Forms.Form form = (System.Windows.Forms.Form)System.Windows.Forms.Control.FromHandle(this.Window.Handle); form.Location = new System.Drawing.Point(0, 0); graphics.ApplyChanges(); screenInfo.curScreenCenter = new Vector2(); //spaceLevel = new Levels.SpaceLevel(Content); //isoLevel = new Levels.IsoLevel(Content); spaceManager = new SpaceManager(); isoManager = new IsoManager(); uiManager = new UI.UIManager(GraphicsDevice, spaceManager, isoManager); // Get current resolution of the viewport screenInfo.screenDimensions.X = GraphicsDevice.Viewport.Width; screenInfo.screenDimensions.Y = GraphicsDevice.Viewport.Height; Globals.gPrimitives.Init(graphics.GraphicsDevice); base.Initialize(); }
protected override void Initialize() { GameConfiguration.ScreenBounds = this.Window.ClientBounds; GameConfiguration.ScreenResolution = new Vector2(this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height); // TODO: Add your initialization logic here base.Initialize(); //graphics.IsFullScreen = true; device = this.GraphicsDevice; mouseManager = new MouseManager(); map = Tools.MaxRes.loadWrl(SystemConfiguration.AppPath + "\\data\\maps\\Snow_5.wrl"); map.mapDraw = new GraphicMap(map); Animator.Instance.AddAObject(map, map.AddFrame, 150.0); GraphicMap.mapShader.Parameters["ViewportSize"].SetValue(GameConfiguration.ScreenResolution); map.clearLoadData(); AIREXPLD = maxres.loadMultiImage("TANK"); camera = new Camera(map); userInterface = new UI.UIManager(Game1.device); CashedTexture2D t2d = ImageCache.Instance.GetImage("ENDGAME6",TextureType.Paletted); UI.UIMenu menu = new UI.UIMenu(new Rectangle(100, 100, 55, 32)); userInterface.maincontrol.AddChild(menu); UI.UIFixedStateButton button = new UI.UIFixedStateButton(new Rectangle(0, 0, 55, 16), menu); button.SetIdleImage(new ImagePart(ImageCache.Instance.GetImage("AMMO_OF", TextureType.Simple), null)); button.SetPressedImage(new ImagePart(ImageCache.Instance.GetImage("AMMO_ON", TextureType.Simple), null)); UI.UIButton button1 = new UI.UIButton(new Rectangle(0, 16, 55, 16), menu); button1.SetIdleImage(new ImagePart(ImageCache.Instance.GetImage("AMMO_OF", TextureType.Simple), null)); button1.SetPressedImage(new ImagePart(ImageCache.Instance.GetImage("AMMO_ON", TextureType.Simple), null)); UI.UILabel label = new UI.UILabel(new Rectangle(52, 33, 100, 100)); label.Font = UI.UIFontHelper.CourierNew12RegularBold; label.Text = "test text"; label.Color = Color.Red; userInterface.maincontrol.AddChild(label); }
private View selectedRow; // The row in the listview that is selected #endregion #region Activity events protected override void OnStart() { base.OnStart (); _mainActivity = this; if (_broadcastReceiver == null) { NetworkStatusMonitor.ActivityController = 0; _broadcastReceiver = new NetworkStatusBroadcastReceiver (); _broadcastReceiver.ConnectionStatusChanged += _networkmonitor.OnNetworkStatusChanged; // Register the broadcast receiver Application.Context.RegisterReceiver (_broadcastReceiver, new IntentFilter (ConnectivityManager.ConnectivityAction)); } // Create the instance of the UIManager, the big boss that rules the empire // First check if it has some value or not // If it has then we don't change it -> This the case when another activity just overlappes our one if (this._mainUIManager != null) return; // But if not...!!! this._mainUIManager = LastCustomNonConfigurationInstance as UIManager; // this._mainUIManager = LastNonConfigurationInstance as UIManager; // If we get a value from last configurations, we do it! // This means that the screen has been rotated etc if (this._mainUIManager != null) { _mainUIManager.Restore (this); // Get this damned keystore away Android.Views.InputMethods.InputMethodManager imm = (Android.Views.InputMethods.InputMethodManager)GetSystemService(Context.InputMethodService); imm.HideSoftInputFromWindow(_edSearch.WindowToken, 0); } else { // And set the default tab to Kunden _mainUIManager = new UI.UIManager (this ); _mainUIManager.KundenTabClick (); fragment.SetStateFragement((StateFragmentPersonGeneral)_mainUIManager._currentClassState._fragmentState); // Set a notification if the user is online or offline NotificationManager notificationManager = (NotificationManager) _mainActivity.GetSystemService ( Android.Content.Context.NotificationService); if (_user.NetworkStatus == DataAccessLayer.NetworkState.Disconnected) { Notification.Builder builder = new Notification.Builder(_mainActivity) .SetSmallIcon(UI.Resource.Drawable.ic_action_offline) .SetAutoCancel(false) .SetLights(54, 3000, 5) .SetContentText(Resources.GetString(Resource.String.UserOffline)) .SetContentTitle(Resources.GetString(Resource.String.AppName) + " - " + "Offline") .SetTicker(Resources.GetString(Resource.String.UserOffline)); Notification notification = builder.Build(); notificationManager.Notify(2, notification); } else { Notification.Builder builder = new Notification.Builder(_mainActivity) .SetSmallIcon(UI.Resource.Drawable.ic_action_online) .SetAutoCancel(false) .SetLights(54, 3000, 5) .SetContentText(Resources.GetString(Resource.String.UserOnline)) .SetContentTitle(Resources.GetString(Resource.String.AppName) + " - " + "Online") .SetTicker(Resources.GetString(Resource.String.UserOnline)); Notification notification = builder.Build(); notificationManager.Notify(2, notification); } } // And very important // set a reference to this in the UI.Utility // so that is available for the BusinessLayer and the DAL when the connection to the server has been timed out Utilities.InitializeMainActivity(this); Console.WriteLine ("Find the damned skipped frames"); }
public void ResetUser( BusinessLayer.User user) { _user = user; if (_mainUIManager == null) _mainUIManager = new UIManager(this); }