public PlayerEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, bool isRedColor, bool locallyOwned) { this.m_NetworkAPI = networkAPI; this.m_2DRenderUtilities = twodRenderUtilities; this.m_CubeRenderer = cubeRenderer; this.m_PlayerTexture = assetManagerProvider.GetAssetManager().Get<TextureAsset>("texture." + (isRedColor ? "Red" : "Blue")); this.LocallyOwned = locallyOwned; this.Width = 0.5f; this.Depth = 0.5f; if (!this.LocallyOwned) { networkAPI.ListenForMessage( "player update", a => { var values = a.Split('|').Select(x => float.Parse(x)).ToArray(); this.X = values[0]; this.Y = values[1]; this.Z = values[2]; }); } }
public GCMetricsProfilerVisualiser( IAssetManager assetManager, I2DRenderUtilities renderUtilities) { _renderUtilities = renderUtilities; _defaultFont = assetManager.Get <FontAsset>("font.Default"); #if PLATFORM_WINDOWS || PLATFORM_MACOS || PLATFORM_LINUX // TryGetInstanceName can take up to 1.5 seconds to complete! Queue the work of resolving // these metrics on a background thread so we don't block game startup. ThreadPool.QueueUserWorkItem(o => { string instanceName; if (TryGetInstanceName(Process.GetCurrentProcess(), out instanceName)) { _gen0PerformanceCounter = new PerformanceCounter(".NET CLR Memory", "# Gen 0 Collections", instanceName, true); _gen1PerformanceCounter = new PerformanceCounter(".NET CLR Memory", "# Gen 1 Collections", instanceName, true); _gen2PerformanceCounter = new PerformanceCounter(".NET CLR Memory", "# Gen 2 Collections", instanceName, true); } }); #endif }
public DefaultCaptureService( I2DRenderUtilities twoDRenderUtilities, IAssetManagerProvider assetManagerProvider) { this.m_2DRenderUtilities = twoDRenderUtilities; this.m_DefaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); }
public DetectorEntity(WebcamEntity webcamEntity, IAssetManager assetManager, I2DRenderUtilities renderUtilities) { _webcamEntity = webcamEntity; _assetManager = assetManager; _renderUtilities = renderUtilities; _defaultFont = _assetManager.Get <FontAsset>("font.Default"); _colorsToDetect = new List <ColorToDetect> { new ColorToDetect { Color = new Color(1f, 0f, 0f), Name = "Red" }, new ColorToDetect { Color = new Color(0f, 1f, 0f), Name = "Green" }, new ColorToDetect { Color = new Color(0f, 0f, 1f), Name = "Blue" }, new ColorToDetect { Color = new Color(1f, 1f, 0f), Name = "Yellow" } }; _currentIndex = 0; _currentColor = _colorsToDetect[_currentIndex]; GlobalSensitivity = 1 / 10000000f * 25f; _thread = new Thread(ProcessorThread); _thread.IsBackground = true; _thread.Start(); }
public NuiToolbarContainerSkinRenderer( I2DRenderUtilities renderUtilities, NuiRenderer nuiRenderer) { _renderUtilities = renderUtilities; _nuiRenderer = nuiRenderer; }
public CrateEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, int id, int x, int y, Dictionary <string, string> attributes) : base(twodRenderUtilities, cubeRenderer, assetManagerProvider, networkAPI, Convert.ToInt32(attributes["NetworkID"])) { this.X = x / 16f; this.Z = y / 16f; this.JoinShouldOwn = Convert.ToBoolean(attributes["JoinOwns"]); this.CanPush = true; this.Width = 0.8f; this.Depth = 0.8f; this.m_BlueCrateTexture = assetManagerProvider.GetAssetManager().Get <TextureAsset>("texture.BlueCrate"); this.m_RedCrateTexture = assetManagerProvider.GetAssetManager().Get <TextureAsset>("texture.RedCrate"); this.m_CrateModel = assetManagerProvider.GetAssetManager().Get <ModelAsset>("model.Crate"); }
public GoalEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, int id, int x, int y, Dictionary<string, string> attributes) : base(twodRenderUtilities, cubeRenderer, assetManagerProvider, networkAPI, Convert.ToInt32(attributes["NetworkID"])) { this.X = x / 16f + 0.4f; this.Z = y / 16f + 0.4f; this.CanPickup = false; this.JoinShouldOwn = Convert.ToBoolean(attributes["JoinOwns"]); this.Width = 0.2f; this.Depth = 0.2f; this.m_GoalTexture = assetManagerProvider.GetAssetManager().Get<TextureAsset>("texture.Goal"); this.m_GoalModel = assetManagerProvider.GetAssetManager().Get<ModelAsset>("model.Goal"); }
public PlayerEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, bool isRedColor, bool locallyOwned) { this.m_NetworkAPI = networkAPI; this.m_2DRenderUtilities = twodRenderUtilities; this.m_CubeRenderer = cubeRenderer; this.m_PlayerTexture = assetManagerProvider.GetAssetManager().Get <TextureAsset>("texture." + (isRedColor ? "Red" : "Blue")); this.LocallyOwned = locallyOwned; this.Width = 0.5f; this.Depth = 0.5f; if (!this.LocallyOwned) { networkAPI.ListenForMessage( "player update", a => { var values = a.Split('|').Select(x => float.Parse(x)).ToArray(); this.X = values[0]; this.Y = values[1]; this.Z = values[2]; }); } }
public MyGameWorld( I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, IEntityFactory entityFactory) { this.Entities = new List <IEntity>(); _renderUtilities = renderUtilities; _assetManager = assetManagerProvider.GetAssetManager(); _defaultFont = this._assetManager.Get <FontAsset>("font.Default"); // You can also save the entity factory in a field and use it, e.g. in the Update // loop or anywhere else in your game. var entityA = entityFactory.CreateExampleEntity("EntityA"); entityA.X = 100; entityA.Y = 50; var entityB = entityFactory.CreateExampleEntity("EntityB"); entityB.X = 120; entityB.Y = 100; // Don't forget to add your entities to the world! this.Entities.Add(entityA); this.Entities.Add(entityB); // This pulls in the texture asset via the asset manager. Note that // the folder seperator from "texture/Player" has been translated // into a single dot. _playerTexture = _assetManager.Get <TextureAsset>("texture.Player"); }
public GoalEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, int id, int x, int y, Dictionary <string, string> attributes) : base(twodRenderUtilities, cubeRenderer, assetManagerProvider, networkAPI, Convert.ToInt32(attributes["NetworkID"])) { this.X = x / 16f + 0.4f; this.Z = y / 16f + 0.4f; this.CanPickup = false; this.JoinShouldOwn = Convert.ToBoolean(attributes["JoinOwns"]); this.Width = 0.2f; this.Depth = 0.2f; this.m_GoalTexture = assetManagerProvider.GetAssetManager().Get <TextureAsset>("texture.Goal"); this.m_GoalModel = assetManagerProvider.GetAssetManager().Get <ModelAsset>("model.Goal"); }
public CrateEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, int id, int x, int y, Dictionary<string, string> attributes) : base(twodRenderUtilities, cubeRenderer, assetManagerProvider, networkAPI, Convert.ToInt32(attributes["NetworkID"])) { this.X = x / 16f; this.Z = y / 16f; this.JoinShouldOwn = Convert.ToBoolean(attributes["JoinOwns"]); this.CanPush = true; this.Width = 0.8f; this.Depth = 0.8f; this.m_BlueCrateTexture = assetManagerProvider.GetAssetManager().Get<TextureAsset>("texture.BlueCrate"); this.m_RedCrateTexture = assetManagerProvider.GetAssetManager().Get<TextureAsset>("texture.RedCrate"); this.m_CrateModel = assetManagerProvider.GetAssetManager().Get<ModelAsset>("model.Crate"); }
public MyGameWorld( I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, IEntityFactory entityFactory) { this.Entities = new List<IEntity>(); _renderUtilities = renderUtilities; _assetManager = assetManagerProvider.GetAssetManager(); _defaultFont = this._assetManager.Get<FontAsset>("font.Default"); // You can also save the entity factory in a field and use it, e.g. in the Update // loop or anywhere else in your game. var entityA = entityFactory.CreateExampleEntity("EntityA"); entityA.X = 100; entityA.Y = 50; var entityB = entityFactory.CreateExampleEntity("EntityB"); entityB.X = 120; entityB.Y = 100; // Don't forget to add your entities to the world! this.Entities.Add(entityA); this.Entities.Add(entityB); // This pulls in the texture asset via the asset manager. Note that // the folder seperator from "texture/Player" has been translated // into a single dot. _playerTexture = _assetManager.Get<TextureAsset>("texture.Player"); }
public Solid(I2DRenderUtilities renderUtilities, float x, float y, float width, float height) { this.m_RenderUtilities = renderUtilities; this.Transform.LocalPosition = new Vector3(x, y, 0); this.Width = width; this.Height = height; }
public TitleWorld( I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider, IBackgroundCubeEntityFactory backgroundCubeEntityFactory, ISkin skin) : base(twodRenderUtilities, assetManagerProvider, backgroundCubeEntityFactory, skin) { this.Title = this.AssetManager.Get<LanguageAsset>("language.TYCHAIA"); this.AddMenuItem( this.AssetManager.Get<LanguageAsset>("language.SINGLEPLAYER"), () => { this.TargetWorld = this.GameContext.CreateWorld<IWorldFactory>(x => x.CreateConnectWorld(true, GetLANIPAddress(), 9091)); }); this.AddMenuItem( this.AssetManager.Get<LanguageAsset>("language.MULTIPLAYER"), () => { this.TargetWorld = this.GameContext.CreateWorld<IWorldFactory>(x => x.CreateMultiplayerWorld()); }); this.AddMenuItem( this.AssetManager.Get<LanguageAsset>("language.EXIT"), () => { if (this.GameContext != null) this.GameContext.Game.Exit(); }); }
public void RenderDebug(IGameContext gameContext, IRenderContext renderContext, Agent agent, I2DRenderUtilities twoDRenderUtilities) { var wndPos = new Vector2(this.WanderDistance, 0); var wldPos = agent.Project(wndPos); for (var i = 0; i < 10; i++) { var r = MathHelper.ToRadians(36 * i); var r2 = MathHelper.ToRadians(36 * (i + 1)); twoDRenderUtilities.RenderLine( renderContext, wldPos + (new Vector2((float)Math.Sin(r), (float)Math.Cos(r)) * this.WanderRadius), wldPos + (new Vector2((float)Math.Sin(r2), (float)Math.Cos(r2)) * this.WanderRadius), Color.Green); } wndPos = this.m_WanderTarget + new Vector2(this.WanderDistance, 0); wldPos = agent.Project(wndPos); for (var i = 0; i < 10; i++) { var r = MathHelper.ToRadians(36 * i); var r2 = MathHelper.ToRadians(36 * (i + 1)); twoDRenderUtilities.RenderLine( renderContext, wldPos + (new Vector2((float)Math.Sin(r), (float)Math.Cos(r)) * 3), wldPos + (new Vector2((float)Math.Sin(r2), (float)Math.Cos(r2)) * 3), Color.Red); } }
public NuiConsoleContainerSkinRenderer( I2DRenderUtilities renderUtilities, IAssetManager assetManager) { _renderUtilities = renderUtilities; _assetManager = assetManager; _fontAsset = assetManager.Get <FontAsset>("font.Console"); }
public StatusBar( I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider) { this.m_2DRenderUtilities = twodRenderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(); this.m_DefaultFont = this.m_AssetManager.Get<FontAsset>("font.Default"); }
public Solid(I2DRenderUtilities renderUtilities, float x, float y, float width, float height) { this.m_RenderUtilities = renderUtilities; this.X = x; this.Y = y; this.Width = width; this.Height = height; }
public MenuWorld(ISkin skin, IWorldFactory worldFactory, IAssetManagerProvider assetManagerProvider, I2DRenderUtilities twodRenderUtilities) { this.m_2DRenderUtilities = twodRenderUtilities; this.m_LogoTexture = assetManagerProvider.GetAssetManager().Get<TextureAsset>("texture.Logo"); this.m_WorldFactory = worldFactory; this.Entities = new List<IEntity>(); var startServer = new Button(); startServer.Text = "Start Server"; startServer.Click += (sender, e) => { this.m_LastGameContext.SwitchWorld<IWorldFactory>( x => x.CreateLobbyWorld(false, IPAddress.Any)); }; var ipAddressTextBox = new TextBox(); var joinGame = new Button(); joinGame.Text = "Join Game"; joinGame.Click += (sender, e) => { this.m_LastGameContext.SwitchWorld<IWorldFactory>( x => x.CreateLobbyWorld(true, IPAddress.Parse(ipAddressTextBox.Text))); }; var exitGame = new Button(); exitGame.Text = "Exit Game"; exitGame.Click += (sender, e) => { this.m_LastGameContext.Game.Exit(); }; var vertical = new VerticalContainer(); vertical.AddChild(new EmptyContainer(), "*"); vertical.AddChild(new Label { Text = "Perspective" }, "25"); vertical.AddChild(new EmptyContainer(), "*"); vertical.AddChild(startServer, "25"); vertical.AddChild(new EmptyContainer(), "*"); vertical.AddChild(new Label { Text = "Server IP address:" }, "20"); vertical.AddChild(ipAddressTextBox, "20"); vertical.AddChild(joinGame, "25"); vertical.AddChild(new EmptyContainer(), "*"); vertical.AddChild(exitGame, "25"); vertical.AddChild(new EmptyContainer(), "*"); var horizontal = new HorizontalContainer(); horizontal.AddChild(new EmptyContainer(), "*"); horizontal.AddChild(vertical, "250"); horizontal.AddChild(new EmptyContainer(), "*"); var canvas = new Canvas(); canvas.SetChild(horizontal); this.Entities.Add(new CanvasEntity(skin, canvas)); }
public NetworkSampler(I2DRenderUtilities renderUtilities, FontAsset defaultFont, string type) { _renderUtilities = renderUtilities; _defaultFont = defaultFont; Type = type; _bytesOverTime = new List <int>(); _countsOverTime = new List <int>(); }
/// <summary> /// Initializes a new instance of the <see cref="MenuItem"/> class. /// </summary> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> /// <param name="renderUtilities"> /// The render utilities. /// </param> public MenuItem(IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities) { this.m_RenderUtilities = renderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); this.Active = false; // Give menu items a higher visibility over other things. this.Order = 10; }
public Wall(I2DRenderUtilities twoDRenderUtilities, Vector2 start, Vector2 end) { this.Start = start; this.End = end; this.DebugRender = false; this.m_2DRenderUtilities = twoDRenderUtilities; this.DebugRenderWallColor = Color.Black; this.DebugRenderWallNormalColor = Color.DarkGray; }
public NuiListItemSkinRenderer( I2DRenderUtilities renderUtilities, NuiRenderer nuiRenderer, IAssetManager assetManager) { _renderUtilities = renderUtilities; _nuiRenderer = nuiRenderer; _fontAsset = assetManager.Get <FontAsset>("font.UISmall"); }
public BasicLabelSkinRenderer( I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, ILayoutPosition layoutPosition) { _renderUtilities = renderUtilities; _layoutPosition = layoutPosition; _fontAsset = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default"); }
public NuiLabelSkinRenderer( I2DRenderUtilities renderUtilities, IAssetManager assetManager, ILayoutPosition layoutPosition) { _renderUtilities = renderUtilities; _layoutPosition = layoutPosition; _fontAsset = assetManager.Get <FontAsset>("font.UISmall"); }
public PhysicsMetricsProfilerVisualiser( IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities, IPhysicsEngine physicsEngine) { _renderUtilities = renderUtilities; _physicsEngine = physicsEngine; _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); }
public Wall(I2DRenderUtilities twoDRenderUtilities, Vector2 start, Vector2 end) { this.Start = start; this.End = end; this.DebugRender = false; this.m_2DRenderUtilities = twoDRenderUtilities; this.DebugRenderWallColor = Color.Black; this.DebugRenderWallNormalColor = Color.DarkGray; }
/// <summary> /// Initializes a new instance of the <see cref="MenuItem"/> class. /// </summary> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> /// <param name="renderUtilities"> /// The render utilities. /// </param> public MenuItem(IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities) { this.m_RenderUtilities = renderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); this.Active = false; // Give menu items a higher visibility over other things. this.Order = 10; }
/// <summary> /// Initializes a new instance of the <see cref="BasicSkin"/> class. /// </summary> /// <param name="skin"> /// The skin. /// </param> /// <param name="renderUtilities"> /// The render utilities. /// </param> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> public BasicSkin( IBasicSkin skin, I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider) { this.m_BasicSkin = skin; this.m_RenderUtilities = renderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); }
public PhysicsMetricsProfilerVisualiser( IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities, IPhysicsEngine physicsEngine) { _renderUtilities = renderUtilities; _physicsEngine = physicsEngine; _defaultFont = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default"); }
public TychaiaSkin( I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider, BasicSkin basicSkin) { this.m_2DRenderUtilities = twodRenderUtilities; this.m_BasicSkin = basicSkin; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); }
/// <summary> /// Initializes a new instance of the <see cref="BasicSkin"/> class. /// </summary> /// <param name="skin"> /// The skin. /// </param> /// <param name="renderUtilities"> /// The render utilities. /// </param> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> public TransparentBasicSkin( IBasicSkin skin, I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider) { this.m_BasicSkin = skin; this.m_RenderUtilities = renderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); }
public GeneratedWorld( I2DRenderUtilities twoDRenderUtilities, IAssetManagerProvider assetManagerProvider) { this.Entities = new List <IEntity>(); this.m_2DRenderUtilities = twoDRenderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(); this.m_DefaultFont = this.m_AssetManager.Get <FontAsset>("font.Default"); }
public NuiHorizontalContainerSkinRenderer( I2DRenderUtilities renderUtilities, IAssetManager assetManager, ISkinLayout skinLayout) { _renderUtilities = renderUtilities; _skinLayout = skinLayout; _assetManager = assetManager; }
public GeneratedWorld( I2DRenderUtilities twoDRenderUtilities, IAssetManagerProvider assetManagerProvider) { this.Entities = new List<IEntity>(); this.m_2DRenderUtilities = twoDRenderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(); this.m_DefaultFont = this.m_AssetManager.Get<FontAsset>("font.Default"); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultConsole"/> class. /// </summary> /// <param name="_2DRenderUtilities"> /// The _2 d render utilities. /// </param> /// <param name="keyboardStringReader"> /// The keyboard string reader. /// </param> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> /// <param name="commands"> /// The commands. /// </param> public DefaultConsole( I2DRenderUtilities _2DRenderUtilities, IKeyboardStringReader keyboardStringReader, IAssetManagerProvider assetManagerProvider, ICommand[] commands) { this.m_2DRenderUtilities = _2DRenderUtilities; this.m_KeyboardStringReader = keyboardStringReader; this.m_AssetManagerProvider = assetManagerProvider; this.m_Commands = commands; }
public DefaultProfilerRenderPass( I2DRenderUtilities renderUtilities, [Optional] IConsole console) { _renderUtilities = renderUtilities; _console = console; Enabled = true; Visualisers = new List <IProfilerVisualiser>(); Position = ProfilerPosition.TopLeft; }
public KernelMetricsProfilerVisualiser( IKernel kernel, IHierarchy hierachy, IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities) { _kernel = kernel; _hierachy = hierachy; _renderUtilities = renderUtilities; _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); }
/// <summary> /// Initializes a new instance of the <see cref="DefaultConsole"/> class. /// </summary> /// <param name="_2DRenderUtilities"> /// The _2 d render utilities. /// </param> /// <param name="keyboardStringReader"> /// The keyboard string reader. /// </param> /// <param name="assetManagerProvider"> /// The asset manager provider. /// </param> /// <param name="commands"> /// The commands. /// </param> public DefaultConsole( I2DRenderUtilities _2DRenderUtilities, IKeyboardStringReader keyboardStringReader, IAssetManagerProvider assetManagerProvider, ICommand[] commands) { this.m_2DRenderUtilities = _2DRenderUtilities; this.m_KeyboardStringReader = keyboardStringReader; this.m_AssetManagerProvider = assetManagerProvider; this.m_Commands = commands; }
public KernelMetricsProfilerVisualiser( IKernel kernel, IHierarchy hierachy, IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities) { _kernel = kernel; _hierachy = hierachy; _renderUtilities = renderUtilities; _defaultFont = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default"); }
public DefaultProfilerRenderPass( I2DRenderUtilities renderUtilities, [Optional] IConsole console) { _renderUtilities = renderUtilities; _console = console; Enabled = true; Visualisers = new List<IProfilerVisualiser>(); Position = ProfilerPosition.TopLeft; }
public NetworkTrafficProfilerVisualiser( IAssetManagerProvider assetManagerProvider, INetworkEngine networkEngine, I2DRenderUtilities renderUtilities) { _defaultFont = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default"); _networkEngine = networkEngine; _renderUtilities = renderUtilities; _sentSampler = new NetworkSampler(_renderUtilities, _defaultFont, "SENT"); _receivedSampler = new NetworkSampler(_renderUtilities, _defaultFont, "RECV"); }
public DefaultLoadingScreen( I2DRenderUtilities renderUtilities, IAssetManager assetManager) { _renderUtilities = renderUtilities; _assetManager = assetManager; #if PLATFORM_ANDROID _defaultFont = assetManager.Get <FontAsset>("font.HiDpi"); #else _defaultFont = assetManager.Get <FontAsset>("font.Default"); #endif }
public NetworkTrafficProfilerVisualiser( IAssetManagerProvider assetManagerProvider, INetworkEngine networkEngine, I2DRenderUtilities renderUtilities) { _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); _networkEngine = networkEngine; _renderUtilities = renderUtilities; _sentSampler = new NetworkSampler(_renderUtilities, _defaultFont, "SENT"); _receivedSampler = new NetworkSampler(_renderUtilities, _defaultFont, "RECV"); }
public Wall(I2DRenderUtilities twoDRenderUtilities, INode node, Vector2 start, Vector2 end) { _finalTransform = new DefaultFinalTransform(this, node); this.Start = start; this.End = end; this.DebugRender = false; this.m_2DRenderUtilities = twoDRenderUtilities; this.DebugRenderWallColor = Color.Black; this.DebugRenderWallNormalColor = Color.DarkGray; Transform = new DefaultTransform(); }
public TychaiaProfilerEntity( TychaiaProfiler profiler, I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider, IPersistentStorage persistentStorage) { this.Profiler = profiler; this.m_2DRenderUtilities = twodRenderUtilities; this.m_DefaultFontAsset = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); this.m_ProfilingInformation = new List<FrameProfileInfo>(); this.m_PersistentStorage = persistentStorage; this.m_TychaiaProfilerEntityUtil = new TychaiaProfilerEntityUtil(); }
public GraphicsMetricsProfilerVisualiser( IAssetManager assetManager, I2DRenderUtilities renderUtilities, IRenderCache renderCache, IRenderAutoCache renderAutoCache, IRenderBatcher renderBatcher) { _renderUtilities = renderUtilities; _renderCache = renderCache; _renderAutoCache = renderAutoCache; _renderBatcher = renderBatcher; _defaultFont = assetManager.Get <FontAsset>("font.Default"); }
public GraphicsMetricsProfilerVisualiser( IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities, IRenderCache renderCache, IRenderAutoCache renderAutoCache, IRenderBatcher renderBatcher) { _renderUtilities = renderUtilities; _renderCache = renderCache; _renderAutoCache = renderAutoCache; _renderBatcher = renderBatcher; _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); }
public NuiCheckBoxSkinRenderer(I2DRenderUtilities renderUtilities, IAssetManager assetManager) { _renderUtilities = renderUtilities; _textures = new Dictionary <string, IAssetReference <TextureAsset> > { { "Unticked", assetManager.Get <TextureAsset>("texture.UICheckboxUnticked") }, { "UntickedDown", assetManager.Get <TextureAsset>("texture.UICheckboxUntickedDown") }, { "UntickedFocused", assetManager.Get <TextureAsset>("texture.UICheckboxUntickedFocused") }, { "UntickedFocusedDown", assetManager.Get <TextureAsset>("texture.UICheckboxUntickedFocusedDown") }, { "Ticked", assetManager.Get <TextureAsset>("texture.UICheckboxTicked") }, { "TickedDown", assetManager.Get <TextureAsset>("texture.UICheckboxTickedDown") }, { "TickedFocused", assetManager.Get <TextureAsset>("texture.UICheckboxTickedFocused") }, { "TickedFocusedDown", assetManager.Get <TextureAsset>("texture.UICheckboxTickedFocusedDown") }, }; }
public LobbyWorld( IKernel kernel, I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider, bool join, IPAddress address) { this.m_2DRenderUtilities = twodRenderUtilities; this.m_DefaultFont = assetManagerProvider.GetAssetManager().Get <FontAsset>("font.Default"); this.Entities = new List <IEntity>(); this.m_NetworkAPI = new DefaultNetworkAPI(join, address); kernel.Bind <INetworkAPI>().ToMethod(x => this.m_NetworkAPI); }
public LobbyWorld( IKernel kernel, I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider, bool join, IPAddress address) { this.m_2DRenderUtilities = twodRenderUtilities; this.m_DefaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); this.Entities = new List<IEntity>(); this.m_NetworkAPI = new DefaultNetworkAPI(join, address); kernel.Bind<INetworkAPI>().ToMethod(x => this.m_NetworkAPI); }
public void Render(IGameContext gameContext, IRenderContext renderContext) { if (_renderUtilities == null) { _renderUtilities = _kernel.Get <I2DRenderUtilities>(); } if (_assetManager == null) { _assetManager = _kernel.Get <IAssetManagerProvider>().GetAssetManager(); } if (_defaultFont == null) { _defaultFont = _assetManager.Get <FontAsset>("font.Default"); } if (renderContext.IsCurrentRenderPass <I2DBatchedLoadingScreenRenderPass>()) { var bounds = renderContext.GraphicsDevice.PresentationParameters.Bounds; _renderUtilities.RenderRectangle( renderContext, bounds, new Color(0x33, 0x33, 0x33, 0xFF), true); _renderUtilities.RenderText( renderContext, new Vector2(bounds.Width - 20, bounds.Height - 20), "Loading...", _defaultFont, HorizontalAlignment.Right, VerticalAlignment.Bottom, Color.White, true, Color.Black); _renderUtilities.RenderText( renderContext, new Vector2(20, bounds.Height - 20), "Made with Protogame (protogame.org)", _defaultFont, HorizontalAlignment.Left, VerticalAlignment.Bottom, new Color(0x66, 0x66, 0x66, 0xFF), false, Color.Black); } }
// This is the player constructor. Both parameters are automatically dependency // injected when we call CreatePlayerEntity on the entity factory. public PlayerEntity( I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider) { // Keep the 2D render utilities around for later. this.m_2DRenderUtilities = twodRenderUtilities; // Some implementations might assign the asset manager to a field, depending on // whether or not they need to look up assets during the update or render // loops. In this case we just need access to one texture, so we just keep // it in a local variable for easy access. var assetManager = assetManagerProvider.GetAssetManager(); // Retrieve the player texture. this.m_PlayerTexture = assetManager.Get <TextureAsset>("texture.Player"); }
// This is the player constructor. Both parameters are automatically dependency // injected when we call CreatePlayerEntity on the entity factory. public PlayerEntity( I2DRenderUtilities twodRenderUtilities, IAssetManagerProvider assetManagerProvider) { // Keep the 2D render utilities around for later. this.m_2DRenderUtilities = twodRenderUtilities; // Some implementations might assign the asset manager to a field, depending on // whether or not they need to look up assets during the update or render // loops. In this case we just need access to one texture, so we just keep // it in a local variable for easy access. var assetManager = assetManagerProvider.GetAssetManager(); // Retrieve the player texture. this.m_PlayerTexture = assetManager.Get<TextureAsset>("texture.Player"); }
public OperationCostProfilerVisualiser( IAssetManager assetManager, I2DRenderUtilities renderUtilities, IMemoryProfiler memoryProfiler) { _defaultFont = assetManager.Get <FontAsset>("font.Default"); _renderUtilities = renderUtilities; _memoryProfiler = memoryProfiler; _averageOverTimePeriod = new Dictionary <string, double>(); _historyOverTimePeriod = new Dictionary <string, List <double> >(); _lastFrameToHaveData = new Dictionary <string, int>(); _maximumOverTimePeriod = new Dictionary <string, double>(); MicrosecondLimit = 14000; FramesToAnalyse = 240; }
public OperationCostProfilerVisualiser( IAssetManagerProvider assetManagerProvider, I2DRenderUtilities renderUtilities, IMemoryProfiler memoryProfiler) { _defaultFont = assetManagerProvider.GetAssetManager().Get<FontAsset>("font.Default"); _renderUtilities = renderUtilities; _memoryProfiler = memoryProfiler; _averageOverTimePeriod = new Dictionary<string, double>(); _historyOverTimePeriod = new Dictionary<string, List<double>>(); _lastFrameToHaveData = new Dictionary<string, int>(); _maximumOverTimePeriod = new Dictionary<string, double>(); MicrosecondLimit = 14000; FramesToAnalyse = 240; }
public BaseNetworkEntity( I2DRenderUtilities twodRenderUtilities, ICubeRenderer cubeRenderer, IAssetManagerProvider assetManagerProvider, INetworkAPI networkAPI, int id) { this.m_NetworkAPI = networkAPI; this.m_2DRenderUtilities = twodRenderUtilities; this.m_CubeRenderer = cubeRenderer; this.LocallyOwned = true; this.ID = id; networkAPI.ListenForMessage( "entity update", a => { if (!this.LocallyOwned) { var values = a.Split('|').Select(x => float.Parse(x)).ToArray(); if ((int)values[0] == id) { this.X = values[1]; this.Y = values[2]; this.Z = values[3]; } } }); networkAPI.ListenForMessage( "take object", a => { if (this.LocallyOwned) { var values = a.Split('|').Select(x => float.Parse(x)).ToArray(); if ((int)values[0] == id) { // other player is now owning this object this.LocallyOwned = false; } } }); }
public PROJECT_SAFE_NAMEWorld( INode worldNode, IHierarchy hierarchy, IPlatforming platforming, I2DRenderUtilities renderUtilities, IAssetManagerProvider assetManagerProvider, IAudioUtilities audioUtilities, IProfiler profiler, ILevelManager levelManager) { this.m_RenderUtilities = renderUtilities; this.m_Profiler = profiler; this.m_LevelManager = levelManager; this.m_AssetManager = assetManagerProvider.GetAssetManager(false); this.Entities = new List<IEntity>(); this.m_LevelManager.Load(this, "level.Level0"); }
public ShipEditorWorld( IFactory factory, I2DRenderUtilities twoDRenderUtilities, IAssetManagerProvider assetManagerProvider, IShipTool[] shipTools) { this.Entities = new List<IEntity>(); this.m_2DRenderUtilities = twoDRenderUtilities; this.m_AssetManager = assetManagerProvider.GetAssetManager(); this.m_ShipTools = shipTools; this.m_DefaultFont = this.m_AssetManager.Get<FontAsset>("font.Default"); this.m_Ship = factory.CreateShip(); this.m_ShipEditorEntity = factory.CreateShipEditorEntity(this.m_Ship); this.Entities.Add(this.m_ShipEditorEntity); }
public Player( IPlatforming platforming, IAssetManager assetManager, I2DRenderUtilities renderUtilities, IAudioUtilities audioUtilities) { this.m_Platforming = platforming; this.m_AssetManager = assetManager; this.m_RenderUtilities = renderUtilities; this.m_AudioUtilities = audioUtilities; this.m_Texture = this.m_AssetManager.Get<TextureAsset>("texture.Player"); this.m_JumpSound = this.m_AssetManager.Get<AudioAsset>("audio.Jump"); this.m_JumpHandle = this.m_AudioUtilities.Play(this.m_JumpSound); this.Width = 32; this.Height = 32; }