Ejemplo n.º 1
0
        private void renderLayer(bool bBottom, int xo, int yo, Map.TileLayer l, Blitter b)
        {
            int oxw = (int)((float)xo * l.parallax.X);
            int oyw = (int)((float)yo * l.parallax.Y);
            int xofs = -(oxw & 15);
            int yofs = -(oyw & 15);
            int xtc = oxw >> 4;
            int ytc = oyw >> 4;

            int tw = (b.width >> 4) + 2;
            int th = (b.height >> 4) + 2;

            b.BeginBatch();
            b.PushAlpha((float)((100 - (float)l.lucent) / 100.0));

            if(bBottom)
                for(int y = 0; y < th; y++)
                    for(int x = 0; x < tw; x++) {
                        int t = l.getTile(x + xtc, y + ytc);
                        if(t == 0) continue;
                        if(t == -1) {
                            if(fillLayer != null) {
                                t = fillLayer[(fillLayer.height + ((y + ytc) % fillLayer.height)) % fillLayer.height,
                                            (fillLayer.width + ((x + xtc) % fillLayer.width)) % fillLayer.width];
                            } else continue;
                        }

                        // Overkill: Takes animations into account.
                        t = m.vsp.tileIndex[t];

                        b.BlitSubrectBatched(m.vsp.tiles, (t & 127) << 4, ((t >> 7) << 4), 16, 16, xofs + x * 16, yofs + y * 16);
                    } else
                for(int y = 0; y < th; y++)
                    for(int x = 0; x < tw; x++) {
                        int t = l.getTile(x + xtc, y + ytc);
                        if(t < 1) continue;

                        // Overkill: Takes animations into account.
                        t = m.vsp.tileIndex[t];

                        b.BlitSubrectBatched(m.vsp.tiles, (t & 127) << 4, ((t >> 7) << 4), 16, 16, xofs + x * 16, yofs + y * 16);
                    }

            b.ExecuteSubrectBatch(m.vsp.tiles);
            b.PopAlpha();
        }
Ejemplo n.º 2
0
        public unsafe override void Render(Blitter b, int x, int y, string str)
        {
            b.BeginBatch();

            Image img = font.image;

            FontDefinition.Character[] characters = font.fontDefinition.characters;
            foreach (char c in EnumerateCharacters(str))
            {
                int n = (int)c;
                if (c == ' ') x += spaceSize;
                else
                {
                    int dx = x - characters[n].vx;
                    int dy = y - characters[n].vy;
                    b.BlitSubrectBatched(img, characters[n].x, characters[n].y, characters[n].w, characters[n].h, dx, dy);

                    x += characters[n].vw;
                    x += spacing;
                }
            }

            b.ExecuteSubrectBatch(img);
        }
Ejemplo n.º 3
0
 void render_char(Blitter b, ref int x, ref int y, int c)
 {
     if(c < 32) return;
     c -= 32;
     if(c < 0 || c > 96) c = 2;
     b.BlitSubrectBatched(image, rects[c], x, y);
     x += CharSize(c) * _scale;
     if(c == '*' - 32) x -= _scale;
 }