w() 공개 정적인 메소드

A warning to all those who cross me!
public static w ( string warning ) : void
warning string What it is that's got you so worked up
리턴 void
예제 #1
0
        /// <summary>
        /// Either changes the name of an existing texture (and it's entry in the global
        /// texture array), or creates a new texture sharing the data of the existing one
        /// but with a different name. (Bitmap object and GL graphics memory is shared.)
        ///
        /// This call is NOT necessary in ordinary usage! EVERY Texture gets put in the global
        /// texture array once created, even if the name assigned is just a Guid.
        /// </summary>
        /// <param name="name"></param>
        /// <param name="texture"></param>
        /// <param name="makeCopy"></param>
        /// <remarks>ALL Textures already exist in the global texture array!
        /// This call is NOT necessary in ordinary Texture usage!
        /// Textures created using the new Texture(Bitmap) constructor have a GUID assigned.</remarks>
        public static void SetTexture(string name, Texture texture, bool makeCopy)
        {
            name = name.ToLower();

            lock (textures)
            {
                Texture t;

                if (makeCopy)
                {
                    // Copy the bastard, and change the name.
                    t            = new Texture();
                    t.bitmap     = texture.bitmap;
                    t.TexPointer = texture.TexPointer;
                    t.Filename   = name;

                    if (textures.Keys.Contains(name))
                    {
                        Log.w("A texture with name '" + name + "' is already present - replacing.");
                        textures.Remove(name);
                    }
                }
                else
                {
                    textures.Remove(texture.Filename);
                    texture.Filename = name;
                    t = texture;
                }

                if (textures.ContainsKey(name))
                {
                    textures.Remove(name);
                    Log.v("Replacing texture '" + name + "' with new one. This is rarely"
                          + " a good thing.");
                }
                textures.Add(name, t);
            }
        }
예제 #2
0
파일: Log.cs 프로젝트: SpydazWebAI/nes
 /// <summary>
 /// A warning to all those who cross me!
 /// </summary>
 /// <param name="warning">What it is that's got you so worked up</param>
 /// <param name="format">Formatting shizz.</param>
 public static void w(string warning, params object[] format)
 {
     Log.w(String.Format(warning, format));
 }
예제 #3
0
파일: Graphics.cs 프로젝트: SpydazWebAI/nes
        private static int chkt = 0; // used so we don't update the FPS reading constantly

        public static void Render()
        {
            DateTime dtStart = DateTime.Now;

            // Gl blah blah
            lock (RenderLockBlob)
            {
                int gerr = Gl.glGetError();

                if (gerr != 0)
                {
                    Log.w("glGetError():: " + Glu.gluErrorString(gerr));
                }

                // How inefficient is this?
                // (not rhetorical question, seriously -- does it matter?)
                int WindowWidth, WindowHeight;
                Glfw.glfwGetWindowSize(out WindowWidth, out WindowHeight);
                Gl.glViewport(0, 0, WindowWidth, WindowHeight);

                // clear background (no, really?)
                Gl.glClearColor(((float)backgroundColor.R) / 255f,
                                ((float)backgroundColor.G / 255f),
                                ((float)backgroundColor.B / 255f), ((float)backgroundColor.A / 255f));
                Gl.glClearDepth(double.MinValue);
                Gl.glClear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT);

                // Set-up the modelview matrix again.
                Gl.glMatrixMode(Gl.GL_MODELVIEW);
                Gl.glLoadIdentity();

                Gl.glScalef(Camera.Zoom, Camera.Zoom, 1f);
                Gl.glTranslatef(-Camera.Position.X, -Camera.Position.Y, 0f);
                Gl.glRotatef(-Camera.Angle, 0f, 0f, 1f);

                lock (Renderables)
                {
                    Texture.DoDeferredTextureOperations();

                    // ...Because depth testing can't cut it with alpha blending. :(
                    if (renderableListNeedsSorting)
                    {
                        Log.v("SORTING.");
                        renderableListNeedsSorting = false;
                        DateTime dtSortStart = DateTime.Now;
                        Renderables.Sort(new Comparison <Renderable>(compareRenderablesDepths));
                        Log.v("R.Sort took " + (DateTime.Now - dtSortStart).TotalMilliseconds.ToString()
                              + "ms.");

                        // Unsurprisingly, this operation can get slow. :p
                        // Could write an O(n) version, cba!
                        if (PerformSlowDebugDepthChecking)
                        {
                            DateTime dtCheckStart = DateTime.Now;
                            foreach (Renderable r1 in Renderables)
                            {
                                foreach (Renderable r2 in Renderables)
                                {
                                    checkForDepthProblems(r1, r2);
                                }
                            }
                            Log.v("checkForDepthProblems took " + (DateTime.Now - dtCheckStart)
                                  .TotalMilliseconds.ToString() + "ms.");
                        }
                    }

                    foreach (Renderable r in Renderables)
                    {
                        r.Render();
                    }
                }

                Glfw.glfwSwapBuffers();
                Glfw.glfwPollEvents();

                DateTime dtEnd = DateTime.Now;

                chkt++;

                if (chkt >= 60)
                {
                    chkt = 0;
                    //Log.i((dtEnd - dtStart).TotalMilliseconds.ToString() + "ms to render");
                }

                //Thread.Sleep(EatCPU ? 0 : 30);
            }

            // This is here, as we don't want a callback and the loop trying to lock stuff.
            // Run stuff that needs to be in graphics thread
            //handleCallbacks();
        }