【问题标题】:Is it possible to display a pygame Minigame in renpy displayable?是否可以在 renpy displayable 中显示 pygame Minigame?
【发布时间】: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


    【解决方案1】:

    混合框架材料不是一个好主意。框架之间可能相互作用不佳或完全冲突。如果它适用于您的(操作系统),这并不意味着它将适用于另一个(操作系统)系统或其中一个框架的不同版本。混合框架总是意味着某种未定义的行为。
    众所周知,Pygame 无法与不同系统上的其他框架一起工作。例如Embedding a Pygame window into a Tkinter or WxPython frame

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-01-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多