コード例 #1
0
ファイル: dropfinal.py プロジェクト: sinistersnare/JythonTalk
def main():

    cfg = LwjglApplicationConfiguration()
    cfg.title = "PyGdx";
    cfg.width = WIDTH
    cfg.height = HEIGHT

    LwjglApplication(DropGame(), cfg)
コード例 #2
0
ファイル: app.py プロジェクト: nenodias/libgdx_jython_example
def main():

    cfg = LwjglApplicationConfiguration()
    cfg.title = "PyGdx";
    cfg.width = 800
    cfg.height = 480

    LwjglApplication(PyGdx(), cfg)
コード例 #3
0
ファイル: Gdx.py プロジェクト: sinistersnare/PyGdx
def main():
    """
    This shouldnt be run, it should be happening from __run__ module.
    """
    cfg = LwjglApplicationConfiguration()
    cfg.title = "PyGdx";
    cfg.width = 800
    cfg.height = 480
    
    LwjglApplication(PyGdx(), cfg)
コード例 #4
0
                for y in range(100):
                    ty = int(Math.random() * len(splitTiles))
                    tx = int(Math.random() * len(splitTiles[ty]))
                    cell = Cell()
                    cell.setTile(StaticTiledMapTile(splitTiles[ty][tx]))
                    layer.setCell(x, y, cell)
            layers.add(layer)

        self.renderer = OrthogonalTiledMapRenderer(self.map)

    def render(self):
        Gdx.gl.glClearColor(100.0 / 255.0, 100.0 / 255.0, 250.0 / 255.0, 1.0)
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT)
        self.camera.update()
        self.renderer.setView(self.camera)
        self.renderer.render()
        self.batch.begin()
        self.font.draw(self.batch,
                       'FPS: ' + str(Gdx.graphics.getFramesPerSecond()), 10,
                       20)
        self.batch.end()


if __name__ == '__main__':
    config = LwjglApplicationConfiguration()
    config.width = 640
    config.height = 480
    config.title = 'Tiled Map Bench Test'
    config.forceExit = False
    LwjglApplication(TiledMapBench(), config)
コード例 #5
0
            bd = BodyDef()
            bd.type = BodyType.DynamicBody
            bd.position.set(-8.0 + 8.0 * i, 12.0)
            body = world.createBody(bd)
            body.createFixture(fd)

            shape.dispose()

        for i in range(2):
            shape = CircleShape()
            shape.setRadius(0.5)

            fd = FixtureDef()
            fd.shape = shape
            fd.density = 1.0

            bd = BodyDef()
            bd.type = BodyType.DynamicBody
            bd.position.set(-6.0 + 6.0 * i, 10.0)
            body = world.createBody(bd)
            body.createFixture(fd)
            shape.dispose()

if __name__ == '__main__':
    config = LwjglApplicationConfiguration()
    config.width = 640
    config.height = 480
    config.title = 'Cantilever Test'
    config.forceExit = False
    LwjglApplication(Cantilever(), config)
コード例 #6
0
        fd.shape = shape
        fd.density = 20.0
        body.createFixture(fd)
        shape.dispose()

        bd = BodyDef()
        bd.position.set(3, 5)
        bd.type = BodyType.DynamicBody
        bd.fixedRotation = True
        bd.allowSleep = False

        body = world.createBody(bd)

        shape = CircleShape()
        shape.setRadius(0.5)

        fd = FixtureDef()
        fd.shape = shape
        fd.density = 20.0
        body.createFixture(fd)
        shape.dispose()


if __name__ == '__main__':
    config = LwjglApplicationConfiguration()
    config.width = 1280
    config.height = 960
    config.title = 'Character Collision Test'
    config.forceExit = False
    LwjglApplication(CharacterCollision(), config)
コード例 #7
0
        instance.transform.setToTranslation(MathUtils.random(-10, 10),
                                            MathUtils.random(-10, 10),
                                            MathUtils.random(-10, 10))
        instance.transform.rotate(Vector3.X, MathUtils.random(-180, 180))
        instance.transform.rotate(Vector3.Y, MathUtils.random(-180, 180))
        instance.transform.rotate(Vector3.Z, MathUtils.random(-180, 180))
        self.instances.append(instance)

    def keyUp(self, keycode):
        if keycode == Keys.SPACE or keycode == Keys.MENU:
            self.onLoaded()
        return super(Benchmark3DTest, self).keyUp(keycode)

    def touchUp(self, screenX, screenY, pointer, button):
        self.onModelClicked(self.models[MathUtils.random(len(self.models) -
                                                         1)])
        return False

    def dispose(self):
        super(Benchmark3DTest, self).dispose()
        GLProfiler.disable()


if __name__ == '__main__':
    config = LwjglApplicationConfiguration()
    config.width = 1280
    config.height = 960
    config.title = 'Benchmark 3D Test'
    config.forceExit = False
    LwjglApplication(Benchmark3DTest(), config)
コード例 #8
0
            elif id.startswith('block'):
                self.blocks.append(instance)
            elif id.startswith('invader'): self.invaders.append(instance)

        self.loading = False

    def render(self):
        if self.loading and self.assets.update(): self.doneLoading()
        self.camController.update()

        Gdx.gl.glViewport(0, 0, Gdx.graphics.getBackBufferWidth(), Gdx.graphics.getBackBufferHeight())
        Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT | GL20.GL_DEPTH_BUFFER_BIT)

        self.modelBatch.begin(self.cam)
        for instance in self.instances:
            self.modelBatch.render(instance, self.lights)
        if self.space: self.modelBatch.render(self.space)
        self.modelBatch.end()

    def dispose(self):
        self.modelBatch.dispose()
        self.assets.dispose()

if __name__ == '__main__':
    config = LwjglApplicationConfiguration()
    config.width = 1280
    config.height = 960
    config.title = 'Basic 3D Scene Test'
    config.forceExit = False
    LwjglApplication(Basic3DSceneTest(), config)