renderNumber() public static method

public static renderNumber ( pr2 img, int x0, int y0, int number, int color ) : void
img pr2
x0 int
y0 int
number int
color int
return void
Esempio n. 1
0
        private void renderZoneLayer(pr2.IRenderImage backBuffer, MapLayer mapLayer, int px, int py)
        {
            int mtx  = px / 16;
            int mty  = py / 16;
            int mtox = px & 15;
            int mtoy = py & 15;

            //we add 2; one for the case where we are scrolled a little bit
            //(and so parts of two tiles are drawn instead of one complete)
            //and one for the case where the screen is a funny size and a remainder bit is shown
            int tw = backBuffer.Width / 16 + 2;
            int th = backBuffer.Height / 16 + 2;

            int layerWidth  = mapLayer.Width;
            int layerHeight = mapLayer.Height;
            int cpx         = -mtox;
            int cpy         = -mtoy;

            tw = System.Math.Min(tw, layerWidth - mtx);
            th = System.Math.Min(th, layerHeight - mty);

            int tp;
            int tile;
            int xmin = -mtox;
            int xmax = xmin + tw * 16;

            const int WHITE = unchecked ((int)0xFFFFFFFF);

            short[] tileMap = mapLayer.Data;
            for (int ty = 0; ty < th; ty++, cpy += 16)
            {
                tp = (ty + mty) * layerWidth + mtx;
                if (Global.RenderOptions.bTranslucentEffects)
                {
                    for (cpx = xmin; cpx < xmax; cpx += 16)
                    {
                        if ((tile = tileMap[tp++]) != 0)
                        {
                            Render.renderColoredTile_50Alpha(backBuffer, cpx, cpy, Preferences.Current.ZonesColor);
                            Render.renderNumber(backBuffer, cpx, cpy, tile, WHITE);
                        }
                    }
                }
                else
                {
                    for (cpx = xmin; cpx < xmax; cpx += 16)
                    {
                        if ((tile = tileMap[tp++]) != 0)
                        {
                            Render.renderColoredTile(backBuffer, cpx, cpy, Preferences.Current.ZonesColor);
                            Render.renderNumber(backBuffer, cpx, cpy, tile, WHITE);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        private void renderEntities(pr2.IRenderImage backBuffer, MapLayer ml, int px, int py)
        {
            int mtx  = px / 16;
            int mty  = py / 16;
            int mtox = px & 15;
            int mtoy = py & 15;
            int tw   = backBuffer.Width / 16 + 2;
            int th   = backBuffer.Height / 16 + 2;

            foreach (MapEntity me in ParentMap.Entities)
            {
                int tx = me.TileX;
                int ty = me.TileY;

                if (tx >= mtx && tx <= mtx + tw && ty >= mty && ty <= mty + th)
                {
                    int cx = -mtox + (tx - mtx) * 16;
                    int cy = -mtoy + (ty - mty) * 16;
                    Render.renderColoredTile_50Alpha(backBuffer, cx, cy, Preferences.Current.EntsColor);
                    Render.renderNumber(backBuffer, cx + 4, cy + 4, me.ID, unchecked ((int)0xFFFFFFFF));
                }
            }
        }