Example #1
0
        protected virtual void DrawXNA(float totalSeconds)
        {
            GLEx gl = process.GL;

            if (gl != null)
            {

                if (!process.Next())
                {
                    return;
                }

                if (isScale)
                {
                    gl.Scale(LSystem.scaleWidth,
                            LSystem.scaleHeight);
                }

                int repaintMode = process.GetRepaintMode();

                switch (repaintMode)
                {
                    case Screen.SCREEN_BITMAP_REPAINT:
                        gl.Reset(clear);
                        if (process.GetX() == 0 && process.GetY() == 0)
                        {
                            gl.DrawTexture(process.GetBackground(), 0, 0);
                        }
                        else
                        {
                            gl.DrawTexture(process.GetBackground(), process.GetX(),
                                    process.GetY());
                        }
                        break;
                    case Screen.SCREEN_COLOR_REPAINT:
                        LColor c = process.GetColor();
                        if (c != null)
                        {
                            gl.DrawClear(c);
                        }
                        break;
                    case Screen.SCREEN_CANVAS_REPAINT:
                        gl.Reset(clear);
                        break;
                    case Screen.SCREEN_NOT_REPAINT:
                        gl.Reset(clear);
                        break;
                    default:
                        gl.Reset(clear);
                        if (process.GetX() == 0 && process.GetY() == 0)
                        {
                            gl.DrawTexture(
                                    process.GetBackground(),
                                    repaintMode / 2
                                            - LSystem.random.Next(repaintMode),
                                    repaintMode / 2
                                            - LSystem.random.Next(repaintMode));
                        }
                        else
                        {
                            gl.DrawTexture(process.GetBackground(),
                                    process.GetX() + repaintMode / 2
                                            - LSystem.random.Next(repaintMode),
                                    process.GetY() + repaintMode / 2
                                            - LSystem.random.Next(repaintMode));
                        }
                        break;
                }

                process.Draw();

                process.Drawable(elapsedTime);

                if (isFPS)
                {
                    gl.Reset(false);

                    framecount++;
                    timeSinceLastUpdate += totalSeconds;
                    if (timeSinceLastUpdate > updateInterval)
                    {
                        frameRate = Convert.ToInt16(framecount / timeSinceLastUpdate);
                        framecount = 0;
                        timeSinceLastUpdate -= updateInterval;

                    }

                    fps = string.Format(numformat, "FPS:{0}", frameRate);

                    if (gl.UseFont)
                    {
                        gl.DrawString(fps, 5, 5, LColor.white);
                    }
                    else
                    {
                        if (XNAConfig.IsActive() && font == null)
                        {
                            font = XNAConfig.LoadFnt(LSystem.FRAMEWORK_IMG_NAME+"system");
                        }
                        if (font != null)
                        {
                            font.DrawBatchString(5, 5, fps, LColor.white);
                        }
                    }
                }
                process.DrawEmulator();

                gl.RestoreMatrix();

            }
        }
Example #2
0
 public static BMFont LoadFnt(string name)
 {
     VaildLoon();
     string newName = FileUtils.GetNoExtensionName(name);
     BMFont font = (BMFont)CollectionUtils.Get(fontCaches, name);
     if (font == null || font.IsClose())
     {
         Stream fnt = ResourceManager.GetStream(name + ".fnt");
         Stream img = ResourceManager.GetStream(name + ".png");
         font = new BMFont(fnt, img);
         fontCaches.Add(name, font);
     }
     return font;
 }
Example #3
0
 public CharDef(BMFont f)
 {
     this.font = f;
 }
Example #4
0
 public CharDef(BMFont f)
 {
     this.font=f;
 }
Example #5
0
 public CharDef(BMFont font)
 {
     _font = font;
 }
Example #6
0
 public CharDef(BMFont font)
 {
     _font = font;
 }