You can subscribe to this list here.
| 2009 |
Jan
|
Feb
(9) |
Mar
(11) |
Apr
|
May
(4) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
(5) |
Dec
(18) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2010 |
Jan
(4) |
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
(11) |
Aug
(33) |
Sep
(33) |
Oct
|
Nov
|
Dec
|
|
From: <Blu...@us...> - 2009-03-23 15:01:13
|
Revision: 288
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=288&view=rev
Author: BlueWolf_
Date: 2009-03-23 15:00:53 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Merging trunk/VP r276 through r287. Could somebody please check the TODO?
Modified Paths:
--------------
branches/VP-Grounds/TODO
branches/VP-Grounds/modules/input.py
Added Paths:
-----------
branches/VP-Grounds/images/Input/
branches/VP-Grounds/images/Input/multiple.png
Removed Paths:
-------------
branches/VP-Grounds/images/Input/multiple.png
Property Changed:
----------------
branches/VP-Grounds/
branches/VP-Grounds/images/Button/
branches/VP-Grounds/images/Button/item.config.png
branches/VP-Grounds/images/Button/item.emoticons.png
branches/VP-Grounds/images/Button/item.master.png
branches/VP-Grounds/images/Button/item.status.away.png
branches/VP-Grounds/images/Button/item.status.busy.png
branches/VP-Grounds/images/Button/item.status.idle.png
branches/VP-Grounds/images/Button/item.status.online.png
branches/VP-Grounds/images/Chat/chaticons.status.png
branches/VP-Grounds/images/Chat/scrollbar.down.png
branches/VP-Grounds/images/Chat/scrollbar.png
branches/VP-Grounds/images/Chat/scrollbar.scroll.png
branches/VP-Grounds/images/Chat/top.png
branches/VP-Grounds/images/Login/background.png
branches/VP-Grounds/images/Menu/checkmenu.check.png
branches/VP-Grounds/images/Menu/checkmenu.unckeck.png
branches/VP-Grounds/images/Menu/icons/edit.png
branches/VP-Grounds/images/Menu/selected.png
branches/VP-Grounds/images/Menu/submenu.png
branches/VP-Grounds/images/Progressbar/background.png
branches/VP-Grounds/images/Progressbar/foreground.png
branches/VP-Grounds/images/Status/background.png
branches/VP-Grounds/images/Status/item.away.png
branches/VP-Grounds/images/Status/item.busy.png
branches/VP-Grounds/images/Status/item.online.png
branches/VP-Grounds/images/Userinfo/background.png
branches/VP-Grounds/images/Userinfo/close.png
branches/VP-Grounds/images/base.png
branches/VP-Grounds/images/gui/button.png
branches/VP-Grounds/images/gui/checkbox.png
branches/VP-Grounds/images/gui/closebutton.png
branches/VP-Grounds/images/gui/combobox.png
branches/VP-Grounds/images/gui/optionbox.png
branches/VP-Grounds/images/gui/shadebutton.png
branches/VP-Grounds/images/popup/chat.admin.png
branches/VP-Grounds/images/popup/chat.moderator.png
branches/VP-Grounds/images/popup/chat.png
branches/VP-Grounds/images/popup/user.enters_room.png
branches/VP-Grounds/images/popup/user.leaves_room.png
branches/VP-Grounds/images/popup/user.offline.png
branches/VP-Grounds/images/popup/user.online.png
Property changes on: branches/VP-Grounds
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk/VP:276-287
Modified: branches/VP-Grounds/TODO
===================================================================
--- branches/VP-Grounds/TODO 2009-03-23 14:08:58 UTC (rev 287)
+++ branches/VP-Grounds/TODO 2009-03-23 15:00:53 UTC (rev 288)
@@ -21,14 +21,20 @@
* Submenus (assigned to BlueWolf_)
Playground
-* Creating the avatars
-* Getting the avatars visible (assigned to BlueWolf_)
+* Creating the avatars (the images)
+* Finishing up Static avatar (Z coords) (assigned to chozone)
+* Finishing up multidir avatar (Z coords) (assigned to chozone)
+* Finishing up multiparts avatar (Z coords) (assigned to chozone)
+* Finishing up multidir_parts avatar (Z coords) (assigned to chozone)
+* Walls
+* Smooth walking
+* Jumping
+* Running (assigned to chozone)
+* Walking/running bit slower when walking diagonally (assigned to chozone)
+* Chat balloons (assigned to K-4U)
WIO
-* Create a better background image
+* Create a better background image (same as Interface->'New Interface?'?)
About
* Content (assigned to K-4U) _on hold_ we need the info..
-
- Settings
-* Choose language (assigned to chozone)
Property changes on: branches/VP-Grounds/images/Button
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.config.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.emoticons.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.master.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.status.away.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.status.busy.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.status.idle.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Button/item.status.online.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Chat/chaticons.status.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Chat/scrollbar.down.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Chat/scrollbar.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Chat/scrollbar.scroll.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Chat/top.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Deleted: branches/VP-Grounds/images/Input/multiple.png
===================================================================
(Binary files differ)
Copied: branches/VP-Grounds/images/Input/multiple.png (from rev 287, trunk/VP/images/Input/multiple.png)
===================================================================
(Binary files differ)
Property changes on: branches/VP-Grounds/images/Login/background.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Menu/checkmenu.check.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Menu/checkmenu.unckeck.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Menu/icons/edit.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Menu/selected.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Menu/submenu.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Progressbar/background.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Progressbar/foreground.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Status/background.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Status/item.away.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Status/item.busy.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Status/item.online.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Userinfo/background.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/Userinfo/close.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/base.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/button.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/checkbox.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/closebutton.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/combobox.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/optionbox.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/gui/shadebutton.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/chat.admin.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/chat.moderator.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/chat.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/user.enters_room.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/user.leaves_room.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/user.offline.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Property changes on: branches/VP-Grounds/images/popup/user.online.png
___________________________________________________________________
Deleted: svn:mergeinfo
-
Modified: branches/VP-Grounds/modules/input.py
===================================================================
--- branches/VP-Grounds/modules/input.py 2009-03-23 14:08:58 UTC (rev 287)
+++ branches/VP-Grounds/modules/input.py 2009-03-23 15:00:53 UTC (rev 288)
@@ -14,6 +14,7 @@
fontEndObj = pygame.font.Font(getRealDir('fonts', 'Bitstream Vera Sans.ttf'), 15)
fontEndObj.set_bold(True)
self.textEnd = fontEndObj.render('|', True, (0,130,21))
+ self.multipleLines = loadImage('images', 'Input', 'multiple.png')[0]
self.inputText = ''
@@ -109,16 +110,21 @@
textSurf = self.fontObj.render(visibleLine , True, (0,0,0))
textLength = textSurf.get_width()
-
- if textLength < 350:
+ textWidth = 350 if len(self.inputText.split('\n')) == 1 else 340 #So we have 10px more for the icon, when there are multiple lines
+
+ if textLength < textWidth:
pos = 0
cursorPos = textLength
else:
- pos = textLength - 350
- cursorPos = 350
+ pos = textLength - textWidth
+ cursorPos = textWidth
- area = (pos, 0, 350, textSurf.get_height())
+ area = (pos, 0, textWidth, textSurf.get_height())
+ if len(self.inputText.split('\n'))>1:
+ #Multiple lines, let's show that cool icon!
+ self.surf.blit(self.multipleLines, (355, 4))
+
self.surf.blit(textSurf, (12,4), area)
self.surf.blit(self.textEnd, (10+cursorPos, 2))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-03-23 14:09:30
|
Revision: 287
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=287&view=rev
Author: chozone
Date: 2009-03-23 14:08:58 +0000 (Mon, 23 Mar 2009)
Log Message:
-----------
Z position added in all avatars (i think). You can now also run (hold ctrl)
Modified Paths:
--------------
branches/VP-Grounds/modules/playground/avatar-multidir.py
branches/VP-Grounds/modules/playground/avatar-multidir_parts.py
branches/VP-Grounds/modules/playground/avatar-multipart.py
branches/VP-Grounds/modules/playground/avatar-static.py
branches/VP-Grounds/modules/playground.py
Modified: branches/VP-Grounds/modules/playground/avatar-multidir.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multidir.py 2009-03-08 11:15:18 UTC (rev 286)
+++ branches/VP-Grounds/modules/playground/avatar-multidir.py 2009-03-23 14:08:58 UTC (rev 287)
@@ -10,7 +10,7 @@
self.image=None
self.fullImage=None
- self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.rect = Rect(data['Pos'][1], data['Pos'][2]-data['Pos'][3], 0, 0)
self.zorder = self.rect.top + self.rect.height
self.blitRect = Rect(0,0,0,0) #Internal rect, inside fullImage
@@ -66,7 +66,7 @@
elif self.rect.y > pos[2]: self.setDir('u')
self.rect.x=pos[1]
- self.rect.y=pos[2]
+ self.rect.y=pos[2]-pos[3]
self.zorder = self.rect.top + self.rect.height
updateRect=oldRect.union(self.rect)
Modified: branches/VP-Grounds/modules/playground/avatar-multidir_parts.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multidir_parts.py 2009-03-08 11:15:18 UTC (rev 286)
+++ branches/VP-Grounds/modules/playground/avatar-multidir_parts.py 2009-03-23 14:08:58 UTC (rev 287)
@@ -8,7 +8,7 @@
self.imageList=data['Avatar'][1:]
self.imageNameList=data['Avatar'][1:]
- self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.rect = Rect(data['Pos'][1], data['Pos'][2]-data['Pos'][3], 0, 0)
self.zorder = self.rect.top + self.rect.height
def show(self):
@@ -63,7 +63,7 @@
elif self.rect.y > pos[2]: self.setDir('u')
self.rect.x=pos[1]
- self.rect.y=pos[2]
+ self.rect.y=pos[2]-pos[3]
self.zorder = self.rect.top + self.rect.height
updateRect=oldRect.union(self.rect)
Modified: branches/VP-Grounds/modules/playground/avatar-multipart.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multipart.py 2009-03-08 11:15:18 UTC (rev 286)
+++ branches/VP-Grounds/modules/playground/avatar-multipart.py 2009-03-23 14:08:58 UTC (rev 287)
@@ -6,7 +6,7 @@
self.imageList=data['Avatar'][1:]
self.imageNameList=data['Avatar'][1:]
- self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.rect = Rect(data['Pos'][1], data['Pos'][2]-data['Pos'][3], 0, 0)
self.zorder = self.rect.top + self.rect.height
def show(self):
@@ -54,7 +54,7 @@
oldRect=self.rect.__copy__()
self.rect.x=pos[1]
- self.rect.y=pos[2]
+ self.rect.y=pos[2]-pos[3]
self.zorder = self.rect.top + self.rect.height
updateRect=oldRect.union(self.rect)
Modified: branches/VP-Grounds/modules/playground/avatar-static.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-static.py 2009-03-08 11:15:18 UTC (rev 286)
+++ branches/VP-Grounds/modules/playground/avatar-static.py 2009-03-23 14:08:58 UTC (rev 287)
@@ -5,7 +5,7 @@
self.sh = share
self.imageName=data['Avatar'][1]
- self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.rect = Rect(data['Pos'][1], data['Pos'][2]-data['Pos'][3], 0, 0)
self.zorder = self.rect.top + self.rect.height
def show(self):
@@ -44,7 +44,7 @@
oldRect=self.rect.__copy__()
self.rect.x=pos[1]
- self.rect.y=pos[2]
+ self.rect.y=pos[2]-pos[3]
self.zorder = self.rect.top + self.rect.height
updateRect=oldRect.union(self.rect)
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-03-08 11:15:18 UTC (rev 286)
+++ branches/VP-Grounds/modules/playground.py 2009-03-23 14:08:58 UTC (rev 287)
@@ -24,6 +24,7 @@
self.timer = None
self.walkingStep=10 #Size(px) of each step.
+ self.runningStep=20 #Size(px) of each step while running.
#Loading all our objects-modules (kinda like interface.py)
@@ -62,26 +63,42 @@
if self.dontUpdate == False:
#TODO: when you move diagonally, your speed should be a bit less, around 7 (this is sqrt(50)... for other walking speeds: walkingStep=sqrt(x^2+x^2) )
+ dir=-1
+ tempStep=self.runningStep if ev.mod & KMOD_CTRL else self.walkingStep
if ev.key == K_UP:
- self.walking(0, +self.walkingStep, True)
+ dir=0
elif ev.key == K_LEFT:
- self.walking(1, +self.walkingStep, True)
+ dir=1
elif ev.key == K_DOWN:
- self.walking(2, +self.walkingStep, True)
+ dir=2
elif ev.key == K_RIGHT:
- self.walking(3, +self.walkingStep, True)
+ dir=3
+ elif ev.key == K_RCTRL or ev.key == K_LCTRL:
+ for d, s in enumerate(self.walkingDir):
+ if s: self.walking(d, self.runningStep-s, True, True)
+
+
+ if dir != -1:
+ self.walking(dir, tempStep, True)
elif ev.type == KEYUP:
if self.dontUpdate == False:
+ dir=-1
if ev.key == K_UP:
- self.walking(0, -self.walkingStep, False)
+ dir=0
elif ev.key == K_LEFT:
- self.walking(1, -self.walkingStep, False)
+ dir=1
elif ev.key == K_DOWN:
- self.walking(2, -self.walkingStep, False)
+ dir=2
elif ev.key == K_RIGHT:
- self.walking(3, -self.walkingStep, False)
+ dir=3
+ elif ev.key == K_RCTRL or ev.key == K_LCTRL:
+ for d, s in enumerate(self.walkingDir):
+ if s: self.walking(d, -self.runningStep+self.walkingStep, False, True)
+ if dir != -1:
+ self.walking(dir, -self.walkingDir[dir], False)
+
def call(self, *arg):
@@ -217,16 +234,16 @@
return [item[1] for item in sortList]
- def walking(self, direction, speed, keyDown):
+ def walking(self, direction, speed, keyDown, ctrl=False):
#Repeating key prevention.
#Check if keyDown was already send to this direction
if keyDown == True:
- if self.walkingDir[direction] == False:
- self.walkingDir[direction] = True
+ if not self.walkingDir[direction] or ctrl:
+ self.walkingDir[direction] += speed
self.sh['Brains'].walking(direction, speed)
else:
- if self.walkingDir[direction] == True:
- self.walkingDir[direction] = False
+ if self.walkingDir[direction] or ctrl:
+ self.walkingDir[direction] += speed
self.sh['Brains'].walking(direction, speed)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-03-08 11:15:28
|
Revision: 286
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=286&view=rev
Author: chozone
Date: 2009-03-08 11:15:18 +0000 (Sun, 08 Mar 2009)
Log Message:
-----------
TODO update (for playground@branche)
Modified Paths:
--------------
trunk/VP/TODO
Modified: trunk/VP/TODO
===================================================================
--- trunk/VP/TODO 2009-03-08 11:12:02 UTC (rev 285)
+++ trunk/VP/TODO 2009-03-08 11:15:18 UTC (rev 286)
@@ -22,14 +22,15 @@
Playground
* Creating the avatars (the images)
-* Finishing up Static avatar (Z coords)
-* Finishing up multidir avatar (Z coords)
-* Creating multiparts avatar (assigned to chozone)
-* Creating multidir_parts avatar (assigned to chozone)
+* Finishing up Static avatar (Z coords) (assigned to chozone)
+* Finishing up multidir avatar (Z coords) (assigned to chozone)
+* Finishing up multiparts avatar (Z coords) (assigned to chozone)
+* Finishing up multidir_parts avatar (Z coords) (assigned to chozone)
+* Walls
* Smooth walking
* Jumping
-* Running
-* Walking/running bit slower when walking diagonally
+* Running (assigned to chozone)
+* Walking/running bit slower when walking diagonally (assigned to chozone)
* Chat balloons (assigned to K-4U)
WIO
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-03-08 11:12:14
|
Revision: 285
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=285&view=rev
Author: chozone
Date: 2009-03-08 11:12:02 +0000 (Sun, 08 Mar 2009)
Log Message:
-----------
New avatar: multidir_parts, the last one(for now...). Also really tiny fix in multidir, and comment updates in multidir and multiparts.
Modified Paths:
--------------
branches/VP-Grounds/modules/playground/avatar-multidir.py
branches/VP-Grounds/modules/playground/avatar-multipart.py
Added Paths:
-----------
branches/VP-Grounds/modules/playground/avatar-multidir_parts.py
Modified: branches/VP-Grounds/modules/playground/avatar-multidir.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multidir.py 2009-03-03 19:53:06 UTC (rev 284)
+++ branches/VP-Grounds/modules/playground/avatar-multidir.py 2009-03-08 11:12:02 UTC (rev 285)
@@ -54,7 +54,8 @@
def move(self, pos):
"""
Call this def to move this avatar to pos x=pos[1], y=pos[2].
- Will update rect, and make playground module update our old+new area
+ Will update rect, and make playground module update our old+new area.
+ Will also change our direction if needed.
"""
oldRect=self.rect.__copy__()
@@ -91,6 +92,8 @@
if not self.fullImage: return #Do we have base image?
+ self.currentDir=dir
+
#Actually change image
self.blitRect.x = self.blitRect.w * dir
self.image=self.fullImage.subsurface(self.blitRect)
Added: branches/VP-Grounds/modules/playground/avatar-multidir_parts.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multidir_parts.py (rev 0)
+++ branches/VP-Grounds/modules/playground/avatar-multidir_parts.py 2009-03-08 11:12:02 UTC (rev 285)
@@ -0,0 +1,123 @@
+from functions import *
+
+class Object():
+ def __init__(self, data, share):
+ self.sh = share
+
+ self.currentDir=0 # 0=d, 1=l, 2=u, 3=r
+
+ self.imageList=data['Avatar'][1:]
+ self.imageNameList=data['Avatar'][1:]
+ self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.zorder = self.rect.top + self.rect.height
+
+ def show(self):
+ """
+ Start the whole process of:
+ checking whether avatar is downloaded, [download it], return avatar, and finally: blit ourselves.
+ This has to be a seperate def. If you put this right into __init__, we will make playground blit
+ ourself, before the initialisation is ready. And so, if that's not ready, we're not in the objects
+ list of the playground, and we will not be blitted.
+ """
+
+ #We have multiple images, so loop through them, to download them all
+ for image in self.imageList:
+ self.sh['Downloader'].getImage(image, self.imageUpdate, image)
+
+ def imageUpdate(self, image, *arg):
+ """
+ The downloader will call this when he's finished.
+ Will load in the image, and when we have all our images, we wil build ourselved.
+ """
+ imageName=arg[0]
+ image=image
+
+ self.imageList[self.imageNameList.index(imageName)]=image
+
+ #Does our list still contain strings?
+ #(wich indicates we are still awaiting some downloads)
+ for img in self.imageList:
+ if type(img)!=tuple: return
+
+ self.buildAvatar(True)
+
+ def update(self, screen, rect):
+ if self.rect.colliderect(rect): #Check if the rect collide with ours
+ rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
+ myPos = (self.rect[0] + rect[0], self.rect[1] + rect[1]) #Calculate our position from the rect
+ screen.blit(self.image, myPos, rect) #Blit
+
+
+ def move(self, pos):
+ """
+ Call this def to move this avatar to pos x=pos[1], y=pos[2].
+ Will update rect, and make playground module update our old+new area.
+ Will also change our direction if needed.
+ """
+ oldRect=self.rect.__copy__()
+
+ #Change avatar direction
+ if self.rect.x < pos[1]: self.setDir('r')
+ elif self.rect.x > pos[1]: self.setDir('l')
+ elif self.rect.y < pos[2]: self.setDir('d')
+ elif self.rect.y > pos[2]: self.setDir('u')
+
+ self.rect.x=pos[1]
+ self.rect.y=pos[2]
+ self.zorder = self.rect.top + self.rect.height
+
+ updateRect=oldRect.union(self.rect)
+
+ self.sh['Playground'].blit(updateRect)
+
+
+ def buildAvatar(self, blit=False):
+ oldRect=self.rect.__copy__() #So we can combine it later with our new rect, so we can also update te old area
+
+ #Update Width(w) and height(h)
+ self.rect.w=max([rect.w/4 for img,rect in self.imageList])
+ self.rect.h=0
+ for img, rect in self.imageList: self.rect.h+=rect.h
+
+ #And the zorder('cause we have new height)
+ self.zorder=self.rect.top+self.rect.height
+
+ #Create clean surface for our avatar
+ self.image=pygame.Surface(self.rect.size, SRCALPHA, 32)
+
+ #Blit all parts on this fresh surface
+ y=0
+ for img,rect in self.imageList:
+ w=rect.w/4 #width of real image(there are 4 images in this one, for directions)
+ x=self.rect.w/2-w/2
+
+ self.image.blit(img, (x,y), (w*self.currentDir,0,w,rect.h))
+ y+=rect.h
+
+ if blit:
+ #Combine rects, and update area. It's time to show ourselves! :D
+ updateRect=self.rect.union(oldRect)
+ self.sh['Playground'].blit(updateRect)
+
+
+ def setDir(self, dir, blit=False):
+ """
+ Change avatar direction.
+ `dir` can be either int(0,1,2,3) or str('d','l','u','r').
+ """
+
+ #Change to correct value, or exit
+ if type(dir)!=int:
+ if dir=='d': dir=0
+ elif dir=='l': dir=1
+ elif dir=='u': dir=2
+ elif dir=='r': dir=3
+ else: return
+
+ if dir < 0 or dir > 3: return #Valid number?
+ if dir == self.currentDir: return #Not the same as old direction?
+
+ self.currentDir=dir
+
+ #Actually change image
+ self.buildAvatar(blit)
Modified: branches/VP-Grounds/modules/playground/avatar-multipart.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multipart.py 2009-03-03 19:53:06 UTC (rev 284)
+++ branches/VP-Grounds/modules/playground/avatar-multipart.py 2009-03-08 11:12:02 UTC (rev 285)
@@ -25,7 +25,7 @@
def imageUpdate(self, image, *arg):
"""
The downloader will call this when he's finished.
- Will load in the image, and make playground blit our rect.
+ Will load in the image, and when we have all our images, we wil build ourselved.
"""
imageName=arg[0]
image=image
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-03-03 19:53:08
|
Revision: 284
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=284&view=rev
Author: chozone
Date: 2009-03-03 19:53:06 +0000 (Tue, 03 Mar 2009)
Log Message:
-----------
Added new avatar type: avatar_multipart. Also really small bugfix in playground.
Modified Paths:
--------------
branches/VP-Grounds/modules/playground.py
Added Paths:
-----------
branches/VP-Grounds/modules/playground/avatar-multipart.py
Added: branches/VP-Grounds/modules/playground/avatar-multipart.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multipart.py (rev 0)
+++ branches/VP-Grounds/modules/playground/avatar-multipart.py 2009-03-03 19:53:06 UTC (rev 284)
@@ -0,0 +1,88 @@
+from functions import *
+
+class Object():
+ def __init__(self, data, share):
+ self.sh = share
+
+ self.imageList=data['Avatar'][1:]
+ self.imageNameList=data['Avatar'][1:]
+ self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.zorder = self.rect.top + self.rect.height
+
+ def show(self):
+ """
+ Start the whole process of:
+ checking whether avatar is downloaded, [download it], return avatar, and finally: blit ourselves.
+ This has to be a seperate def. If you put this right into __init__, we will make playground blit
+ ourself, before the initialisation is ready. And so, if that's not ready, we're not in the objects
+ list of the playground, and we will not be blitted.
+ """
+
+ #We have multiple images, so loop through them, to download them all
+ for image in self.imageList:
+ self.sh['Downloader'].getImage(image, self.imageUpdate, image)
+
+ def imageUpdate(self, image, *arg):
+ """
+ The downloader will call this when he's finished.
+ Will load in the image, and make playground blit our rect.
+ """
+ imageName=arg[0]
+ image=image
+
+ self.imageList[self.imageNameList.index(imageName)]=image
+
+ #Does our list still contain strings?
+ #(wich indicates we are still awaiting some downloads)
+ for img in self.imageList:
+ if type(img)!=tuple: return
+
+ self.buildAvatar()
+
+ def update(self, screen, rect):
+ if self.rect.colliderect(rect): #Check if the rect collide with ours
+ rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
+ myPos = (self.rect[0] + rect[0], self.rect[1] + rect[1]) #Calculate our position from the rect
+ screen.blit(self.image, myPos, rect) #Blit
+
+
+ def move(self, pos):
+ """
+ Call this def to move this avatar to pos x=pos[1], y=pos[2].
+ Will update rect, and make playground module update our old+new area
+ """
+ oldRect=self.rect.__copy__()
+
+ self.rect.x=pos[1]
+ self.rect.y=pos[2]
+ self.zorder = self.rect.top + self.rect.height
+
+ updateRect=oldRect.union(self.rect)
+
+ self.sh['Playground'].blit(updateRect)
+
+
+ def buildAvatar(self):
+ oldRect=self.rect.__copy__() #So we can combine it later with our new rect, so we can also update te old area
+
+ #Update Width(w) and height(h)
+ self.rect.w=max([rect.w for img,rect in self.imageList])
+ self.rect.h=0
+ for img, rect in self.imageList: self.rect.h+=rect.h
+
+ #And the zorder('cause we have new height)
+ self.zorder=self.rect.top+self.rect.height
+
+ #Create clean surface for our avatar
+ self.image=pygame.Surface(self.rect.size, SRCALPHA, 32)
+
+ #Blit all parts on this fresh surface
+ y=0
+ for img,rect in self.imageList:
+ x=self.rect.w/2-rect.w/2
+ self.image.blit(img, (x,y))
+ y+=rect.h
+
+ #Combine rects, and update area. It's time to show ourselves! :D
+ updateRect=self.rect.union(oldRect)
+ self.sh['Playground'].blit(updateRect)
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-02-26 21:42:09 UTC (rev 283)
+++ branches/VP-Grounds/modules/playground.py 2009-03-03 19:53:06 UTC (rev 284)
@@ -110,7 +110,7 @@
if user.has_key('Pos') and user['Pos'] != None:
#Has user gone offline, and should we delete the avatar object?
- if user.has_key('Action') and user['Action']=='Offline':
+ if user.has_key('Action') and user['Action']=='Offline' and 'av-' + user['Name'] in self.objects.keys():
tempRect=self.objects['av-%s'%user['Name']].rect
del self.objects['av-%s'%user['Name']]
self.blit(tempRect)
@@ -191,9 +191,12 @@
Create an new object, of type `objname`.
"""
- if not objname in self.modObjects.keys(): return
- print '## Open Object', name, 'as', objname #DEBUG
+ if not objname in self.modObjects.keys():
+ print 'ERROR @Playground: Object type', objname,'not found, cannot open', name
+ return
+ #print '## Open Object', name, 'as', objname #DEBUG
+
obj = self.modObjects[objname]
obj = obj(data, self.sh)
self.objects[name] = obj
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-02-26 21:42:17
|
Revision: 283
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=283&view=rev
Author: chozone
Date: 2009-02-26 21:42:09 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
Todo update.
Modified Paths:
--------------
trunk/VP/TODO
Modified: trunk/VP/TODO
===================================================================
--- trunk/VP/TODO 2009-02-26 21:01:04 UTC (rev 282)
+++ trunk/VP/TODO 2009-02-26 21:42:09 UTC (rev 283)
@@ -21,14 +21,19 @@
* Submenus (assigned to BlueWolf_)
Playground
-* Creating the avatars
-* Getting the avatars visible (assigned to BlueWolf_)
+* Creating the avatars (the images)
+* Finishing up Static avatar (Z coords)
+* Finishing up multidir avatar (Z coords)
+* Creating multiparts avatar (assigned to chozone)
+* Creating multidir_parts avatar (assigned to chozone)
+* Smooth walking
+* Jumping
+* Running
+* Walking/running bit slower when walking diagonally
+* Chat balloons (assigned to K-4U)
WIO
-* Create a better background image
+* Create a better background image (same as Interface->'New Interface?'?)
About
* Content (assigned to K-4U) _on hold_ we need the info..
-
- Settings
-* Choose language (assigned to chozone)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-02-26 21:01:14
|
Revision: 282
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=282&view=rev
Author: chozone
Date: 2009-02-26 21:01:04 +0000 (Thu, 26 Feb 2009)
Log Message:
-----------
New avatar type: multidir. Also added error catcher for non-existing playground modules.
Modified Paths:
--------------
branches/VP-Grounds/brains.py
branches/VP-Grounds/modules/playground.py
Added Paths:
-----------
branches/VP-Grounds/modules/playground/avatar-multidir.py
Modified: branches/VP-Grounds/brains.py
===================================================================
--- branches/VP-Grounds/brains.py 2009-02-25 19:17:16 UTC (rev 281)
+++ branches/VP-Grounds/brains.py 2009-02-26 21:01:04 UTC (rev 282)
@@ -91,7 +91,7 @@
#Is our timer NOT running?
if self.walkTimer == None or self.walkTimer.isRunning == False:
#Start it!
- self.walkTimer = self.sh['Interface'].Timer(0.05, self.doWalk)
+ self.walkTimer = self.sh['Interface'].Timer(0.07, self.doWalk)
#Is our update timer NOT on?
if self.walkUpdateTimer == None or self.walkUpdateTimer.isRunning == False:
Added: branches/VP-Grounds/modules/playground/avatar-multidir.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-multidir.py (rev 0)
+++ branches/VP-Grounds/modules/playground/avatar-multidir.py 2009-02-26 21:01:04 UTC (rev 282)
@@ -0,0 +1,99 @@
+from functions import *
+
+class Object():
+ def __init__(self, data, share):
+ self.sh = share
+
+ self.currentDir=-1 #-1=none, 0=d, 1=l, 2=u, 3=r
+
+ self.imageName=data['Avatar'][1]
+ self.image=None
+ self.fullImage=None
+
+ self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.zorder = self.rect.top + self.rect.height
+ self.blitRect = Rect(0,0,0,0) #Internal rect, inside fullImage
+
+ def show(self):
+ """
+ Start the whole process of:
+ checking whether avatar is downloaded, [download it], return avatar, and finally: blit ourselves.
+ This has to be a seperate def. If you put this right into __init__, we will make playground blit
+ ourself, before the initialisation is ready. And so, if that's not ready, we're not in the objects
+ list of the playground, and we will not be blitted.
+ """
+ self.sh['Downloader'].getImage(self.imageName, self.imageUpdate)
+
+ def imageUpdate(self, image, *arg):
+ """
+ The downloader will call this when he's finished.
+ Will load in the image, and make playground blit our rect.
+ """
+
+ self.rect.size = image[1].size
+ self.rect.w = self.rect.w/4
+
+ self.blitRect.size=self.rect.size
+
+ self.fullImage = image[0]
+
+ self.setDir(0)
+
+ self.zorder = self.rect.top + self.rect.height
+
+ self.sh['Playground'].blit(self.rect)
+
+ def update(self, screen, rect):
+ if not self.image: return
+ if self.rect.colliderect(rect): #Check if the rect collide with ours
+ rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
+ myPos = (self.rect[0] + rect[0], self.rect[1] + rect[1]) #Calculate our position from the rect
+ screen.blit(self.image, myPos, rect) #Blit
+
+
+ def move(self, pos):
+ """
+ Call this def to move this avatar to pos x=pos[1], y=pos[2].
+ Will update rect, and make playground module update our old+new area
+ """
+ oldRect=self.rect.__copy__()
+
+ #Change avatar direction
+ if self.rect.x < pos[1]: self.setDir('r')
+ elif self.rect.x > pos[1]: self.setDir('l')
+ elif self.rect.y < pos[2]: self.setDir('d')
+ elif self.rect.y > pos[2]: self.setDir('u')
+
+ self.rect.x=pos[1]
+ self.rect.y=pos[2]
+ self.zorder = self.rect.top + self.rect.height
+
+ updateRect=oldRect.union(self.rect)
+
+ self.sh['Playground'].blit(updateRect)
+
+ def setDir(self, dir, blit=False):
+ """
+ Change avatar direction.
+ `dir` can be either int(0,1,2,3) or str('d','l','u','r').
+ """
+
+ #Change to correct value, or exit
+ if type(dir)!=int:
+ if dir=='d': dir=0
+ elif dir=='l': dir=1
+ elif dir=='u': dir=2
+ elif dir=='r': dir=3
+ else: return
+
+ if dir < 0 or dir > 3: return #Valid number?
+ if dir == self.currentDir: return #Not the same as old direction?
+
+ if not self.fullImage: return #Do we have base image?
+
+ #Actually change image
+ self.blitRect.x = self.blitRect.w * dir
+ self.image=self.fullImage.subsurface(self.blitRect)
+
+ if blit:
+ self.sh['Playground'].blit(self.rect)
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-02-25 19:17:16 UTC (rev 281)
+++ branches/VP-Grounds/modules/playground.py 2009-02-26 21:01:04 UTC (rev 282)
@@ -123,6 +123,7 @@
else:
#Create new one! :D
self.openObject('avatar-' + user['Avatar'][0], 'av-' + user['Name'], user)
+ if not 'avatar-' + user['Avatar'][0] in self.modObjects.keys(): return
self.objects['av-%s'%user['Name']].show() #Will start downloading, see modules/playground/avatar-static.py for full explanation
else:
@@ -189,7 +190,10 @@
"""
Create an new object, of type `objname`.
"""
+
+ if not objname in self.modObjects.keys(): return
print '## Open Object', name, 'as', objname #DEBUG
+
obj = self.modObjects[objname]
obj = obj(data, self.sh)
self.objects[name] = obj
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-02-25 19:17:21
|
Revision: 281
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=281&view=rev
Author: chozone
Date: 2009-02-25 19:17:16 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
Avatars will now be shown directly, and they will be removed when user leaves ground/VP. You can now (temporarily) switch grounds with F9-F12. Changed the walking speed a bit, you walk slower now.
Modified Paths:
--------------
branches/VP-Grounds/modules/playground/avatar-static.py
branches/VP-Grounds/modules/playground.py
Modified: branches/VP-Grounds/modules/playground/avatar-static.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-static.py 2009-02-25 14:26:58 UTC (rev 280)
+++ branches/VP-Grounds/modules/playground/avatar-static.py 2009-02-25 19:17:16 UTC (rev 281)
@@ -4,20 +4,31 @@
def __init__(self, data, share):
self.sh = share
-
+ self.imageName=data['Avatar'][1]
self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
self.zorder = self.rect.top + self.rect.height
- self.sh['Downloader'].getImage(data['Avatar'][1], self.imageUpdate)
+ def show(self):
+ """
+ Start the whole process of:
+ checking whether avatar is downloaded, [download it], return avatar, and finally: blit ourselves.
+ This has to be a seperate def. If you put this right into __init__, we will make playground blit
+ ourself, before the initialisation is ready. And so, if that's not ready, we're not in the objects
+ list of the playground, and we will not be blitted.
+ """
+ self.sh['Downloader'].getImage(self.imageName, self.imageUpdate)
def imageUpdate(self, image, *arg):
+ """
+ The downloader will call this when he's finished.
+ Will load in the image, and make playground blit our rect.
+ """
self.image = image[0]
self.rect.size = image[1].size
self.zorder = self.rect.top + self.rect.height
self.sh['Playground'].blit(self.rect)
-
def update(self, screen, rect):
if self.rect.colliderect(rect): #Check if the rect collide with ours
rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-02-25 14:26:58 UTC (rev 280)
+++ branches/VP-Grounds/modules/playground.py 2009-02-25 19:17:16 UTC (rev 281)
@@ -22,6 +22,8 @@
self.walkingDir = [False] * 4 #up, left, right, down
self.timer = None
+
+ self.walkingStep=10 #Size(px) of each step.
#Loading all our objects-modules (kinda like interface.py)
@@ -47,27 +49,38 @@
brains.setStatus('busy')
elif ev.key == K_F4:
brains.setStatus('idle')
+
+ elif ev.key == K_F9:
+ self.sh['Connection'].send('POS', ['treehouse.0.0', 0, 0, 0])
+ elif ev.key == K_F10:
+ self.sh['Connection'].send('POS', ['treehouse.0.0', 360, 360, 0])
+ elif ev.key == K_F11:
+ self.sh['Connection'].send('POS', ['treehouse.0.1', 0, 0, 0])
+ elif ev.key == K_F12:
+ self.sh['Connection'].send('POS', ['treehouse.0.1', 360, 360, 0])
+
if self.dontUpdate == False:
+ #TODO: when you move diagonally, your speed should be a bit less, around 7 (this is sqrt(50)... for other walking speeds: walkingStep=sqrt(x^2+x^2) )
if ev.key == K_UP:
- self.walking(0, +15, True)
+ self.walking(0, +self.walkingStep, True)
elif ev.key == K_LEFT:
- self.walking(1, +15, True)
+ self.walking(1, +self.walkingStep, True)
elif ev.key == K_DOWN:
- self.walking(2, +15, True)
+ self.walking(2, +self.walkingStep, True)
elif ev.key == K_RIGHT:
- self.walking(3, +15, True)
+ self.walking(3, +self.walkingStep, True)
elif ev.type == KEYUP:
if self.dontUpdate == False:
if ev.key == K_UP:
- self.walking(0, -15, False)
+ self.walking(0, -self.walkingStep, False)
elif ev.key == K_LEFT:
- self.walking(1, -15, False)
+ self.walking(1, -self.walkingStep, False)
elif ev.key == K_DOWN:
- self.walking(2, -15, False)
+ self.walking(2, -self.walkingStep, False)
elif ev.key == K_RIGHT:
- self.walking(3, -15, False)
+ self.walking(3, -self.walkingStep, False)
@@ -90,15 +103,34 @@
self.loadGround(msg['data'])
elif arg[0] == 'UserUpdate':
- updateRects = []
+ updateRects = [] #What's this??
user = arg[1]
#Is this on our ground? Do we need to update it?
if user.has_key('Pos') and user['Pos'] != None:
+
+ #Has user gone offline, and should we delete the avatar object?
+ if user.has_key('Action') and user['Action']=='Offline':
+ tempRect=self.objects['av-%s'%user['Name']].rect
+ del self.objects['av-%s'%user['Name']]
+ self.blit(tempRect)
+ return
+
+ #Now, create the avatar object, or just move him?
if 'av-' + user['Name'] in self.objects.keys():
+ #Just move the existing object
self.objects['av-%s'%user['Name']].move(user['Pos'])
else:
+ #Create new one! :D
self.openObject('avatar-' + user['Avatar'][0], 'av-' + user['Name'], user)
+ self.objects['av-%s'%user['Name']].show() #Will start downloading, see modules/playground/avatar-static.py for full explanation
+
+ else:
+ #Not in ground, but do we still have the avatar-object?
+ if 'av-' + user['Name'] in self.objects.keys():
+ tempRect=self.objects['av-%s'%user['Name']].rect
+ del self.objects['av-%s'%user['Name']]
+ self.blit(tempRect)
@@ -117,6 +149,9 @@
def blit(self, rect):
+ """
+ Blit all (parts of) objects that are in `rect` in the playground.
+ """
if self.dontUpdate == False:
self.lock.acquire()
self.createRects()
@@ -151,6 +186,9 @@
self.createRects()
def openObject(self, objname, name, data):
+ """
+ Create an new object, of type `objname`.
+ """
print '## Open Object', name, 'as', objname #DEBUG
obj = self.modObjects[objname]
obj = obj(data, self.sh)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <K-...@us...> - 2009-02-25 14:27:03
|
Revision: 280
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=280&view=rev
Author: K-4U
Date: 2009-02-25 14:26:58 +0000 (Wed, 25 Feb 2009)
Log Message:
-----------
Changed the interval to 0.05 @ the walk-timer @ brains.py
Please see the TODO item
Modified Paths:
--------------
branches/VP-Grounds/brains.py
Modified: branches/VP-Grounds/brains.py
===================================================================
--- branches/VP-Grounds/brains.py 2009-02-24 20:14:37 UTC (rev 279)
+++ branches/VP-Grounds/brains.py 2009-02-25 14:26:58 UTC (rev 280)
@@ -95,8 +95,9 @@
#Is our update timer NOT on?
if self.walkUpdateTimer == None or self.walkUpdateTimer.isRunning == False:
- #Start it also!
- self.walkUpdateTimer = self.sh['Interface'].Timer(0.5, self.doWalkUpdate, notFirstTime=True)
+ #Start it also, at the same interval as our normal timer
+ #TODO: Merge these 2 timers together?
+ self.walkUpdateTimer = self.sh['Interface'].Timer(0.05, self.doWalkUpdate, notFirstTime=True)
def doWalk(self):
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-02-24 20:14:42
|
Revision: 279
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=279&view=rev
Author: chozone
Date: 2009-02-24 20:14:37 +0000 (Tue, 24 Feb 2009)
Log Message:
-----------
Avatars are now moved correctly(blit+update is now good). There are still some bugs, like when user enters, you don't see his avatar, and when other people walk, it's waaay too slow.
Modified Paths:
--------------
branches/VP-Grounds/modules/playground/avatar-static.py
branches/VP-Grounds/modules/playground.py
Modified: branches/VP-Grounds/modules/playground/avatar-static.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-static.py 2009-02-22 10:59:48 UTC (rev 278)
+++ branches/VP-Grounds/modules/playground/avatar-static.py 2009-02-24 20:14:37 UTC (rev 279)
@@ -23,3 +23,19 @@
rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
myPos = (self.rect[0] + rect[0], self.rect[1] + rect[1]) #Calculate our position from the rect
screen.blit(self.image, myPos, rect) #Blit
+
+
+ def move(self, pos):
+ """
+ Call this def to move this avatar to pos x=pos[1], y=pos[2].
+ Will update rect, and make playground module update our old+new area
+ """
+ oldRect=self.rect.__copy__()
+
+ self.rect.x=pos[1]
+ self.rect.y=pos[2]
+ self.zorder = self.rect.top + self.rect.height
+
+ updateRect=oldRect.union(self.rect)
+
+ self.sh['Playground'].blit(updateRect)
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-02-22 10:59:48 UTC (rev 278)
+++ branches/VP-Grounds/modules/playground.py 2009-02-24 20:14:37 UTC (rev 279)
@@ -95,7 +95,10 @@
user = arg[1]
#Is this on our ground? Do we need to update it?
if user.has_key('Pos') and user['Pos'] != None:
- self.openObject('avatar-' + user['Avatar'][0], 'av-' + user['Name'], user)
+ if 'av-' + user['Name'] in self.objects.keys():
+ self.objects['av-%s'%user['Name']].move(user['Pos'])
+ else:
+ self.openObject('avatar-' + user['Avatar'][0], 'av-' + user['Name'], user)
@@ -148,6 +151,7 @@
self.createRects()
def openObject(self, objname, name, data):
+ print '## Open Object', name, 'as', objname #DEBUG
obj = self.modObjects[objname]
obj = obj(data, self.sh)
self.objects[name] = obj
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <ch...@us...> - 2009-02-22 10:59:53
|
Revision: 278
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=278&view=rev
Author: chozone
Date: 2009-02-22 10:59:48 +0000 (Sun, 22 Feb 2009)
Log Message:
-----------
You will now see an image when you have multiple lines in your input.
Modified Paths:
--------------
trunk/VP/modules/input.py
Added Paths:
-----------
trunk/VP/images/Input/
trunk/VP/images/Input/multiple.png
Added: trunk/VP/images/Input/multiple.png
===================================================================
(Binary files differ)
Property changes on: trunk/VP/images/Input/multiple.png
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Modified: trunk/VP/modules/input.py
===================================================================
--- trunk/VP/modules/input.py 2009-02-10 19:17:47 UTC (rev 277)
+++ trunk/VP/modules/input.py 2009-02-22 10:59:48 UTC (rev 278)
@@ -14,6 +14,7 @@
fontEndObj = pygame.font.Font(getRealDir('fonts', 'Bitstream Vera Sans.ttf'), 15)
fontEndObj.set_bold(True)
self.textEnd = fontEndObj.render('|', True, (0,130,21))
+ self.multipleLines = loadImage('images', 'Input', 'multiple.png')[0]
self.inputText = ''
@@ -109,16 +110,21 @@
textSurf = self.fontObj.render(visibleLine , True, (0,0,0))
textLength = textSurf.get_width()
-
- if textLength < 350:
+ textWidth = 350 if len(self.inputText.split('\n')) == 1 else 340 #So we have 10px more for the icon, when there are multiple lines
+
+ if textLength < textWidth:
pos = 0
cursorPos = textLength
else:
- pos = textLength - 350
- cursorPos = 350
+ pos = textLength - textWidth
+ cursorPos = textWidth
- area = (pos, 0, 350, textSurf.get_height())
+ area = (pos, 0, textWidth, textSurf.get_height())
+ if len(self.inputText.split('\n'))>1:
+ #Multiple lines, let's show that cool icon!
+ self.surf.blit(self.multipleLines, (355, 4))
+
self.surf.blit(textSurf, (12,4), area)
self.surf.blit(self.textEnd, (10+cursorPos, 2))
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Blu...@us...> - 2009-02-10 19:17:58
|
Revision: 277
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=277&view=rev
Author: BlueWolf_
Date: 2009-02-10 19:17:47 +0000 (Tue, 10 Feb 2009)
Log Message:
-----------
Making the first changes for the ground
Modified Paths:
--------------
branches/VP-Grounds/brains.py
branches/VP-Grounds/connection.py
branches/VP-Grounds/interface.py
branches/VP-Grounds/modules/playground/background.py
branches/VP-Grounds/modules/playground/object.py
branches/VP-Grounds/modules/playground.py
Added Paths:
-----------
branches/VP-Grounds/modules/playground/avatar-static.py
Modified: branches/VP-Grounds/brains.py
===================================================================
--- branches/VP-Grounds/brains.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/brains.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -78,7 +78,6 @@
#Change the values
self.walkingDir[direction] += speedRel
-
#Check if we have to start/stop a timer
if self.walkingDir == [0,0,0,0]: #Not walking
@@ -89,7 +88,6 @@
else: #We are walking
-
#Is our timer NOT running?
if self.walkTimer == None or self.walkTimer.isRunning == False:
#Start it!
@@ -112,11 +110,14 @@
name = self.sh['conf']['account']['user']
users = self.sh['users']
if name in users:
- users[name]['Pos'][1] -= self.walkingDir[0]
- users[name]['Pos'][2] -= self.walkingDir[1]
- users[name]['Pos'][1] += self.walkingDir[2]
- users[name]['Pos'][2] += self.walkingDir[3]
- print users[name]['Pos']
+ users[name]['Pos'][2] -= self.walkingDir[0]
+ users[name]['Pos'][1] -= self.walkingDir[1]
+ users[name]['Pos'][2] += self.walkingDir[2]
+ users[name]['Pos'][1] += self.walkingDir[3]
+
+ self.sh['Interface'].call('playground', 'UserUpdate', users[name])
+
+ #print users[name]['Pos']
def doWalkUpdate(self):
Modified: branches/VP-Grounds/connection.py
===================================================================
--- branches/VP-Grounds/connection.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/connection.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -40,7 +40,7 @@
resp['Reason'] = 'VP' #What we are
resp['Client'] = 'VPclient/0.0.1' #Who we are
resp['Version'] = '1.00' #What protocol-version we're going to use
- resp['Pos'] = ['', 0, 0, 0,] #Our location (Default)
+ resp['Pos'] = ['treehouse.0.0', 0, 0, 0,] #Our location (Default)
auth = {} #Authentation
auth['User'] = self.userAuth[0]
auth['Passwd'] = self.userAuth[1]
Modified: branches/VP-Grounds/interface.py
===================================================================
--- branches/VP-Grounds/interface.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/interface.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -278,6 +278,7 @@
class __Timer():
def __init__(self, forceUpdate, delay, function, *arg, **kwarg):
+
if 'notFirstTime' in kwarg:
del kwarg['notFirstTime']
dontRun = True
@@ -297,6 +298,7 @@
self.timer.start()
def run(self):
+ if self.isRunning == False: return
resp = self.function[0](*self.function[1], **self.function[2])
self.forceUpdate()
Added: branches/VP-Grounds/modules/playground/avatar-static.py
===================================================================
--- branches/VP-Grounds/modules/playground/avatar-static.py (rev 0)
+++ branches/VP-Grounds/modules/playground/avatar-static.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -0,0 +1,25 @@
+from functions import *
+
+class Object():
+ def __init__(self, data, share):
+ self.sh = share
+
+
+ self.rect = Rect(data['Pos'][1], data['Pos'][2], 0, 0)
+ self.zorder = self.rect.top + self.rect.height
+
+ self.sh['Downloader'].getImage(data['Avatar'][1], self.imageUpdate)
+
+ def imageUpdate(self, image, *arg):
+ self.image = image[0]
+ self.rect.size = image[1].size
+ self.zorder = self.rect.top + self.rect.height
+
+ self.sh['Playground'].blit(self.rect)
+
+
+ def update(self, screen, rect):
+ if self.rect.colliderect(rect): #Check if the rect collide with ours
+ rect = rect.move(-self.rect[0], -self.rect[1]) #Move rect to our position
+ myPos = (self.rect[0] + rect[0], self.rect[1] + rect[1]) #Calculate our position from the rect
+ screen.blit(self.image, myPos, rect) #Blit
Modified: branches/VP-Grounds/modules/playground/background.py
===================================================================
--- branches/VP-Grounds/modules/playground/background.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/modules/playground/background.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -2,8 +2,7 @@
class Object():
def __init__(self, data, share):
- self.downloader = share['downloader']
- self.master = share['master']
+ self.sh = share
#Settings defaults
data['background'] = data.get('background', None)
@@ -17,7 +16,7 @@
if self.data['background'] != None:
self.background = None
- self.downloader.getImage(self.data['background'], self.imageChange)
+ self.sh['Downloader'].getImage(self.data['background'], self.imageChange)
else:
self.background = pygame.Surface((726,402))
self.background.fill(self.data['backgroundcolor'])
@@ -35,7 +34,7 @@
pos[0] += image[1].w
pos[1] += image[1].h
pos[0] = 0
- self.master.blit(self.rect)
+ self.sh['Playground'].blit(self.rect)
def update(self, screen, rect):
if self.rect.colliderect(rect): #Check if the rect collide with ours
Modified: branches/VP-Grounds/modules/playground/object.py
===================================================================
--- branches/VP-Grounds/modules/playground/object.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/modules/playground/object.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -2,8 +2,7 @@
class Object():
def __init__(self, data, share):
- self.downloader = share['downloader']
- self.master = share['master']
+ self.sh = share
obj = data['objecttype']
@@ -11,8 +10,6 @@
self.size = [int(i) for i in obj['size']]
self.objZorder = int(obj['zorder'])
- #self.image = None
- #self.imageName = 'default'
self.imageD = obj['imageD']
self.imageN = obj['imageN']
self.imageStyle = 'D'
@@ -30,7 +27,7 @@
else:
name = self.imageN[name]
- self.downloader.getImage(name, self.imageUpdate)
+ self.sh['Downloader'].getImage(name, self.imageUpdate)
def imageUpdate(self, image, *arg):
@@ -38,7 +35,7 @@
if list(image[1].size) != self.size:
self.image[0] = pygame.transform.smoothscale(self.image[0], self.size)
- self.master.blit(self.rect)
+ self.sh['Playground'].blit(self.rect)
def update(self, screen, rect):
Modified: branches/VP-Grounds/modules/playground.py
===================================================================
--- branches/VP-Grounds/modules/playground.py 2009-02-10 19:15:51 UTC (rev 276)
+++ branches/VP-Grounds/modules/playground.py 2009-02-10 19:17:47 UTC (rev 277)
@@ -4,6 +4,7 @@
class Module():
def __init__(self, share, *arg):
self.sh = share
+ self.sh['Playground'] = self
self.dontUpdate = False
self.lock = Lock()
@@ -77,6 +78,7 @@
if msg['state'] == 'wait':
#Wait with updating until all data has arrived
self.dontUpdate = True
+ self.objects = {}
elif msg['state'] == 'free':
#We're free to update!
@@ -93,7 +95,7 @@
user = arg[1]
#Is this on our ground? Do we need to update it?
if user.has_key('Pos') and user['Pos'] != None:
- pass
+ self.openObject('avatar-' + user['Avatar'][0], 'av-' + user['Name'], user)
@@ -108,12 +110,14 @@
screen.blit(self.surf, myPos, rect) #Blit
def close(self):
- pass
+ del self.sh['Playground']
def blit(self, rect):
if self.dontUpdate == False:
self.lock.acquire()
+ self.createRects()
+
collidelist = rect.collidedictall(self.rects)
collidelist = self.sortObjectList(collidelist)
@@ -129,8 +133,6 @@
def loadGround(self, data):
self.ground = data
- self.objects = {}
-
#Loading all the objects
for name, info in data.items():
if name == '_general':
@@ -146,12 +148,8 @@
self.createRects()
def openObject(self, objname, name, data):
- share = {}
- share['downloader'] = self.sh['Downloader']
- share['master'] = self
-
obj = self.modObjects[objname]
- obj = obj(data, share)
+ obj = obj(data, self.sh)
self.objects[name] = obj
@@ -171,7 +169,7 @@
def walking(self, direction, speed, keyDown):
- #Repeating keys prevention.
+ #Repeating key prevention.
#Check if keyDown was already send to this direction
if keyDown == True:
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|
|
From: <Blu...@us...> - 2009-02-10 19:15:56
|
Revision: 276
http://virtplayground.svn.sourceforge.net/virtplayground/?rev=276&view=rev
Author: BlueWolf_
Date: 2009-02-10 19:15:51 +0000 (Tue, 10 Feb 2009)
Log Message:
-----------
Creating a branche for the grounds
Added Paths:
-----------
branches/VP-Grounds/
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|