What I’m trying to do is create a menu using a series of image files. The thing is I’m not sure that best method to load and display the images. I know that using the OnscreenImage is taxing on the system to call every frame.
The one thing that I can think of to best compare to what I want to do would be an on-screen scoreboard.
Would a billboard or using the card maker be a better approach to this? If so does anyone have any good links to a decent example on how to set either of these up?
Thanks!
ditus
August 6, 2009, 12:02am
2
hi, this is what im doing at my game, im using it for the score.
'''
Created on 25.06.2009
@author: dirk hochegger
'''
import direct.directbase.DirectStart
from direct.showbase.DirectObject import DirectObject
from pandac.PandaModules import Point3,Vec3,Vec4
from direct.filter.CommonFilters import CommonFilters
import random,math
plates = {}
tex = {}
count = 10
textures = ['textures/counts/zero.png',
'textures/counts/one.png',
'textures/counts/two.png',
'textures/counts/three.png',
'textures/counts/four.png',
'textures/counts/five.png',
'textures/counts/six.png',
'textures/counts/seven.png',
'textures/counts/eight.png',
'textures/counts/nine.png']
space = 0
for i in range(count):
plates[i] = loader.loadModel("models/plane")
firstPOS = Vec3(-5+space,12.5,-1)
plates[i].setPos(firstPOS)
plates[i].setScale(1.4,3.8,.8)
plates[i].reparentTo(render2d)
space +=1.15
for i in range(count):
tex[i] = loader.loadTexture(textures[i])
tex[i].setAnisotropicDegree(0)
tex[i].setMagfilter(0)
plates[i].setTexture(tex[i], 1)
base.disableMouse()
class counts(DirectObject):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
taskMgr.add(self.paint,"paintTASK")
self.points = "9876543210"
def paint(self,task):
time = task.time*1.5
for i in range(count):
xx =int(8+math.sin(time)*9)
xx1 = int(self.points[i])
if ((xx>=0)and(xx < xx1+1)):
plates[i].setTexture(tex[xx], 1)
return task.cont
c = counts()
class getCOUNTS(DirectObject):
def getPLATES(self):
objPLATES = {}
for i in range(len(plates)):
objPLATES[i] = plates[i]
return objPLATES
gc = getCOUNTS()