Help Migrating Pygame app to Kivy

53 views
Skip to first unread message

Brendan Scott

unread,
Feb 18, 2014, 7:55:56 PM2/18/14
to kivy-...@googlegroups.com
Hi
I have a vector sprite based game written using pygame which I'd like to get running on Android.  I am looking into Kivy and pygame subset for android.  At the moment, the sprites are passed a pygame surface and asked to update themselves to the surface which is later blitted to the screen. 

If I migrate to Kivy, will I be able to keep their code and pass them a fbo object in Kivy? (If that's the case, the migration may turn out to be pretty easy). 

eg:
def draw_me(self, surface, color, width):
  [...]
  return pygame.draw.line(surface, color, self.point1, self.point2, width)

would become:

def draw_me(self, fbo, color, width):
  [...]
  fbo.bind()
  fbo.clear_buffer()
  fbo.release()
 
   with fbo:
        Color(color)
        self.line = Line(points=self.points,  width=1)
   return

Given  that they're vector sprites I was thinking of using the Line commands and updating the points, but I'm a little confused about how I'd keep a reference to the Line objects in the sprite.  Would it make sense to have a self.myline attribute and in the draw_me method initialise using the line using the fbo which is passed in it if it doesn't exist and otherwise just update the points?  Does this presume that the same fbo is passed to the sprite in the future?

Thanks

Brendan

ps: pygame_parachute?

Brendan Scott

unread,
Apr 14, 2014, 2:48:54 AM4/14/14
to kivy-...@googlegroups.com
Simple answer was to use pygame subset for android instead.
Reply all
Reply to author
Forward
0 new messages