1

SOM でテキストを操作する方法 2. コードがあります。何が悪かったのかわかりません。

   bmpfont = sdl2.ext.BitmapFont(surface, (width, height)) 
   software_renderer = sdl2.ext.SoftwareSpriteRenderSystem(window) 
   factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE) 
   sprite = factory.create_software_sprite((40, 40))

  surf = bmpfont.render("4").surface 
  sprite.surface = surf 
  software_renderer.render(sprite, 0, 0)

エラーメッセージが表示されます:

ctypes.ArgumentError: argument 1: <class 'TypeError'>: expected LP_SDL_Surface instance instead of SoftwareSprite 
Exception ignored in:
4

1 に答える 1

0

LP_ は、長いポインターの ctypes インジケーターです。必要なオブジェクトを取得するには、LP オブジェクトで contents メソッドを呼び出す必要があります。

于 2016-12-11T06:05:28.887 に答える