Ejemplo n.º 1
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.º 2
0
 public void EndBigBatch(Blitter b)
 {
     b.ExecuteSubrectBatch(image);
     inBigBatch = false;
 }
Ejemplo n.º 3
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.º 4
0
 public void renderInternal(Blitter b, int x, int y, string str)
 {
     int xstart = x;
     if(!inBigBatch) b.BeginBatch();
     str = str.Replace("\r\n", "\n");
     for(int i = 0;i < str.Length;i++) {
         render_char(b, ref x, ref y, (int)str[i]);
         if(str[i] == '\n') {
             y += 10 * _scale;
             x = xstart;
         }
     }
     if (!inBigBatch) b.ExecuteSubrectBatch(image);
 }