파이썬 게임 015. pygame의 게임 화면 크기 (display size)
pygame.display.list_modes()를 이용해 사용 가능한 게임 화면 크기를 확인할 수 있다. 아래의 화면 크기는 사용하는 컴퓨터 환경에 따라 다를 수 있다. size = ( 320, 200) size = ( 320, 240) size = ( 400, 300) size = ( 512, 384) size = ( 640, 400) size = ( 640, 480) size = ( 800, 600) size = (1024, 768) size = (1152, 864) size = (1280, 600) size = (1280, 720) size = (1280, 768) size = (1280, 800) size = (1280, 960) size = (1280, 1024) size = (1360, 76..
파이썬 게임 013. Pygame Documentation Summary
아래 내용은 Pygame 2.x Documentation을 기준으로 한다. pygame Top level pygame package pygame.get_init() -> bool pygame.get_sdl_version() -> (major, minor, patch) pygame.init() -> (numpass, numfail) pygame.quit() -> None pygame.Color pygame object for color representations Color(r, g, b) -> Color Color(r, g, b, a=255) -> Color Color(color_value) -> Color color_value: pygame.Color str or tuple or list (r, g, ..
파이썬 게임 011. pygame.draw 모듈로 그외 도형 그리기 (타원, 다각형, 타원호)
pygame.draw.ellipse() 함수, pygame.draw.polygon() 함수, pygame.draw.arc() 함수를 이용해 타원, 다각형 및 타원호를 그려본다. 본 글에서 사용하는 기능 및 참고되는 기능에 대한 정의는 다음과 같다. pygame.draw.ellipse(surface, color, rect, width=0) -> Rect pygame.draw.polygon(surface, color, points, width=0) -> Rect pygame.draw.arc(surface, color, rect, start_angle, stop_angle, width=1) -> Rect 그외 도형 그리기 (ellipse, polygon, arc) # python 3.9.6 # pygame 2..
파이썬 게임 010. pygame.draw.circle 함수로 원 그리기
pygame.draw.circle() 함수로 원을 그려본다. 본 글에서 사용하는 기능 및 참고되는 기능에 대한 정의는 다음과 같다. pygame.draw.circle(surface, color, center, radius, width=0, draw_top_right=None, draw_top_left=None, draw_bottom_left=None, draw_bottom_right=None) -> Rect pygame.draw.circle() 함수로 원 그리기 # python 3.9.6 # pygame 2.0.1 import pygame BLACK = (0, 0, 0) WHITE = (255, 255, 255) RED = (255, 0, 0) GREEN = (0, 255, 0) BLUE = (0, 0,..
파이썬 게임 009. pygame.draw.rect 함수로 사각형 그리기
pygame.draw.rect() 함수로 사각형을 그려본다. 본 글에서 사용하는 기능 및 참고되는 기능에 대한 정의는 다음과 같다. pygame.draw.rect(surface, color, rect, width=0, border_radius=0, border_top_left_radius=-1, border_top_right_radius=-1, border_bottom_left_radius=-1, border_bottom_right_radius=-1) -> Rect pygame.event.custom_type() -> int pygame.time.set_timer(eventid, milliseconds) -> None pygame.time.set_timer(eventid, milliseconds, onc..