Exemple #1
0
 public void SetShowLogo(bool showLogo)
 {
     LSystem.isLogo = showLogo;
     if (logoFlag == null)
     {
         SetLogo(XNAConfig.LoadTex(LSystem.FRAMEWORK_IMG_NAME + "logo.png"));
     }
 }
Exemple #2
0
 public void SetShowLogo(bool showLogo)
 {
     LSystem.isLogo = showLogo;
     if (logoFlag == null)
     {
         SetLogo(XNAConfig.LoadTexture("logo.png"));
     }
 }
Exemple #3
0
        public LFXPlus()
            : base()
        {
            numformat = new NumberFormatInfo();
            numformat.NumberDecimalSeparator = ".";

            XNAConfig.Load();

            Content.RootDirectory = "";
            content = Content;
            if (useXNAListener)
            {
                xna_listener.Create(this);
            }
            log.I("LGame 2D Engine Start");
            XNA_Graphics_Loading();
            OnMain();
        }
Exemple #4
0
 public void Register(LSetting setting, Type clazz,
                      params object[] args)
 {
     XNAConfig.Load();
     MaxScreen(setting.width, setting.height);
     Initialization(setting.landscape, setting.mode);
     SetShowFPS(setting.showFPS);
     SetShowMemory(setting.showMemory);
     SetShowLogo(setting.showLogo);
     SetFPS(setting.fps);
     if (clazz != null)
     {
         if (args != null)
         {
             try
             {
                 int funs = args.Length;
                 if (funs == 0)
                 {
                     SetScreen((Screen)JavaRuntime.NewInstance(clazz));
                     ShowScreen();
                 }
                 else
                 {
                     Type[] functions = new Type[funs];
                     for (int i = 0; i < funs; i++)
                     {
                         functions[i] = GetType(args[i]);
                     }
                     System.Reflection.ConstructorInfo constructor = JavaRuntime.GetConstructor(clazz, functions);
                     Object o = JavaRuntime.Invoke(constructor, args);
                 }
             }
             catch (Exception ex)
             {
                 Log.Exception(ex);
             }
         }
     }
 }
Exemple #5
0
 public void GameDestory()
 {
     log.I("LGame 2D Engine Shutdown");
     try
     {
         isClose = true;
         if (process != null)
         {
             process.OnDestroy();
         }
         if (content != null)
         {
             content.Unload();
             content = null;
         }
         XNAConfig.Dispose();
         Exit();
     }
     catch
     {
     }
 }
Exemple #6
0
 public void Destory()
 {
     log.I("LGame 2D Engine Shutdown");
     isClose = true;
     XNAConfig.Dispose();
     useXNAListener = false;
     if (this.sl_listener != null)
     {
         this.sl_listener.Dispose(GamePage, true);
         this.sl_listener = null;
     }
     if (UIElementRenderer != null)
     {
         UIElementRenderer.Dispose();
         UIElementRenderer = null;
     }
     if (content != null)
     {
         content.Unload();
         content = null;
     }
 }
Exemple #7
0
 public void FinishApp()
 {
     if (!LSystem.isDestroy)
     {
         lock (this.m_sync)
         {
             LSystem.isRunning = false;
             LSystem.isDestroy = true;
             if (LSystem.screenProcess != null)
             {
                 LSystem.screenProcess.OnDestroy();
                 ActionControl.GetInstance().StopAll();
             }
             XNAConfig.Dispose();
             if (fpsFont != null)
             {
                 fpsFont.Dispose();
                 fpsFont = null;
             }
         }
         Printf("finishApp");
     }
 }
Exemple #8
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();
            }
        }