Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- # -*- coding: utf-8 -*-
- import cengine
- game = None
- camera = None
- class CustomEntity(ModelEntity):
- model = None
- texture = None
- shader = None
- material = None
- def step(self):
- pass
- def prepare(self):
- self.texture.load()
- def __init__(self):
- # Set texture
- self.texture = Texture("game/textures/mytexture.png")
- # Shader name/type, not path
- self.shader = Shader("texturedpoly")
- # Create Material, combination of shader & texture
- self.material = Material(self.texture, self.shader)
- def step():
- x = 0
- y = 0
- z = 0
- my_custom_entity.set_position(x, y, z)
- def render():
- my_custom_entity.render()
- def main():
- game = Game()
- game.init("Window Title", 1280, 720);
- my_custom_entity = CustomEntity()
- # game.entity_manager: add, remove, get
- game.entity_manager.add(my_custom_entity, "")
- game.set_step_func(step);
- game.set_render_func(render);
- camera = game.get_camera()
- game.start();
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement