【发布时间】:2022-11-11 08:40:29
【问题描述】:
我尝试过这样的事情:
screen backgroundGame():
default backgroundGameDisp = backgroundGameDisplayable()
add Solid("#394387") # dark blue
add backgroundGameDisp
init python:
import math
import pygame
#from pygame.locals import *
class backgroundGameDisplayable(renpy.Displayable):
def __init__(self):
super(backgroundGameDisplayable, self).__init__()
def render(self, width, height, st, at):
render = renpy.Render(width, height)
return render
def event(self, ev, x, y, st):
print("CLASS WORKS! Coords are, x", str(x), "y:", str(y))
pygame.init()
widthGame = 1000
heightGame = 1000
screem = pygame.display.set_mode((widthGame, heightGame))
pygame.display.set_caption("TEST")
run = True
while run:
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.quit()
def per_interact(self):
pass
def visit(self):
return []
这是script.rpy 文件:
define e = Character('Eileen', color="#c8ffc8")
label start:
scene bg room
show eileen happy
e "bla"
call screen backgroundGame
e "bla2"
return
当我像这样运行项目时,首先会出现 Renpy 游戏,然后将其替换为 pygame 窗口,而我希望 pygame 的东西出现在可视组件中。我究竟做错了什么?
【问题讨论】:
标签: python-3.x pygame renpy