GithubHelp home page GithubHelp logo

camera's Introduction

camera

Variáveis da Câmera

position

  • Dict com duas chaves, x e y, que representam a posição da câmera

anchorPoint

  • Dict com duas chaves, x e y, que representam o ponto de ancoragem da câmera (positionX + (width * anchorX)) (positionY + (height * anchorY))

GLOBAL_DRAW

  • Variável para definir o tipo de desenho global, com os calculos de câmera aplicados

SCREEN_DRAW

  • Tipo de desenho na tela, sem os calculos de câmera, serve para elementos estáticos

Métodos da Câmera

relative(x, y)

import pygame
from camera import Camera

pygame.init()

camera = Camera(pygame)
clock = pygame.time.Clock()
screen = pygame.display.set_mode([600, 300])

camera.anchorPoint["x"] = 0.5 # Set X camera point to center
camera.anchorPoint["y"] = 0.5 # Set Y camera point to center

running = True

COLOR = (0, 255, 0)
POSITION = (0, 0)

while running:
  for event in pygame.event.get():
    if event.type == pygame.QUIT:
      running = False

  print(pygame.camera == camera) # True
  pygame.draw.circle(screen, camera.GLOBAL_DRAW, COLOR, POSITION)
  
  pygame.display.update()
  
  clock.tick(30)

pygame.quit()

camera's People

Contributors

gustavo10destroyer avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.