parent
47f089fcbc
commit
88f42e8a93
Binary file not shown.
@ -0,0 +1,14 @@
|
|||||||
|
{
|
||||||
|
// 使用 IntelliSense 了解相关属性。
|
||||||
|
// 悬停以查看现有属性的描述。
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
{
|
||||||
|
"name": "Python 调试程序: 当前文件",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Binary file not shown.
After Width: | Height: | Size: 438 KiB |
After Width: | Height: | Size: 1.1 KiB |
After Width: | Height: | Size: 1.2 KiB |
Binary file not shown.
@ -0,0 +1,29 @@
|
|||||||
|
import pygame as pg
|
||||||
|
if __name__ == '__main__':
|
||||||
|
pg.init()
|
||||||
|
WIDTH = 615
|
||||||
|
HEIGHT = 615
|
||||||
|
clock = pg.time.Clock()
|
||||||
|
screen = pg.display.set_mode((WIDTH, HEIGHT))
|
||||||
|
black = pg.image.load("data/storn_black.png").convert_alpha()
|
||||||
|
white = pg.image.load("data/storn_white.png").convert_alpha()
|
||||||
|
background = pg.image.load("data/bg.png").convert_alpha()
|
||||||
|
objects = []
|
||||||
|
pg.display.set_caption("五子棋")
|
||||||
|
going = True
|
||||||
|
while going:
|
||||||
|
screen.blit(background, (0, 0))
|
||||||
|
for event in pg.event.get():
|
||||||
|
if event.type == pg.QUIT:
|
||||||
|
going = False
|
||||||
|
elif event.type == pg.KEYDOWN and event.key == pg.K_ESCAPE:
|
||||||
|
going = False
|
||||||
|
elif event.type == pg.MOUSEBUTTONDOWN:
|
||||||
|
pos = pg.mouse.get_pos()
|
||||||
|
print(pos)
|
||||||
|
objects.append([black,(pos[0]-18,pos[1]-18)])
|
||||||
|
for o in objects:
|
||||||
|
screen.blit(o[0], o[1])
|
||||||
|
clock.tick(60)
|
||||||
|
pg.display.update()
|
||||||
|
pg.quit()
|
Loading…
Reference in new issue