public ImGuiRenderer(Game game, Platform platform, IPlatformFunctions platformFunctions)
        {
            this.previousMouseDown = false;
            this.platform          = platform;
            this.platformFunctions = platformFunctions;

            var context = ImGui.CreateContext();

            ImGui.SetCurrentContext(context);

            _game           = game ?? throw new ArgumentNullException(nameof(game));
            _graphicsDevice = game.GraphicsDevice;

            _loadedTextures = new Dictionary <IntPtr, Texture2D>();

            _rasterizerState = new RasterizerState()
            {
                CullMode             = CullMode.None,
                DepthBias            = 0,
                FillMode             = FillMode.Solid,
                MultiSampleAntiAlias = false,
                ScissorTestEnable    = true,
                SlopeScaleDepthBias  = 0
            };

            SetupInput();
        }
Esempio n. 2
0
        /// <summary>
        /// Creates  <see cref="GUIEngine"/>.
        /// </summary>
        /// <param name="platform">The <see cref="Platform"/>.</param>
        /// <param name="platformFunctions">A <see cref="IPlatformFunctions"/> implementation.</param>
        /// <param name="frame">A <see cref="IFrame"/> implementaiton.</param>
        /// <param name="app">The <see cref="IApp"/> implementation.</param>
        public GUIEngine(Platform platform, IPlatformFunctions platformFunctions, IFrame frame, IApp app)
        {
            Window = new GUIWindow(platform, platformFunctions, frame, app, this);

            gameComponentsBefore = new List <IJCIWGameComponent>();
            gameComponentsAfter  = new List <IJCIWGameComponent>();
        }
Esempio n. 3
0
        /// <summary>
        /// Start app.
        /// </summary>
        /// <param name="frame">The graphical <see cref="Frame"/>.</param>
        /// <param name="networking">The <see cref="IAppNetworking"/> implementation.</param>
        /// <param name="platformFunctions">The <see cref="IPlatformFunctions"/> implementation.</param>
        /// <param name="platform">The <see cref="Platform"/> type.</param>
        /// <param name="groups">The user's groups.</param>
        public void Initialize(Frame frame, IAppNetworking networking, IPlatformFunctions platformFunctions, Platform platform, string[] groups)
        {
            this.Groups                      = groups;
            this.PlatformFunctions           = platformFunctions;
            this.Frame                       = frame;
            this.Platform                    = platform;
            this.packetManager               = networking.PacketManager();
            this.Networking                  = new AppNetworking(networking);
            this.registeredPacketDefinitions = new List <PacketDefinition>();

            Run();
        }
Esempio n. 4
0
        /// <summary>
        /// Create <see cref="GUIWindow"/>.
        /// </summary>
        /// <param name="platform">The <see cref="Platform"/>.</param>
        /// <param name="platformFunctions">A <see cref="IPlatformFunctions"/> implementation.</param>
        /// <param name="frame">A <see cref="IFrame"/> implementaiton.</param>
        /// <param name="app">The <see cref="IApp"/> implementation.</param>
        /// <param name="guiEngine">The <see cref="GUIEngine"/>.</param>
        public GUIWindow(Platform platform, IPlatformFunctions platformFunctions, IFrame frame, IApp app, GUIEngine guiEngine)
        {
            Runtime.PLATFORM = platform;

            this.imageLoadQueue      = new List <ImageSource>();
            this.frame               = frame;
            this.app                 = app;
            this.platform            = platform;
            this.androidKeyboardOpen = false;
            this.platformFunctions   = platformFunctions;
            this.fonts               = new Fonts();
            this.guiEngine           = guiEngine;
            this.backgroundColor     = new Color(36, 36, 36);

            TargetElapsedTime = TimeSpan.FromSeconds(1d / 30d); // 30 FPS cap limit

            graphics = new GraphicsDeviceManager(this)
            {
                SupportedOrientations          = DisplayOrientation.Portrait,
                PreferredDepthStencilFormat    = DepthFormat.Depth24Stencil8,
                GraphicsProfile                = GraphicsProfile.HiDef,
                PreferMultiSampling            = true,
                SynchronizeWithVerticalRetrace = false,
            };

            this.IsMouseVisible = true;


            Content.RootDirectory = "Content";

            if (platform == Platform.Android)
            {
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

                graphics.IsFullScreen = true;

                graphics.ApplyChanges();
            }
            else
            {
                if (platform == Platform.Desktop)
                {
                    graphics.PreferredBackBufferWidth  = 800;
                    graphics.PreferredBackBufferHeight = 600;
                }
            }

            this.Window.AllowUserResizing  = true;
            this.Window.ClientSizeChanged += new EventHandler <EventArgs>(Window_ClientSizeChanged);
        }
Esempio n. 5
0
        /// <summary>
        /// Create <see cref="MainApp"/>.
        /// </summary>
        /// <param name="networking">A <see cref="IAppNetworking"/> implementation.</param>
        /// <param name="platformFunctions">A <see cref="IPlatformFunctions"/> implementation.</param>
        /// <param name="platform">The <see cref="Platform"/>.</param>
        public MainApp(IAppNetworking networking, IPlatformFunctions platformFunctions, Platform platform) :
            base(networking, platformFunctions, platform)
        {
            this.drawLogin               = true;
            this.drawAppSelectionView    = false;
            this.waitingForAuthorization = false;
            this.appSelectionView        = new AppSelectionView(this);
            this.loginView               = new LoginView(this);
            this.runningConnectCheck     = false;
            this.IgnoreDisconnect        = false;

            this.downScaleNetworkDisconnectedWindow = 0;

            this.Networking.GroupList         += Networking_GroupList;
            this.Networking.NetworkDisconnect += Networking_NetworkDisconnect;
            this.Networking.UnAuthorized      += Networking_UnAuthorized;
        }
Esempio n. 6
0
        public GUIWindow(Platform platform, IPlatformFunctions platformFunctions)
        {
            this.platform            = platform;
            this.androidKeyboardOpen = false;
            this.platformFunctions   = platformFunctions;

            TargetElapsedTime = TimeSpan.FromSeconds(1d / 30d); // 30 FPS cap limit

            graphics = new GraphicsDeviceManager(this)
            {
                SupportedOrientations          = DisplayOrientation.Portrait,
                PreferredDepthStencilFormat    = DepthFormat.Depth24Stencil8,
                GraphicsProfile                = GraphicsProfile.HiDef,
                PreferMultiSampling            = true,
                SynchronizeWithVerticalRetrace = false,
            };

            this.IsMouseVisible = true;

            Content.RootDirectory = "Content";

            if (platform == Platform.Android)
            {
                graphics.PreferredBackBufferHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height;
                graphics.PreferredBackBufferWidth  = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width;

                graphics.IsFullScreen = true;

                graphics.ApplyChanges();
            }
            else
            {
                if (platform == Platform.Desktop)
                {
                    graphics.PreferredBackBufferWidth  = 800;
                    graphics.PreferredBackBufferHeight = 600;
                }
            }

            this.Window.AllowUserResizing  = true;
            this.Window.ClientSizeChanged += new EventHandler <EventArgs>(Window_ClientSizeChanged);
        }
Esempio n. 7
0
File: Main.cs Progetto: j0nat/JCIW
        /// <summary>
        /// Creates implementation of <see cref="IApp"/>.
        /// </summary>
        /// <param name="networking">A <see cref="IAppNetworking"/> implementation.</param>
        /// <param name="platformFunctions">A <see cref="IPlatformFunctions"/> implementation.</param>
        /// <param name="platform">The <see cref="Platform"/>.</param>
        public Main(IAppNetworking networking, IPlatformFunctions platformFunctions, Platform platform)
        {
            this.CurrentlyRunningAppName = "";
            this.currentApp        = null;
            this.UserGroups        = new List <string>();
            this.Networking        = networking;
            this.PlatformFunctions = platformFunctions;
            this.Platform          = platform;
            this.apps  = new Dictionary <long, ModuleInstance>();
            this.Frame = new Frame(platform, platformFunctions, this);

            if (platform == Platform.Desktop)
            {
                Local.Folder = AppDomain.CurrentDomain.BaseDirectory;
            }
            else
            {
                if (platform == Platform.Android)
                {
                    Local.Folder = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
                }
            }
        }
Esempio n. 8
0
File: Frame.cs Progetto: j0nat/JCIW
 /// <summary>
 /// Create <see cref="Frame"/>.
 /// </summary>
 /// <param name="platform">The <see cref="Platform"/> type.</param>
 /// <param name="platformFunctions">The <see cref="IPlatformFunctions"/> implementation.</param>
 /// <param name="app">The <see cref="IApp"/> implementation.</param>
 public Frame(Platform platform, IPlatformFunctions platformFunctions, IApp app)
 {
     this.graphics    = new GUIEngine(platform, platformFunctions, this, app);
     this.actionQueue = new List <Action>();
     this.Fonts       = graphics.GetFonts();
 }