E D R , A S I H C RSS

Py Game

SDL 라이브러리λ₯Ό μ΄μš©ν•΄μ„œ λ§Œλ“  κ²Œμž„κ°œλ°œμš© Python λͺ¨λ“ˆ.
μ‚¬μš©ν•˜κΈ° 정말 쉽닀. Python Interpreter μ—μ„œ ν•œμ€„ ν•œμ€„ μž…λ ₯ν•˜λ©΄μ„œ 곡뢀할 μˆ˜λ„ μžˆλ‹€.

λ°κΈ°λŠ” PyGame 을 μ΄μš©ν•΄μ„œ 3D Viewing System 을 λ§Œλ“ λ°” μžˆλ‹€.



pygame.Surface λ₯Ό 상속받은 μƒˆ 클래슀λ₯Ό λ§Œλ“€ μˆ˜κ°€ μ—†λ‹€. μ΄μƒν•˜κ²Œλ„ λ‹€μŒ μ½”λ“œκ°€ Attribute μ—λŸ¬κ°€ λ‚œλ‹€. 적절히 μ œμ•½λΆ€λΆ„μ— λŒ€ν•΄μ„œ 생각을 ν•΄μ•Ό ν• λ“―.

~cpp 
class Background(pygame.Surface):
    def __init__(self, aSize):
        pygame.Surface.__init__(self, aSize)
    def clearSurface(self):
        self.fill((0,0,0))

def createBlackScreen(aSize):
    back = Background(aSize)
    back.clearSurface()           <-- μ—¬κΈ°μ„œ Attribute μ—λŸ¬
    return back
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:24:08
Processing time 0.0087 sec