示例#1
0
    def InitSystem(self):
        self.Resources = Resources
        self.windowWidth = int(
            GetAttribute(self.ConfigPath, "Window", "windowWidth"))
        self.windowHeight = int(
            GetAttribute(self.ConfigPath, "Window", "windowHeight"))
        self.windowTitle = GetAttribute(self.ConfigPath, "Window",
                                        "windowTitle")

        self.window = window.CreateWindow(self.windowWidth, self.windowHeight,
                                          "Title")
        self.InputManager = InputManager()
        self.InputManager.SetCallback(self.window)

        Resources.LoadShader("/Shaders/VS2D2.vs", "/Shaders/FS2D.fs", "Shader")
        Resources.LoadShader("/Shaders/VS2D2.vs", "/Shaders/FS2D2.fs",
                             "ShaderV2")
        Resources.LoadShader("/Shaders/ParticleVS.vs",
                             "/Shaders/ParticleFS.fs", "ParticleShader")
        # Resources.LoadShader("/Shaders/BatchRenderVS2D.vs",
        #                      "/Shaders/BatchRenderFS2D.fs", "BatchShader")

        self.SpriteRenderer = SpriteRender(Resources.Shaders["Shader"])
        self.SpriteRenderer.initRenderer()

        self.Camera = Camera2D(0.0, self.windowWidth, self.windowHeight, 0.0)
        self.Camera.update(0.0, 0.0, 0.0)
        # projection = glm.ortho(0.0, self.windowWidth, self.windowHeight, 0.0, -1.0, 1.0)

        glUniformMatrix4fv(
            glGetUniformLocation(Resources.Shaders["Shader"].ID, "projection"),
            1, GL_FALSE, glm.value_ptr(self.Camera.VP))
示例#2
0
 def LoadShaderToResources(VertexShaderFile, FragmentShaderFile, key):
     if key in Resources.Shaders:
         pass
     else:
         Resources.LoadShader(VertexShaderFile, FragmentShaderFile, key)