public RankInfo(Code2015 game, Game parent, GameScene scene, GameState logic) { this.game = game; this.parent = parent; this.scene = scene; this.gameLogic = logic; this.renderSys = game.RenderSystem; FileLocation fl = FileSystem.Instance.Locate("nig_rank_bk.tex", GameFileLocs.GUI); rankBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_home.tex", GameFileLocs.GUI); homeBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_rank_color.tex", GameFileLocs.GUI); rankColor = UITextureManager.Instance.CreateInstance(fl); f6 = GameFontManager.Instance.FRuanEdged4; f8 = GameFontManager.Instance.FRuanEdged6; //for (int i = 0; i < gameLogic.LocalPlayerCount; i++) //players.Add(gameLogic.GetLocalPlayer(i)); }
public ExitGame(Code2015 game, Game parent, GameScene scene, GameState gamelogic, NIGMenu nigMenu) { this.scene = scene; this.renderSys = game.RenderSystem; this.gameLogic = gamelogic; this.parent = parent; this.game = game; this.nigMenu = nigMenu; exitButton = new Button(); FileLocation fl = FileSystem.Instance.Locate("nig_esc.tex", GameFileLocs.GUI); exitButton.Image = UITextureManager.Instance.CreateInstance(fl); exitButton.X = -13; exitButton.Y = 0; exitButton.Width = exitButton.Image.Width; exitButton.Height = exitButton.Image.Height; exitButton.Enabled = true; exitButton.IsValid = true; isButtonClicked = false; exitButton.MouseClick += ExitButton_Pressed; }
public Popup(RenderSystem rs, Texture tex, int x, int y, float duration) { this.x = x; this.y = y; this.texture = tex; this.duration = duration; }
public NIGObjective(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.parent = parent; this.game = game; this.renderSys = game.RenderSystem; this.scene = scene; this.gameLogic = gamelogic; FileLocation fl = FileSystem.Instance.Locate("nig_objective_bg.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_objective_btn.tex", GameFileLocs.GUI); okButton = new Button(); okButton.Image = UITextureManager.Instance.CreateInstance(fl); okButton.X = 748; okButton.Y = 337; okButton.Width = okButton.Image.Width; okButton.Height = okButton.Image.Height; okButton.Enabled = true; okButton.IsValid = true; okButton.MouseClick += OkButton_Click; fl = FileSystem.Instance.Locate("bg_black.tex", GameFileLocs.GUI); overlay = UITextureManager.Instance.CreateInstance(fl); state = NIGDialogState.Hiding; }
/// <summary> /// Mark effect as used during this frame. /// </summary> /// <returns>True if state changed (object was not mark as used during this frame until now), otherwise false.</returns> public bool MarkAsUsed(RenderSystem renderSystem) { if (LastFrameUsed == renderSystem.FrameCounter) return false; LastFrameUsed = renderSystem.FrameCounter; return true; }
public Popup2(RenderSystem rs, Texture tex, int x, int y, float duration, ColorValue modColor) { this.x = x; this.y = y; this.texture = tex; this.duration = duration; this.modColor = modColor; }
public GaussBlurShd(RenderSystem rs) : base(rs) { FileLocation fl = FileSystem.Instance.Locate("blurShd.cps", FileLocateRule.Effects); LoadPixelShader(rs, fl); fl = FileSystem.Instance.Locate("postQuad.cvs", FileLocateRule.Effects); LoadVertexShader(rs, fl); }
public EdgeDetect(RenderSystem rs) : base(rs) { FileLocation fl = FileSystem.Instance.Locate("edge.cps", FileLocateRule.Effects); LoadPixelShader(rs, fl); fl = FileSystem.Instance.Locate("postQuad.cvs", FileLocateRule.Effects); LoadVertexShader(rs, fl); }
public DepthView(RenderSystem rs) : base(rs) { FileLocation fl = FileSystem.Instance.Locate("depthView.cps", FileLocateRule.Effects); LoadPixelShader(rs, fl); fl = FileSystem.Instance.Locate("postQuad.cvs", FileLocateRule.Effects); LoadVertexShader(rs, fl); }
public NIGFail(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.parent = parent; this.game = game; this.renderSys = game.RenderSystem; this.scene = scene; this.gameLogic = gamelogic; FileLocation fl = FileSystem.Instance.Locate("nig_fail_bg.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_fail_fail.tex", GameFileLocs.GUI); failTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_result_back.tex", GameFileLocs.GUI); backButton = new Button(); backButton.Image = UITextureManager.Instance.CreateInstance(fl); backButton.X = 450; backButton.Y = 530; backButton.Width = backButton.Image.Width; backButton.Height = backButton.Image.Height; backButton.Enabled = true; backButton.IsValid = true; backButton.MouseClick += BackButton_Click; fl = FileSystem.Instance.Locate("nig_result_replay.tex", GameFileLocs.GUI); replayButton = new Button(); replayButton.Image = UITextureManager.Instance.CreateInstance(fl); replayButton.X = 738; replayButton.Y = 512; replayButton.Width = replayButton.Image.Width; replayButton.Height = replayButton.Image.Height; replayButton.Enabled = true; replayButton.IsValid = true; replayButton.MouseClick += ReplayButton_Click; fl = FileSystem.Instance.Locate("nig_rank_bk.tex", GameFileLocs.GUI); rankBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_home.tex", GameFileLocs.GUI); homeBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_rank_color.tex", GameFileLocs.GUI); rankColor = UITextureManager.Instance.CreateInstance(fl); f6 = GameFontManager.Instance.FRuanEdged4; f8 = GameFontManager.Instance.FRuanEdged6; fl = FileSystem.Instance.Locate("bg_black.tex", GameFileLocs.GUI); overlay = UITextureManager.Instance.CreateInstance(fl); state = NIGDialogState.Hiding; }
public Intro(RenderSystem rs) { for (int i = 0; i < FrameCount; i++) { FileLocation fl = FileSystem.Instance.Locate("logo" + i.ToString("D3") + ".tex", GameFileLocs.Movie); frames[i] = UITextureManager.Instance.CreateInstance(fl); } FileLocation fl2 = FileSystem.Instance.Locate("bg_black.tex", GameFileLocs.GUI); blackBg = UITextureManager.Instance.CreateInstance(fl2); }
public SplashSmokes(City city, RenderSystem rs) { this.parent = city; emitSmokes = new Smoke[SmokeCount]; FileLocation fl = FileSystem.Instance.Locate("smoke_light.mesh", GameFileLocs.Model); smokeModel = new Model(ModelManager.Instance.CreateInstance(rs, fl)); }
public unsafe EarthBaseEffect(RenderSystem rs) : base(false, EarthBaseEffectFactory.Name) { this.renderSys = rs; FileLocation fl = FileSystem.Instance.Locate("earthbase.cvs", GameFileLocs.Effect); vtxShader = LoadVertexShader(renderSys, fl); fl = FileSystem.Instance.Locate("earthbase.cps", GameFileLocs.Effect); pixShader = LoadPixelShader(renderSys, fl); }
public unsafe CityLinkEffect(RenderSystem rs) : base(rs, CityLinkEffectFactory.Name, false) { this.renderSys = rs; FileLocation fl = FileSystem.Instance.Locate("citylink.cvs", GameFileLocs.Effect); vtxShader = LoadVertexShader(renderSys, fl); fl = FileSystem.Instance.Locate("citylink.cps", GameFileLocs.Effect); pixShader = LoadPixelShader(renderSys, fl); }
/// <summary> /// Creates the render window, tells it to use our WinForms window, and enables vsync /// </summary> private static RenderWindow InitRenderWindow(Root root, RenderSystem renderSystem) { Launch.Log("[Loading] Creating RenderWindow..."); //Ensure RenderSystem has been Initialised root.RenderSystem = renderSystem; var window = root.Initialise(true, "Ponykart"); window.SetVisible(false); window.SetIcon(Resources.Icon_2); window.SetDeactivateOnFocusChange(false); return window; }
public VisibilityGroup(RenderSystem renderSystem) { RenderSystem = renderSystem; RenderObjects = new RenderObjectCollection(this); RenderData.Initialize(ComputeDataArrayExpectedSize); // Create RenderStageMask key, and keep track of number of RenderStages.Count for future resizing RenderStageMaskKey = RenderData.CreateStaticObjectKey<uint>(null, stageMaskMultiplier = (RenderSystem.RenderStages.Count + RenderStageMaskSizePerEntry - 1) / RenderStageMaskSizePerEntry); Array.Resize(ref viewRenderStageMask, stageMaskMultiplier); RenderSystem.RenderStages.CollectionChanged += RenderStages_CollectionChanged; RenderSystem.RenderStageSelectorsChanged += RenderSystem_RenderStageSelectorsChanged; RenderSystem.RenderFeatures.CollectionChanged += RenderFeatures_CollectionChanged; }
private GameFontManager(RenderSystem rs) { //f20ig1 = new GameFont("f20ig1"); //f18g1 = new GameFont("f18g1"); //f201 = new GameFont("f20i"); ////f14 = new GameFont("f14"); //f18 = new GameFont("f18"); //fRuan4 = new GameFontRuan("font"); //fRuan6 = new GameFontRuan("font_s"); //fRuan8 = new GameFontRuan("font_ss"); fRuanEdged4 = new GameFontRuan("font_edged"); fRuanEdged6 = new GameFontRuan("font_edgeds"); fRuanEdged8 = new GameFontRuan("font_edgedss"); }
public Quest(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.scene = scene; this.renderSys = game.RenderSystem; this.gameLogic = gamelogic; this.parent = parent; this.game = game; FileLocation fl = FileSystem.Instance.Locate("nig_quest.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); player = gamelogic.LocalHumanPlayer; fedge6 = GameFontManager.Instance.FRuanEdged8; }
public unsafe StandardEffect(RenderSystem rs) : base(rs, StandardEffectFactory.Name, false) { FileLocation fl = FileSystem.Instance.Locate("tillingmark.tex", GameFileLocs.Texture); noTexture = TextureManager.Instance.CreateInstance(fl);// fac.CreateTexture(1, 1, 1, TextureUsage.Static, ImagePixelFormat.A8R8G8B8); this.renderSys = rs; fl = FileSystem.Instance.Locate("standard.cvs", GameFileLocs.Effect); vtxShader = LoadVertexShader(renderSys, fl); fl = FileSystem.Instance.Locate("standard.cps", GameFileLocs.Effect); pixShader = LoadPixelShader(renderSys, fl); }
public unsafe TailEffect(RenderSystem rs) : base(rs, TailEffectFactory.Name, false) { FileLocation fl = FileSystem.Instance.Locate("tillingmark.tex", GameFileLocs.Texture); noTexture = TextureManager.Instance.CreateInstance(fl); this.renderSys = rs; fl = FileSystem.Instance.Locate("tail.cvs", GameFileLocs.Effect); vtxShader = LoadVertexShader(renderSys, fl); fl = FileSystem.Instance.Locate("tail.cps", GameFileLocs.Effect); pixShader = LoadPixelShader(renderSys, fl); }
public ResourceHandle<TreeBatchModel> CreateInstance(RenderSystem rs, ForestInfo info) { Resource retrived = base.Exists(TreeBatchModel.GetHashString(info)); if (retrived == null) { TreeBatchModel mdl = new TreeBatchModel(rs, info); base.NotifyResourceNew(mdl); retrived = mdl; } else { retrived.Use(); } return new ResourceHandle<TreeBatchModel>((TreeBatchModel)retrived); }
/// <summary> /// set up ogre /// </summary> public Program() { root = new Root("plugins.cfg", "", "Ogre.log"); renderSystem = root.GetRenderSystemByName("Direct3D9 Rendering Subsystem"); renderSystem.SetConfigOption("Full Screen", "No"); renderSystem.SetConfigOption("Video Mode", "1920 x 1200 @ 32-bit colour"); root.RenderSystem = renderSystem; SetupResources(); window = root.Initialise(true, "shadow test"); sceneMgr = root.CreateSceneManager(SceneType.ST_GENERIC, "sceneMgr"); sceneMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f); camera = sceneMgr.CreateCamera("cam"); camera.Position = new Vector3(0.8f, 0.8f, 0.8f); camera.LookAt(new Vector3(-1, 1, -1)); camera.SetAutoTracking(true, sceneMgr.RootSceneNode.CreateChildSceneNode(new Vector3(0, 0.4f, 0))); camera.NearClipDistance = 0.1f; camera.FarClipDistance = 2000; viewport = window.AddViewport(camera); viewport.BackgroundColour = ColourValue.Black; camera.AspectRatio = (float) viewport.ActualWidth / (float) viewport.ActualHeight; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); TextureManager.Singleton.DefaultNumMipmaps = 1; CreateThings(); //SetupParticles(); //SetupShadows(); SetupInput(); root.FrameStarted += FrameStarted; Console.WriteLine( @" Press 1, 2, 3, 4 to enable/disable lights, or Esc to quit. The red and blue textures have PSSM and self-shadowing enabled. The yellow one does not. You can also use WASDQE to move the camera around." ); }
public NIGMenu(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.parent = parent; this.game = game; this.renderSys = game.RenderSystem; this.scene = scene; this.gameLogic = gamelogic; FileLocation fl = FileSystem.Instance.Locate("nig_m_bg.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("bg_black.tex", GameFileLocs.GUI); overlay = UITextureManager.Instance.CreateInstance(fl); state = NIGDialogState.Hiding; fl = FileSystem.Instance.Locate("nig_m_btn_resume.tex", GameFileLocs.GUI); resumeButton = new Button(); resumeButton.Image = UITextureManager.Instance.CreateInstance(fl); resumeButton.X = 566; resumeButton.Y = 211; resumeButton.Width = resumeButton.Image.Width; resumeButton.Height = resumeButton.Image.Height; resumeButton.Enabled = true; resumeButton.IsValid = true; resumeButton.MouseClick += ResumeButton_Click; fl = FileSystem.Instance.Locate("nig_m_btn_restart.tex", GameFileLocs.GUI); restartButton = new Button(); restartButton.Image = UITextureManager.Instance.CreateInstance(fl); restartButton.X = 560; restartButton.Y = 276; restartButton.Width = restartButton.Image.Width; restartButton.Height = restartButton.Image.Height; restartButton.Enabled = true; restartButton.IsValid = true; restartButton.MouseClick += RestartButton_Click; fl = FileSystem.Instance.Locate("nig_m_btn_back.tex", GameFileLocs.GUI); exitButton = new Button(); exitButton.Image = UITextureManager.Instance.CreateInstance(fl); exitButton.X = 582; exitButton.Y = 339; exitButton.Width = exitButton.Image.Width; exitButton.Height = exitButton.Image.Height; exitButton.Enabled = true; exitButton.IsValid = true; exitButton.MouseClick += ExitButton_Click; }
public ResourceHandle<TerrainTexture> CreateInstance(RenderSystem rs, FileLocation rl) { Resource retrived = base.Exists(rl.Name); if (retrived == null) { TerrainTexture mdl = new TerrainTexture(rs, rl); retrived = mdl; base.NotifyResourceNew(mdl); } //else //{ // retrived.Use(); //} return new ResourceHandle<TerrainTexture>((TerrainTexture)retrived); }
protected override void Begin(EntityWorld world, Entity entity) { RenderSystem = world.SystemManager.GetSystem<RenderSystem>(); if (RenderSystem == null) { Finish(); return; } IRenderEffects renderEffects = GetRenderEffects(world.EntityManager.GetComponent<Renderable>(entity)); if (renderEffects == null) { Finish(); return; } Begin(renderEffects); }
public TerrainTile(RenderSystem rs, int col, int lat) : base(true) { terrain0 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17); terrain0.Touch(); //terrain1 = TerrainMeshManager.Instance.CreateInstance(rs, col, lat, 17); //terrain1.Touch(); Transformation = terrain0.GetWeakResource().Transformation; BoundingSphere = terrain0.GetWeakResource().BoundingSphere; //Transformation = terrain0.GetWeakResource().Transformation; //BoundingSphere = terrain0.GetWeakResource().BoundingSphere; //terrain0.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged; //terrain1.GetWeakResource().ObjectSpaceChanged += TerrainMesh_ObjectSpaceChanged; }
public Smokes(City city, RenderSystem rs) { this.parent = city; int smokeCount = MinSmokeCount + (int)((MaxSmokeCount - MinSmokeCount) * Randomizer.GetRandomSingle()); emitSmokes = new Smoke[smokeCount]; FileLocation fl = FileSystem.Instance.Locate("smoke.mesh", GameFileLocs.Model); smokeModel = new Model(ModelManager.Instance.CreateInstance(rs, fl)); UpdateDirection(); }
public unsafe RigidEffect(RenderSystem rs, string name, bool inst) : base(inst, name) { FileLocation fl = FileSystem.Instance.Locate("shadowMap.cvs", GameFileLocs.Effect); shdVtxShader = LoadVertexShader(rs, fl); fl = FileSystem.Instance.Locate("shadowMap.cps", GameFileLocs.Effect); shdPixShader = LoadPixelShader(rs, fl); fl = FileSystem.Instance.Locate("normalGen.cvs", GameFileLocs.Effect); nrmGenVShader = LoadVertexShader(rs, fl); fl = FileSystem.Instance.Locate("normalGen.cps", GameFileLocs.Effect); nrmGenPShader = LoadPixelShader(rs, fl); }
public SharedIndexData(RenderSystem rs, int terrSize) { TerrainSize = terrSize; ObjectFactory factory = rs.ObjectFactory; int primCount = MathEx.Sqr(terrSize) * 2; int indexCount = primCount * 3; indexBuffer = factory.CreateIndexBuffer(IndexBufferType.Bit32, indexCount, BufferUsage.WriteOnly); int[] indexArray = new int[indexCount]; int idx = 0; for (int i = 0; i < terrSize - 1; i++) { int remi = i % 2; for (int j = 0; j < terrSize - 1; j++) { int remj = j % 2; if (remi == remj) { indexArray[idx++] = i * terrSize + j; indexArray[idx++] = i * terrSize + (j + 1); indexArray[idx++] = (i + 1) * terrSize + j; indexArray[idx++] = i * terrSize + (j + 1); indexArray[idx++] = (i + 1) * terrSize + (j + 1); indexArray[idx++] = (i + 1) * terrSize + j; } else { indexArray[idx++] = i * terrSize + j; indexArray[idx++] = (i + 1) * terrSize + (j + 1); indexArray[idx++] = i * terrSize + (j + 1); indexArray[idx++] = i * terrSize + j; indexArray[idx++] = (i + 1) * terrSize + j; indexArray[idx++] = (i + 1) * terrSize + (j + 1); } } } indexBuffer.SetData<int>(indexArray); }
public CreditScreen(RenderSystem rs, Menu parent) { this.renderSys = rs; this.parent = parent; FileLocation fl = FileSystem.Instance.Locate("cursor.tex", GameFileLocs.GUI); cursor = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("credits_bg.tex", GameFileLocs.GUI); bg = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("crd_list.tex", GameFileLocs.GUI); //list = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("crd_ruan.tex", GameFileLocs.GUI); crdRuan = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("crd_xin.tex", GameFileLocs.GUI); crdXin = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("crd_yb.tex", GameFileLocs.GUI); crdYb = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("crd_zj.tex", GameFileLocs.GUI); crdZj = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("crd_music.tex", GameFileLocs.GUI); crdMusic = UITextureManager.Instance.CreateInstance(fl); backBtn = new Button(); fl = FileSystem.Instance.Locate("back_btn.tex", GameFileLocs.GUI); backBtn.Image = UITextureManager.Instance.CreateInstance(fl); backBtn.X = 1000; backBtn.Y = 600; backBtn.Width = backBtn.Image.Width; backBtn.Height = backBtn.Image.Height; backBtn.Enabled = true; backBtn.IsValid = true; backBtn.MouseClick += Back_Click; Reset(); mouseHover = (NormalSoundObject)SoundManager.Instance.MakeSoundObjcet("buttonHover", null, 0); mouseDown = (NormalSoundObject)SoundManager.Instance.MakeSoundObjcet("buttonDown", null, 0); }
protected override void InitializeCore() { base.InitializeCore(); RenderSystem.Initialize(Context); }
public TreeEffectFactory(RenderSystem dev) { device = dev; }
public void Run() { try { // Load renderer renderer = RenderSystem.Load("OpenGL", debugger); // Create render context var contextDesc = new RenderContextDescriptor(); { contextDesc.VideoMode.Resolution.Width = 800; contextDesc.VideoMode.Resolution.Height = 600; contextDesc.VideoMode.ColorBits = 32; contextDesc.VideoMode.DepthBits = 24; contextDesc.VideoMode.StencilBits = 8; } context = renderer.CreateRenderContext(contextDesc); // Get context window var window = context.Surface; window.Shown = true; window.Title = $"LLGL for C# - Texturing ( {renderer.Name} )"; // Print renderer information Console.WriteLine("Renderer Info:"); var info = renderer.Info; { Console.WriteLine($" Renderer: {info.RendererName}"); Console.WriteLine($" Device: {info.DeviceName}"); Console.WriteLine($" Vendor: {info.VendorName}"); Console.WriteLine($" Shading Language: {info.ShadingLanguageName}"); } // Create vertex buffer var vertexFormat = new VertexFormat(); vertexFormat.AppendAttribute(new VertexAttribute("coord", Format.RG32Float)); vertexFormat.AppendAttribute(new VertexAttribute("texCoord", Format.RG32Float)); const float uvScale = 10.0f; var vertices = new Vertex[] { new Vertex(-0.5f, -0.5f, 0.0f, uvScale), new Vertex(-0.5f, +0.5f, 0.0f, 0.0f), new Vertex(+0.5f, -0.5f, uvScale, uvScale), new Vertex(+0.5f, +0.5f, uvScale, 0.0f), }; var vertexBufferDesc = new BufferDescriptor(); { vertexBufferDesc.BindFlags = BindFlags.VertexBuffer; vertexBufferDesc.Size = vertexFormat.Stride * (ulong)vertices.Length; vertexBufferDesc.VertexBuffer.Format = vertexFormat; } var vertexBuffer = renderer.CreateBuffer(vertexBufferDesc, vertices); // Create shaders var vertShader = renderer.CreateShader( new ShaderDescriptor( type: ShaderType.Vertex, sourceType: ShaderSourceType.CodeString, source: @" #version 330 core in vec2 coord; in vec2 texCoord; out vec2 vTexCoord; void main() { gl_Position = vec4(coord, 0, 1); vTexCoord = texCoord; } " ) ); var fragShader = renderer.CreateShader( new ShaderDescriptor ( type: ShaderType.Fragment, sourceType: ShaderSourceType.CodeString, source: @" #version 330 core in vec2 vTexCoord; out vec4 fColor; uniform sampler2D tex; void main() { fColor = texture(tex, vTexCoord); } " ) ); var shaderProgramDesc = new ShaderProgramDescriptor(); { shaderProgramDesc.VertexFormats.Add(vertexFormat); shaderProgramDesc.VertexShader = vertShader; shaderProgramDesc.FragmentShader = fragShader; } var shaderProgram = renderer.CreateShaderProgram(shaderProgramDesc); if (shaderProgram.HasErrors) { throw new Exception(shaderProgram.Report); } // Create pipeline layout var pipelineLayoutDesc = new PipelineLayoutDescriptor(); { pipelineLayoutDesc.Bindings.Add( new BindingDescriptor(ResourceType.Texture, BindFlags.Sampled, StageFlags.FragmentStage, 0) ); pipelineLayoutDesc.Bindings.Add( new BindingDescriptor(ResourceType.Sampler, 0, StageFlags.FragmentStage, 0) ); } var pipelineLayout = renderer.CreatePipelineLayout(pipelineLayoutDesc); // Create graphics pipeline var pipelineDesc = new GraphicsPipelineDescriptor(); { pipelineDesc.ShaderProgram = shaderProgram; pipelineDesc.PipelineLayout = pipelineLayout; pipelineDesc.PrimitiveTopology = PrimitiveTopology.TriangleStrip; pipelineDesc.Blend.Targets[0].BlendEnabled = true; } pipeline = renderer.CreateGraphicsPipeline(pipelineDesc); // Create texture var imageDesc = new SrcImageDescriptor <RGBA>(); { imageDesc.Format = ImageFormat.RGBA; imageDesc.DataType = DataType.UInt8; imageDesc.Data = new RGBA[4]; imageDesc.Data[0] = new RGBA(255, 0, 0, 255); imageDesc.Data[1] = new RGBA(0, 255, 0, 255); imageDesc.Data[2] = new RGBA(0, 0, 0, 0); imageDesc.Data[3] = new RGBA(0, 0, 0, 0); } var textureDesc = new TextureDescriptor(); { textureDesc.Type = TextureType.Texture2D; textureDesc.Extent = new Extent3D(2, 2, 1); } var texture = renderer.CreateTexture(textureDesc, imageDesc); // Create sampler var samplerDesc = new SamplerDescriptor(); { samplerDesc.MagFilter = SamplerFilter.Nearest; } var sampler = renderer.CreateSampler(samplerDesc); // Create resource heap var resourceHeapDesc = new ResourceHeapDescriptor(); { resourceHeapDesc.PipelineLayout = pipelineLayout; resourceHeapDesc.ResourceViews.Add(new ResourceViewDescriptor(texture)); resourceHeapDesc.ResourceViews.Add(new ResourceViewDescriptor(sampler)); } var resourceHeap = renderer.CreateResourceHeap(resourceHeapDesc); // Get command queue cmdQueue = renderer.CommandQueue; cmdBuffer = renderer.CreateCommandBuffer(); cmdBuffer.SetClearColor(0.1f, 0.1f, 0.2f, 1.0f); // Render loop while (window.ProcessEvents()) { cmdBuffer.Begin(); { cmdBuffer.SetVertexBuffer(vertexBuffer); cmdBuffer.BeginRenderPass(context); { cmdBuffer.Clear(ClearFlags.Color); cmdBuffer.SetViewport(new Viewport(0, 0, context.Resolution.Width, context.Resolution.Height)); cmdBuffer.SetGraphicsPipeline(pipeline); cmdBuffer.SetGraphicsResourceHeap(resourceHeap); cmdBuffer.Draw(4, 0); } cmdBuffer.EndRenderPass(); } cmdBuffer.End(); cmdQueue.Submit(cmdBuffer); context.Present(); } } catch (Exception e) { Console.WriteLine(e.ToString()); Console.WriteLine("press any key to continue ..."); Console.ReadKey(); } finally { RenderSystem.Unload(renderer); } }
/// <inheritdoc/> protected override void DrawCore(RenderDrawContext context) { if (Game != null) { // Get or create VisibilityGroup for this RenderSystem + SceneInstance var sceneInstance = SceneInstance.GetCurrent(context.RenderContext); VisibilityGroup visibilityGroup = null; if (sceneInstance != null) { // Find if VisibilityGroup foreach (var currentVisibilityGroup in sceneInstance.VisibilityGroups) { if (currentVisibilityGroup.RenderSystem == RenderSystem) { visibilityGroup = currentVisibilityGroup; break; } } // If first time, let's create and register it if (visibilityGroup == null) { sceneInstance.VisibilityGroups.Add(visibilityGroup = new VisibilityGroup(RenderSystem)); initializedSceneInstances.Add(sceneInstance); } // Reset & cleanup visibilityGroup.Reset(); } using (context.RenderContext.PushTagAndRestore(SceneInstance.CurrentVisibilityGroup, visibilityGroup)) using (context.RenderContext.PushTagAndRestore(SceneInstance.CurrentRenderSystem, RenderSystem)) using (context.RenderContext.PushTagAndRestore(SceneCameraSlotCollection.Current, Cameras)) using (context.RenderContext.PushTagAndRestore(Current, this)) { // Set render system context.RenderContext.RenderSystem = RenderSystem; context.RenderContext.VisibilityGroup = visibilityGroup; // Set start states for viewports and output (it will be used during the Collect phase) var renderOutputs = new RenderOutputDescription(); renderOutputs.CaptureState(context.CommandList); context.RenderContext.RenderOutput = renderOutputs; var viewports = new ViewportState(); viewports.CaptureState(context.CommandList); context.RenderContext.ViewportState = viewports; try { // Collect in the game graphics compositor: Setup features/stages, enumerate views and populates VisibilityGroup Game.Collect(context.RenderContext); // Collect in render features RenderSystem.Collect(context.RenderContext); // Collect visibile objects from each view (that were not properly collected previously) if (visibilityGroup != null) { foreach (var view in RenderSystem.Views) { visibilityGroup.TryCollect(view); } } // Extract RenderSystem.Extract(context.RenderContext); // Prepare RenderSystem.Prepare(context); // Draw using the game graphics compositor Game.Draw(context); // Flush RenderSystem.Flush(context); } finally { // Reset render context data RenderSystem.Reset(); } } } }
public static void Initialize(RenderSystem device) { singleton = new MaterialLibrary(device); }
public void Initialize() { this._renderSystem = new GLES2RenderSystem(); Root.Instance.RenderSystems.Add("OpenGLES2", this._renderSystem); }
//bool isPostStarting; public MainMenu(Code2015 game, Menu parent) { RenderSystem rs = game.RenderSystem; this.game = game; this.parent = parent; FileLocation fl = FileSystem.Instance.Locate("nmm_credits.tex", GameFileLocs.GUI); credits = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_quit.tex", GameFileLocs.GUI); exit = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_help.tex", GameFileLocs.GUI); help = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_play.tex", GameFileLocs.GUI); start = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_logo.tex", GameFileLocs.GUI); logo = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("mm_btn_credits_hover.tex", GameFileLocs.GUI); //credits_hover = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("mm_btn_quit_hover.tex", GameFileLocs.GUI); //exit_hover = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("mm_btn_help_hover.tex", GameFileLocs.GUI); //help_hover = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("mm_btn_single_hover.tex", GameFileLocs.GUI); //start_hover = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_bg.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); //fl = FileSystem.Instance.Locate("mm_start_link.tex", GameFileLocs.GUI); //linkbg = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_roles.tex", GameFileLocs.GUI); rolesTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_water.tex", GameFileLocs.GUI); waterTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_border.tex", GameFileLocs.GUI); boarderTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nmm_map.tex", GameFileLocs.GUI); mapTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("cursor.tex", GameFileLocs.GUI); cursor = UITextureManager.Instance.CreateInstance(fl); #region 配置按钮 startButton = new RoundButton(); startButton.X = 650; startButton.Y = 170; startButton.Radius = 244 / 2; startButton.Enabled = true; startButton.IsValid = true; startButton.MouseClick += StartButton_Click; startButton.MouseEnter += Button_MouseIn; startButton.MouseDown += Button_DownSound; exitButton = new RoundButton(); exitButton.X = 896; exitButton.Y = 386; exitButton.Radius = 106 / 2; exitButton.Enabled = true; exitButton.IsValid = true; exitButton.MouseClick += ExitButton_Click; exitButton.MouseEnter += Button_MouseIn; exitButton.MouseDown += Button_DownSound; creditButton = new RoundButton(); creditButton.X = 955; creditButton.Y = 198; creditButton.Radius = 138 / 2; creditButton.Enabled = true; creditButton.IsValid = true; creditButton.MouseEnter += Button_MouseIn; creditButton.MouseDown += Button_DownSound; creditButton.MouseClick += CreditButton_Click; helpButton = new RoundButton(); helpButton.X = 225; helpButton.Y = 425; helpButton.Radius = 138 / 2; helpButton.Enabled = true; helpButton.IsValid = true; helpButton.MouseEnter += Button_MouseIn; helpButton.MouseDown += Button_DownSound; helpButton.MouseClick += HelpButton_Click; #endregion mouseHover = (NormalSoundObject)SoundManager.Instance.MakeSoundObjcet("buttonHover", null, 0); mouseDown = (NormalSoundObject)SoundManager.Instance.MakeSoundObjcet("buttonDown", null, 0); }
public void InitializeGraphics(RenderSystem rs) { FileLocation fl = null; switch (Type) { case RBallType.Disease: fl = FileSystem.Instance.Locate("rb_virus_ball.mesh", GameFileLocs.Model); break; case RBallType.Education: fl = FileSystem.Instance.Locate("rb_school_ball.mesh", GameFileLocs.Model); break; case RBallType.Green: fl = FileSystem.Instance.Locate("rb_green_ball.mesh", GameFileLocs.Model); break; case RBallType.Health: fl = FileSystem.Instance.Locate("rb_hospital_ball.mesh", GameFileLocs.Model); break; case RBallType.Oil: fl = FileSystem.Instance.Locate("rb_oil_ball.mesh", GameFileLocs.Model); break; case RBallType.Volience: fl = FileSystem.Instance.Locate("rb_volient_ball.mesh", GameFileLocs.Model); break; } ModelL0 = new Model(ModelManager.Instance.CreateInstance(rs, fl)); ModelL0.CurrentAnimation.Clear(); if (Type == RBallType.Oil) { ModelL0.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.Scaling(1.6f, 1.6f, 1.6f) * Matrix.RotationX(-MathEx.PiOver2))); } else if (Type == RBallType.Volience) { ModelL0.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.Scaling(2.0f, 2.0f, 2.0f) * Matrix.RotationX(-MathEx.PiOver2))); } else if (Type == RBallType.Education) { ModelL0.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.Scaling(2.25f, 2.25f, 2.25f) * Matrix.RotationX(-MathEx.PiOver2))); } else if (Type == RBallType.Disease) { ModelL0.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.Scaling(3.75f, 3.75f, 3.75f) * Matrix.RotationX(-MathEx.PiOver2) * Matrix.RotationY(MathEx.PiOver2))); } else { ModelL0.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.Scaling(1.4f, 1.4f, 1.4f) * Matrix.RotationX(-MathEx.PiOver2))); } UpdateDisplayScale(); fl = FileSystem.Instance.Locate("rball_tail_red.mesh", GameFileLocs.Model); red_tail = new Model(ModelManager.Instance.CreateInstance(rs, fl)); red_tail.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.RotationX(-MathEx.PiOver2))); fl = FileSystem.Instance.Locate("rball_tail_green.mesh", GameFileLocs.Model); green_tail = new Model(ModelManager.Instance.CreateInstance(rs, fl)); green_tail.CurrentAnimation.Add(new NoAnimaionPlayer(Matrix.RotationX(-MathEx.PiOver2))); soundObject = (Normal3DSoundObject)SoundManager.Instance.MakeSoundObjcet("rball_die", null, 1800); }
public abstract void Render(RenderSystem system);
public CharacterCreator(GameSystem game, RenderSystem renderer) { Game = game; Renderer = renderer; }
public void Shutdown() { // nothing at the moment _renderSystem.SafeDispose(); _renderSystem = null; }
public static unsafe bool UpdateMaterial(RenderSystem renderSystem, RenderThreadContext context, MaterialInfoBase materialInfo, int materialSlotIndex, RenderEffect renderEffect, ParameterCollection materialParameters) { // Check if encountered first time this frame if (materialInfo.LastFrameUsed == renderSystem.FrameCounter) { return(true); } // First time we use the material with a valid effect, let's update layouts if (materialInfo.PerMaterialLayout == null || materialInfo.PerMaterialLayout.Hash != renderEffect.Reflection.ResourceGroupDescriptions[materialSlotIndex].Hash) { var resourceGroupDescription = renderEffect.Reflection.ResourceGroupDescriptions[materialSlotIndex]; if (resourceGroupDescription.DescriptorSetLayout == null) { return(false); } materialInfo.PerMaterialLayout = ResourceGroupLayout.New(renderSystem.GraphicsDevice, resourceGroupDescription, renderEffect.Effect.Bytecode); var parameterCollectionLayout = materialInfo.ParameterCollectionLayout = new ParameterCollectionLayout(); parameterCollectionLayout.ProcessResources(resourceGroupDescription.DescriptorSetLayout); materialInfo.ResourceCount = parameterCollectionLayout.ResourceCount; // Process material cbuffer (if any) if (resourceGroupDescription.ConstantBufferReflection != null) { materialInfo.ConstantBufferReflection = resourceGroupDescription.ConstantBufferReflection; parameterCollectionLayout.ProcessConstantBuffer(resourceGroupDescription.ConstantBufferReflection); } materialInfo.ParametersChanged = true; } // If the parameters collection instance changed, we need to update it if (materialInfo.ParametersChanged) { materialInfo.ParameterCollection.UpdateLayout(materialInfo.ParameterCollectionLayout); materialInfo.ParameterCollectionCopier = new ParameterCollection.Copier(materialInfo.ParameterCollection, materialParameters); materialInfo.ParametersChanged = false; } // Mark this material as used during this frame materialInfo.LastFrameUsed = renderSystem.FrameCounter; // Copy back to ParameterCollection // TODO GRAPHICS REFACTOR directly copy to resource group? materialInfo.ParameterCollectionCopier.Copy(); // Allocate resource groups context.ResourceGroupAllocator.PrepareResourceGroup(materialInfo.PerMaterialLayout, BufferPoolAllocationType.UsedMultipleTime, materialInfo.Resources); // Set resource bindings in PerMaterial resource set for (int resourceSlot = 0; resourceSlot < materialInfo.ResourceCount; ++resourceSlot) { materialInfo.Resources.DescriptorSet.SetValue(resourceSlot, materialInfo.ParameterCollection.ObjectValues[resourceSlot]); } // Process PerMaterial cbuffer if (materialInfo.ConstantBufferReflection != null) { var mappedCB = materialInfo.Resources.ConstantBuffer.Data; fixed(byte *dataValues = materialInfo.ParameterCollection.DataValues) Utilities.CopyMemory(mappedCB, (IntPtr)dataValues, materialInfo.Resources.ConstantBuffer.Size); } return(true); }
public RenderViewer(RenderSystem rs) { renderSys = rs; }
public void Init(String handle) { try { // Create root object mRoot = new Root(); // Define Resources ConfigFile cf = new ConfigFile(); cf.Load("./resources.cfg", "\t:=", true); ConfigFile.SectionIterator seci = cf.GetSectionIterator(); String secName, typeName, archName; while (seci.MoveNext()) { secName = seci.CurrentKey; ConfigFile.SettingsMultiMap settings = seci.Current; foreach (KeyValuePair <string, string> pair in settings) { typeName = pair.Key; archName = pair.Value; ResourceGroupManager.Singleton.AddResourceLocation(archName, typeName, secName); } } //Load the resources from resources.cfg and selected tab (_ConfigurationPaths) //LoadResourceLocations(_ConfigurationPaths); //example of manual add: _FileSystemPaths.Add("../../Media/models"); foreach (string foo in _ConfigurationPaths) { AddResourceLocation(foo); } // Setup RenderSystem mRSys = mRoot.GetRenderSystemByName("Direct3D9 Rendering Subsystem"); //mRSys = mRoot.GetRenderSystemByName("OpenGL Rendering Subsystem"); // or use "OpenGL Rendering Subsystem" mRoot.RenderSystem = mRSys; mRSys.SetConfigOption("Full Screen", "No"); mRSys.SetConfigOption("Video Mode", "800 x 600 @ 32-bit colour"); // Create Render Window mRoot.Initialise(false, "Main Ogre Window"); NameValuePairList misc = new NameValuePairList(); misc["externalWindowHandle"] = handle; misc["FSAA"] = "4"; // misc["VSync"] = "True"; //not sure how to enable vsync to remove those warnings in Ogre.log mWindow = mRoot.CreateRenderWindow("Main RenderWindow", 800, 600, false, misc); // Init resources MaterialManager.Singleton.SetDefaultTextureFiltering(TextureFilterOptions.TFO_ANISOTROPIC); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); // Create a Simple Scene //SceneNode node = null; // mMgr = mRoot.CreateSceneManager(SceneType.ST_GENERIC, "SceneManager"); mMgr = mRoot.CreateSceneManager(SceneType.ST_EXTERIOR_CLOSE, "SceneManager"); mMgr.AmbientLight = new ColourValue(0.8f, 0.8f, 0.8f); mCamera = mMgr.CreateCamera("Camera"); mWindow.AddViewport(mCamera); mCamera.AutoAspectRatio = true; mCamera.Viewport.SetClearEveryFrame(false); //Entity ent = mMgr.CreateEntity(displayMesh, displayMesh); //ent.SetMaterialName(displayMaterial); //node = mMgr.RootSceneNode.CreateChildSceneNode(displayMesh + "node"); //node.AttachObject(ent); mCamera.Position = new Vector3(0, 0, 0); //mCamera.Position = new Vector3(0, 0, -400); mCamera.LookAt(0, 0, 1); //Create a single point light source Light light2 = mMgr.CreateLight("MainLight"); light2.Position = new Vector3(0, 10, -25); light2.Type = Light.LightTypes.LT_POINT; light2.SetDiffuseColour(1.0f, 1.0f, 1.0f); light2.SetSpecularColour(0.1f, 0.1f, 0.1f); mWindow.WindowMovedOrResized(); IsInitialized = true; // Create the camera's top node (which will only handle position). cameraNode = mMgr.RootSceneNode.CreateChildSceneNode(); cameraNode.Position = new Vector3(0, 0, 0); //cameraNode = mMgr->getRootSceneNode()->createChildSceneNode(); //cameraNode->setPosition(0, 0, 500); // Create the camera's yaw node as a child of camera's top node. cameraYawNode = cameraNode.CreateChildSceneNode(); // Create the camera's pitch node as a child of camera's yaw node. cameraPitchNode = cameraYawNode.CreateChildSceneNode(); // Create the camera's roll node as a child of camera's pitch node // and attach the camera to it. cameraRollNode = cameraPitchNode.CreateChildSceneNode(); cameraRollNode.AttachObject(mCamera); mRaySceneQuery = mMgr.CreateRayQuery(new Ray()); } catch (Exception ex) { Console.WriteLine("[Error,OgreForm.cs]: " + ex.Message + "," + ex.StackTrace); } }
protected override void Destroy() { RenderSystem.Dispose(); base.Destroy(); }
public bool preRender(SceneManager sm, RenderSystem rsys) { bool ret = OgrePINVOKE.BillboardChain_preRender(swigCPtr, SceneManager.getCPtr(sm), RenderSystem.getCPtr(rsys)); if (OgrePINVOKE.SWIGPendingException.Pending) { throw OgrePINVOKE.SWIGPendingException.Retrieve(); } return(ret); }
public void Shutdown() { this._renderSystem.Dispose(); this._renderSystem = null; }
public SkinnedStandardEffectFactory(RenderSystem dev) { device = dev; }
private bool InitRender(string wndTitle, ref GameConfigXml gameOptions) { root = Root.Singleton == null ? new Root() : Root.Singleton; root.FrameStarted += new FrameListener.FrameStartedHandler(frameStarted); log = EngineLogManager.Instance.CreateLog("./Log/Engine.log"); rendererLog = LogManager.Singleton.CreateLog("./Log/Mogre.log", true, true, false); rendererLog.SetDebugOutputEnabled(true); RenderSystem rs = null; IniConfigFileParser parser = new IniConfigFileParser(); if (gameOptions == null) { gameOptions = GameConfigXml.Load("game.xml", root); } defaultRenderSystemName = gameOptions.GraphicConfig.CurrentRenderSystem; var renderParams = gameOptions.GraphicConfig[gameOptions.GraphicConfig.CurrentRenderSystem]; if (!string.IsNullOrEmpty(defaultRenderSystemName)) { var videModeRenderParam = renderParams.Where(o => o.Name == "Video Mode").First(); rs = root.GetRenderSystemByName(defaultRenderSystemName); string strVideoMode = Regex.Match( videModeRenderParam.Value, "[0-9]{3,4} x [0-9]{3,4}").Value; VideoMode["Width"] = strVideoMode.Split('x')[0].Trim(); VideoMode["Height"] = strVideoMode.Split('x')[1].Trim(); } var ogreConfigMap = rs.GetConfigOptions(); if (rs != null && renderParams != null) { foreach (var kpl in renderParams) { string renderParamKey = kpl.Name; string renderParamValue = kpl.Value; //Validate the render parameter if (!ogreConfigMap[renderParamKey].possibleValues.Contains(renderParamValue)) { renderParamValue = ogreConfigMap[renderParamKey].possibleValues[0]; } rs.SetConfigOption(renderParamKey, renderParamValue); } root.RenderSystem = rs; } renderWindow = root.Initialise(true, wndTitle); IntPtr hwnd; renderWindow.GetCustomAttribute("WINDOW", out hwnd); Helper.SetRenderWindowIcon(new System.Drawing.Icon(Path.Combine(Environment.CurrentDirectory, "app.ico")), hwnd); viewport = renderWindow.AddViewport(null); ColourValue cv = new ColourValue(0.5f, 0.5f, 0.5f); viewport.BackgroundColour = cv; viewport.Camera = null; int hWnd = 0; renderWindow.GetCustomAttribute("WINDOW", out hWnd); inputMgr = MOIS.InputManager.CreateInputSystem((uint)hWnd); keyboard = (Keyboard)inputMgr.CreateInputObject(MOIS.Type.OISKeyboard, true); mouse = (Mouse)inputMgr.CreateInputObject(MOIS.Type.OISMouse, true); keyMouseManager = new InputKeyMouseManager(); keyMouseManager.SomeKeyPressd += KeyMouseManager_SomeKeyPressd; MouseState_NativePtr mouseState = mouse.MouseState; mouseState.width = viewport.ActualWidth; mouseState.height = viewport.ActualHeight; foreach (var resource in gameOptions.ResourcesConfig.Resources) { foreach (var resLoc in resource.ResourceLocs) { ResourceGroupManager.Singleton.AddResourceLocation(resLoc, resource.Type, ResourceGroupManager.DEFAULT_RESOURCE_GROUP_NAME); } } foreach (var keyMapper in gameOptions.InputConfig.Mappers) { KeyMapperManager.Instance.AddKeyMapper(keyMapper.GameKeyCode, keyMapper.GetKeyCollections()); } if (!LocateSystem.Instance.IsInit) { LocateSystem.Instance.InitLocateSystem(LocateSystem.Instance.ConvertReadableStringToLocate(gameOptions.LocateConfig.CurrentLocate)); } SkinManager.Instance.LoadSkin("Default.skn"); ResourceGroupManager.Singleton.AddResourceLocation( string.Format("./Media/Engine/Fonts/{0}/", LocateSystem.Instance.Locate.ToString()), "FileSystem", "General"); TextureManager.Singleton.DefaultNumMipmaps = 5; ResourceGroupManager.Singleton.InitialiseAllResourceGroups(); UIManager.Instance.Init("AMOFTrayMgr", renderWindow, mouse, new UIListener()); timer = new Timer(); timer.Reset(); renderWindow.IsActive = true; this.gameOptions = gameOptions; log.LogMessage("Game Started!"); return(true); }
public override void Render(RenderSystem system) { throw new System.NotImplementedException(); }
public Code2015(RenderSystem rs, X.Game game) { this.renderSys = rs; this.game = game; }
public AtmosphereEffectFactory(RenderSystem dev) { device = dev; }
public void UnloadWorld() { m_componentList.Clear(); m_gizmos.ResetList(); RenderSystem.UnloadAll(); }
public EarthBaseEffectFactory(RenderSystem dev) { device = dev; }
public void SpawnBackground(Vector2 mapOriginPos, int mapWidth, int mapHeight) { if (bgTiles.Count > 0) { return; } pool = ObjectPool.instance; renderSystem = RenderSystem.instance; if (bgHolder == null) { bgHolder = new GameObject(); bgHolder.name = "BGHolder"; } GameObject go = null; SpriteRenderer renderer; for (int x = -1; x < mapWidth + 1; x++) { for (int y = -1; y < mapHeight + 1; y++) { Vector2 pos = new Vector2(x, y); if (x == -1) { go = pool.GetObjectForType("BGTile", true, pos); renderer = go.GetComponent <SpriteRenderer>(); go.transform.SetParent(bgHolder.transform); if (y == -1) { AddBGTile(go, renderer, "WallLeftCorner"); } else { AddBGTile(go, renderer, "WallLeft"); } continue; } if (x == mapWidth) { go = pool.GetObjectForType("BGTile", true, pos); renderer = go.GetComponent <SpriteRenderer>(); go.transform.SetParent(bgHolder.transform); if (y == -1) { AddBGTile(go, renderer, "WallRightCorner"); } else { AddBGTile(go, renderer, "WallRight"); } continue; } if (y == -1) { go = pool.GetObjectForType("BGTile", true, pos); renderer = go.GetComponent <SpriteRenderer>(); AddBGTile(go, renderer, "WallBottom"); } else if (y == mapHeight) { go = pool.GetObjectForType("BGTile", true, pos); renderer = go.GetComponent <SpriteRenderer>(); AddBGTile(go, renderer, "WallTop"); } } } }
public NIGWin(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.parent = parent; this.game = game; this.renderSys = game.RenderSystem; this.scene = scene; this.gameLogic = gamelogic; FileLocation fl = FileSystem.Instance.Locate("nig_result_bg.tex", GameFileLocs.GUI); background = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("bg_black.tex", GameFileLocs.GUI); overlay = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_result_clear.tex", GameFileLocs.GUI); clearTex = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_result_back.tex", GameFileLocs.GUI); backButton = new Button(); backButton.Image = UITextureManager.Instance.CreateInstance(fl); backButton.X = 450; backButton.Y = 530; backButton.Width = backButton.Image.Width; backButton.Height = backButton.Image.Height; backButton.Enabled = true; backButton.IsValid = true; backButton.MouseClick += BackButton_Click; fl = FileSystem.Instance.Locate("nig_result_replay.tex", GameFileLocs.GUI); replayButton = new Button(); replayButton.Image = UITextureManager.Instance.CreateInstance(fl); replayButton.X = 590; replayButton.Y = 530; replayButton.Width = replayButton.Image.Width; replayButton.Height = replayButton.Image.Height; replayButton.Enabled = true; replayButton.IsValid = true; replayButton.MouseClick += ReplayButton_Click; fl = FileSystem.Instance.Locate("nig_result_next.tex", GameFileLocs.GUI); nextButton = new Button(); nextButton.Image = UITextureManager.Instance.CreateInstance(fl); nextButton.X = 745; nextButton.Y = 528; nextButton.Width = nextButton.Image.Width; nextButton.Height = nextButton.Image.Height; nextButton.Enabled = true; nextButton.IsValid = true; nextButton.MouseClick += NextButton_Click; fl = FileSystem.Instance.Locate("nig_rank_bk.tex", GameFileLocs.GUI); rankBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_home.tex", GameFileLocs.GUI); homeBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_rank_color.tex", GameFileLocs.GUI); rankColor = UITextureManager.Instance.CreateInstance(fl); f6 = GameFontManager.Instance.FRuanEdged4; f8 = GameFontManager.Instance.FRuanEdged6; state = NIGDialogState.Hiding; }
public void Render(RenderSystem system) { system.Render(this); }
public PipelinePluginContext(RenderContext renderContext, RenderSystem renderSystem) { RenderContext = renderContext; RenderSystem = renderSystem; }
private MaterialLibrary(RenderSystem device) { this.renderSystem = device; this.detailedMaps = new Dictionary <string, Entry>(CaseInsensitiveStringComparer.Instance); }
public ObjectSelectInfo(Code2015 game, Game parent, GameScene scene, GameState gamelogic) { this.scene = scene; this.renderSys = game.RenderSystem; this.player = parent.HumanPlayer; this.gameLogic = gamelogic; this.parent = parent; this.game = game; #region Harv FileLocation fl = FileSystem.Instance.Locate("nig_status_harv_bk.tex", GameFileLocs.GUI); statusHarvBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_harv_hpbar_edge.tex", GameFileLocs.GUI); statusHPBarBarEdge = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_harv_hpbar_value.tex", GameFileLocs.GUI); statusHPBarBarValue = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_harv_stbar_edge.tex", GameFileLocs.GUI); statusSTBarBarEdge = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_harv_stbar_value.tex", GameFileLocs.GUI); statusSTBarBarValue = UITextureManager.Instance.CreateInstance(fl); #endregion fl = FileSystem.Instance.Locate("nig_status_empty.tex", GameFileLocs.GUI); statusEmptyBackground = UITextureManager.Instance.CreateInstance(fl); #region Green fl = FileSystem.Instance.Locate("nig_status_green_bk.tex", GameFileLocs.GUI); statusGreenBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_green_bar_edge.tex", GameFileLocs.GUI); statusGreenBarEdge = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_green_bar_value.tex", GameFileLocs.GUI); statusGreenBarValue = UITextureManager.Instance.CreateInstance(fl); #endregion #region Oil fl = FileSystem.Instance.Locate("nig_status_oil_bk.tex", GameFileLocs.GUI); statusOilBackground = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_oil_bar_edge.tex", GameFileLocs.GUI); statusOilBarEdge = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_status_oil_bar_value.tex", GameFileLocs.GUI); statusOilBarValue = UITextureManager.Instance.CreateInstance(fl); #endregion fl = FileSystem.Instance.Locate("nig_harv_hp_edge.tex", GameFileLocs.GUI); harvHPBorader = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_harv_hp_value.tex", GameFileLocs.GUI); harvHPValue = UITextureManager.Instance.CreateInstance(fl); fl = FileSystem.Instance.Locate("nig_harv_hp_bg.tex", GameFileLocs.GUI); harvHPBarBackground = UITextureManager.Instance.CreateInstance(fl); f8 = GameFontManager.Instance.FRuanEdged8; f6 = GameFontManager.Instance.FRuanEdged6; }