void TextureChanged(object sender, TextureEventArgs e)
 {
     if (Utils.CaselessEq(e.Name, "particles.png"))
     {
         game.LoadTexture(ref ParticlesTexId, e.Name, e.Data);
     }
 }
Пример #2
0
        void TextureChangedCore(object sender, TextureEventArgs e)
        {
            byte[] data = e.Data;
            if (e.Name == "terrain.png")
            {
                MemoryStream stream = new MemoryStream(data);
                Bitmap       atlas  = Platform.ReadBmp(stream);
                if (ChangeTerrainAtlas(atlas, null))
                {
                    return;
                }
                atlas.Dispose();
            }
            else if (e.Name == "cloud.png" || e.Name == "clouds.png")
            {
                UpdateTexture(ref CloudsTex, e.Name, data, false);
            }
            else if (e.Name == "default.png")
            {
                MemoryStream stream = new MemoryStream(data);
                Bitmap       bmp    = Platform.ReadBmp(stream);
                if (!Platform.Is32Bpp(bmp))
                {
                    Drawer2D.ConvertTo32Bpp(ref bmp);
                }

                Drawer2D.SetFontBitmap(bmp);
                Events.RaiseChatFontChanged();
            }
        }
Пример #3
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "cloud.png" || e.Name == "clouds.png")
     {
         game.UpdateTexture(ref cloudsTex, e.Name, e.Data, false);
     }
 }
Пример #4
0
        private void TextureChanged(object sender, TextureEventArgs textureDataEventArgs)
        {
            if (!_identifierToTextureHandleDictionary.TryGetValue(textureDataEventArgs.Texture.SessionUniqueIdentifier,
                                                                  out ITextureHandle toBeUpdatedTextureHandle))
            {
                throw new KeyNotFoundException("Texture is not registered.");
            }

            ITextureBase texture = textureDataEventArgs.Texture;

            switch (textureDataEventArgs.ChangedEnum)
            {
            case TextureChangedEnum.Disposed:
                // Add the TextureHandle to the toBeDeleted Stack...
                _toBeDeletedTextureHandles.Push(toBeUpdatedTextureHandle);
                // remove the TextureHandle from the dictionary, the TextureHandle data now only resides inside the gpu and will be cleaned up on bottom of Render(Mesh mesh)
                _identifierToTextureHandleDictionary.Remove(texture.SessionUniqueIdentifier);
                // add the identifier to the reusable identifiers stack
                //_reusableIdentifiers.Push(textureDataEventArgs.Texture.Identifier);
                break;

            case TextureChangedEnum.RegionChanged:
                //TODO: An IWritableTexture has no implementation of UpdateTextureRegion (yet)
                if (texture is ITexture iTexture)
                {
                    _renderContextImp.UpdateTextureRegion(toBeUpdatedTextureHandle, iTexture,
                                                          textureDataEventArgs.XStart, textureDataEventArgs.YStart, textureDataEventArgs.Width,
                                                          textureDataEventArgs.Height);
                }
                break;
            }
        }
Пример #5
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "particles.png")
     {
         game.UpdateTexture(ref ParticlesTexId, e.Name, e.Data, false);
     }
 }
Пример #6
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (Utils.CaselessEq(e.Name, "clouds.png"))
     {
         game.LoadTexture(ref cloudsTex, e.Name, e.Data);
     }
 }
Пример #7
0
        void TextureChanged(object sender, TextureEventArgs e)
        {
            switch (e.Name)
            {
            case "chicken.png":
                game.UpdateTexture(ref ChickenTexId, e.Data, false); break;

            case "creeper.png":
                game.UpdateTexture(ref CreeperTexId, e.Data, false); break;

            case "pig.png":
                game.UpdateTexture(ref PigTexId, e.Data, false); break;

            case "sheep.png":
                game.UpdateTexture(ref SheepTexId, e.Data, false); break;

            case "skeleton.png":
                game.UpdateTexture(ref SkeletonTexId, e.Data, false); break;

            case "spider.png":
                game.UpdateTexture(ref SpiderTexId, e.Data, false); break;

            case "zombie.png":
                game.UpdateTexture(ref ZombieTexId, e.Data, false); break;

            case "sheep_fur.png":
                game.UpdateTexture(ref SheepFurTexId, e.Data, false); break;

            case "char.png":
                game.UpdateTexture(ref HumanoidTexId, e.Data, true); break;
            }
        }
Пример #8
0
        void TextureChanged(object sender, TextureEventArgs e)
        {
            return;             //because I'm trying to test using only the env colors

            if (e.Name != "lightmap.png")
            {
                return;
            }

            using (MemoryStream ms = new MemoryStream(e.Data))
                using (Bitmap bmp = Platform.ReadBmp(ms))
                {
                    if (bmp.Width != lightExtent || bmp.Height != lightExtent)
                    {
                        game.Chat.Add("&clightmap.png must be " + lightExtent + "x" + lightExtent + "."); return;
                    }

                    // Not bothering with FastBitmap here as perf increase is insignificant.
                    for (int y = 0; y < lightExtent; y++)
                    {
                        for (int x = 0; x < lightExtent; x++)
                        {
                            Color col = bmp.GetPixel(x, y);
                            SetLightmap(x, y, new FastColour(col));
                        }
                    }
                }
            game.MapRenderer.Refresh();
        }
Пример #9
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "skybox.png")
     {
         game.UpdateTexture(ref tex, e.Name, e.Data, false);
     }
     else if (e.Name == "useclouds")
     {
         game.World.Env.SkyboxClouds = true;
     }
 }
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "snow.png")
     {
         game.UpdateTexture(ref SnowTexId, e.Data, false);
     }
     else if (e.Name == "rain.png")
     {
         game.UpdateTexture(ref RainTexId, e.Data, false);
     }
 }
Пример #11
0
        void TextureChangedCore(object sender, TextureEventArgs e)
        {
            if (!(e.Name == "cloud.png" || e.Name == "clouds.png"))
            {
                return;
            }

            using (Bitmap bmp = Platform.ReadBmp32Bpp(game.Drawer2D, e.Data))
                using (FastBitmap fastBmp = new FastBitmap(bmp, true, true))
                {
                    CalcClouds(fastBmp);
                }
        }
Пример #12
0
        void TextureChanged(object sender, TextureEventArgs e)
        {
            for (int i = 0; i < Textures.Count; i++)
            {
                CachedTexture tex = Textures[i];
                if (tex.Name != e.Name)
                {
                    continue;
                }

                game.UpdateTexture(ref tex.TexID, e.Name, e.Data, e.Name == "char.png");
                Textures[i] = tex; break;
            }
        }
Пример #13
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "animations.png" || e.Name == "animation.png")
     {
         MemoryStream stream = new MemoryStream(e.Data);
         SetAtlas(Platform.ReadBmp(stream));
     }
     else if (e.Name == "animations.txt" || e.Name == "animation.txt")
     {
         MemoryStream stream = new MemoryStream(e.Data);
         StreamReader reader = new StreamReader(stream);
         ReadAnimationsDescription(reader);
     }
 }
Пример #14
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (Utils.CaselessEq(e.Name, "gui.png"))
     {
         game.LoadTexture(ref GuiTex, e.Name, e.Data);
     }
     else if (Utils.CaselessEq(e.Name, "gui_classic.png"))
     {
         game.LoadTexture(ref GuiClassicTex, e.Name, e.Data);
     }
     else if (Utils.CaselessEq(e.Name, "icons.png"))
     {
         game.LoadTexture(ref IconsTex, e.Name, e.Data);
     }
 }
Пример #15
0
        void TextureChanged(object sender, TextureEventArgs e)
        {
            for (int i = 0; i < Textures.Count; i++)
            {
                CachedTexture tex = Textures[i];
                if (!Utils.CaselessEq(tex.Name, e.Name))
                {
                    continue;
                }

                game.UpdateTexture(ref tex.TexID, e.Name, e.Data, ref tex.SkinType);
                Textures[i] = tex;
                break;
            }
        }
Пример #16
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "gui.png")
     {
         game.UpdateTexture(ref GuiTex, e.Name, e.Data, false);
     }
     else if (e.Name == "gui_classic.png")
     {
         game.UpdateTexture(ref GuiClassicTex, e.Name, e.Data, false);
     }
     else if (e.Name == "icons.png")
     {
         game.UpdateTexture(ref IconsTex, e.Name, e.Data, false);
     }
 }
Пример #17
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name != "char.png")
     {
         return;
     }
     for (int i = 0; i < Players.Length; i++)
     {
         if (Players[i] == null || Players[i].TextureId != -1)
         {
             continue;
         }
         Players[i].SkinType = game.DefaultPlayerSkinType;
     }
 }
Пример #18
0
 void TextureChanged(object sender, TextureEventArgs e)
 {
     if (e.Name == "animations.png" || e.Name == "animation.png")
     {
         animBmp     = Platform.ReadBmp32Bpp(game.Drawer2D, e.Data);
         animsBuffer = new FastBitmap(animBmp, true, true);
     }
     else if (e.Name == "animations.txt" || e.Name == "animation.txt")
     {
         MemoryStream stream = new MemoryStream(e.Data);
         StreamReader reader = new StreamReader(stream);
         ReadAnimationsDescription(reader);
     }
     else if (e.Name == "uselavaanim")
     {
         useLavaAnim = true;
     }
     else if (e.Name == "usewateranim")
     {
         useWaterAnim = true;
     }
 }
Пример #19
0
 void TextureChangedCore(object sender, TextureEventArgs e)
 {
     byte[] data = e.Data;
     if (e.Name == "terrain.png")
     {
         Bitmap atlas = Platform.ReadBmp32Bpp(Drawer2D, data);
         if (ChangeTerrainAtlas(atlas))
         {
             return;
         }
         atlas.Dispose();
     }
     else if (e.Name == "cloud.png" || e.Name == "clouds.png")
     {
         UpdateTexture(ref CloudsTex, e.Name, data, false);
     }
     else if (e.Name == "default.png")
     {
         Bitmap bmp = Platform.ReadBmp32Bpp(Drawer2D, data);
         Drawer2D.SetFontBitmap(bmp);
         Events.RaiseChatFontChanged();
     }
 }
Пример #20
0
 void TextureChanged( object sender, TextureEventArgs e )
 {
     if( e.Name == "animations.png" || e.Name == "animation.png" ) {
         MemoryStream stream = new MemoryStream( e.Data );
         SetAtlas( Platform.ReadBmp( stream ) );
     } else if( e.Name == "animations.txt" || e.Name == "animation.txt" ) {
         MemoryStream stream = new MemoryStream( e.Data );
         StreamReader reader = new StreamReader( stream );
         ReadAnimationsDescription( reader );
     }
 }
Пример #21
0
 void TextureChanged( object sender, TextureEventArgs e )
 {
     if( e.Name == "skybox.png" )
         game.UpdateTexture( ref tex, e.Data, false );
 }
Пример #22
0
 void TextureChanged( object sender, TextureEventArgs e )
 {
     switch( e.Name ) {
         case "chicken.png":
             game.UpdateTexture( ref ChickenTexId, e.Data, false ); break;
         case "creeper.png":
             game.UpdateTexture( ref CreeperTexId, e.Data, false ); break;
         case "pig.png":
             game.UpdateTexture( ref PigTexId, e.Data, false ); break;
         case "sheep.png":
             game.UpdateTexture( ref SheepTexId, e.Data, false ); break;
         case "skeleton.png":
             game.UpdateTexture( ref SkeletonTexId, e.Data, false ); break;
         case "spider.png":
             game.UpdateTexture( ref SpiderTexId, e.Data, false ); break;
         case "zombie.png":
             game.UpdateTexture( ref ZombieTexId, e.Data, false ); break;
         case "sheep_fur.png":
             game.UpdateTexture( ref SheepFurTexId, e.Data, false ); break;
         case "char.png":
             game.UpdateTexture( ref HumanoidTexId, e.Data, true ); break;
     }
 }
Пример #23
0
 void TextureChanged( object sender, TextureEventArgs e )
 {
     if( e.Name != "char.png" ) return;
     for( int i = 0; i < Players.Length; i++ ) {
         if( Players[i] == null || Players[i].TextureId != -1 ) continue;
         Players[i].SkinType = game.DefaultPlayerSkinType;
     }
 }
Пример #24
0
 void TextureChanged( object sender, TextureEventArgs e )
 {
     if( e.Name == "snow.png" ) {
         game.UpdateTexture( ref SnowTexId, e.Data, false );
     } else if( e.Name == "rain.png" ) {
         game.UpdateTexture( ref RainTexId, e.Data, false );
     }
 }