Exemplo n.º 1
0
 public Sprite(string path, int frames, float scale)
 {
     texture    = new gfx.Texture2D(path);
     offset     = 1.0f / frames;
     vbo        = gfx.VertexBufferFactory.CreateQuad(2.0f, 2.0f);
     this.scale = scale;
 }
Exemplo n.º 2
0
        public Arena(float radius)
        {
            vbo            = gfx.VertexBufferFactory.CreateCircle(radius);
            mapTexture     = new gfx.Texture2D($"{ContentDirectory}floor.png", gfx.TextureWrapMode.Repeat, gfx.TextureFilterMode.NearestMipmap);
            glowmapTexture = new gfx.Texture2D($"{ContentDirectory}glowmap.png", gfx.TextureWrapMode.Repeat, gfx.TextureFilterMode.NearestMipmap);
            TrapList       = new List <TrapDescriptor>(MaxActiveTraps);
            r = new Random();

            for (int i = 0; i < MaxActiveTraps; ++i)
            {
                TrapDescriptor trap = new TrapDescriptor();
                trap.active = false;
                trap.sprite = new Sprite($"{ContentDirectory}spike.png", 5, 1.5f);
                trap.sprite.SetAnimationParameters(0, 4, 1.0f, true);
                TrapList.Add(trap);
            }
        }
Exemplo n.º 3
0
        public Game(int windowWidth, int windowHeight) : base(windowWidth, windowHeight)
        {
            Title = "Infernal Selection";

            RenderFrame += eRenderFrame;
            KeyDown     += Game_KeyDown;
            KeyUp       += Game_KeyUp;
            Closing     += Game_Closing;

            aspect = (float)Width / Height;

            audioPlayer = new MusicStream();

            gameState = GameState.Menu;

            GL.ClearColor(0.1f, 0.1f, 0.1f, 1.0f);
            shdFloor         = gfx.ShaderFactory.CreateFloorShader();
            shdTexture       = gfx.ShaderFactory.CreateTextureShader();
            shdBackground    = gfx.ShaderFactory.CreateBackgroundShader();
            shdFinalpass     = gfx.ShaderFactory.CreateFinalpassShader();
            shdUserInterface = gfx.ShaderFactory.CreateUserInterfaceShader();
            shdBloodyScreen  = gfx.ShaderFactory.CreateBloodyScreenShader();

            Matrix4 ortho = Matrix4.CreateOrthographic(20f * aspect, 20f, -1.0f, 1.0f);

            shdTexture.LoadMatrix4(ortho, "projection");
            shdFloor.LoadMatrix4(ortho, "projection");

            offscreen = new gfx.RenderTarget(Width, Height);

            screenQuad = gfx.VertexBufferFactory.CreateQuad(2.0f, 2.0f);

            texScratch = new gfx.Texture2D($"{ContentDirectory}scratch.png");

            arena = new Arena(15.0f);

            playButton = new UserInterfaceWidget($"{ContentDirectory}playbtn.png",
                                                 new Vector2(0.2f * 200f / 75f, 0.2f),
                                                 new Vector2(0.0f, 0.4f));

            exitButton = new UserInterfaceWidget($"{ContentDirectory}quitbtn.png",
                                                 new Vector2(0.2f * 200f / 75f, 0.2f),
                                                 new Vector2(0.0f, 0.0f));

            fplayButton = new UserInterfaceWidget($"{ContentDirectory}fplaybtn.png",
                                                  new Vector2(0.2f * 200f / 75f, 0.2f),
                                                  new Vector2(0.0f, 0.4f));

            fexitButton = new UserInterfaceWidget($"{ContentDirectory}fquitbtn.png",
                                                  new Vector2(0.2f * 200f / 75f, 0.2f),
                                                  new Vector2(0.0f, 0.0f));

            ggjIcon = new UserInterfaceWidget($"{ContentDirectory}ggj.png",
                                              new Vector2(0.3f / aspect, 0.3f),
                                              new Vector2(0.7f, -0.7f));

            chainRenderer = new ChainRenderer(aspect, audioPlayer);

            GL.Enable(EnableCap.StencilTest);
            GL.Enable(EnableCap.Blend);
            GL.BlendFunc(BlendingFactorSrc.SrcAlpha, BlendingFactorDest.OneMinusSrcAlpha);

            audioPlayer.Play($"{ContentDirectory}e1m1.ogg", true);
            audioPlayer.Play($"{ContentDirectory}background_sound.ogg", true, 0.5f);
        }
 public UserInterfaceWidget(string path, Vector2 size, Vector2 position)
 {
     texture  = new gfx.Texture2D(path);
     quad     = gfx.VertexBufferFactory.CreateQuad(size.X, size.Y);
     Position = position;
 }
Exemplo n.º 5
0
 public HealthBar()
 {
     ruby      = new gfx.Texture2D($"{ContentDirectory}ruby.png");
     quad      = gfx.VertexBufferFactory.CreateQuad(0.2f, 0.2f);
     PositionX = 0.0f;
 }