WorldViz User Forum

WorldViz User Forum (https://forum.worldviz.com/index.php)
-   Vizard (https://forum.worldviz.com/forumdisplay.php?f=17)
-   -   creating floating menu (https://forum.worldviz.com/showthread.php?t=1205)

cookey 09-11-2007 08:00 PM

creating floating menu
 
hi,
i'm a newbie in this programming world..
i'm trying to create a half transparent floating menu in a round shape as below..
http://img512.imageshack.us/img512/5572/menuct9.th.jpg
i have try it for a fortnight but still cant get a solution..
can anyone please guide me?
thanks:p :p

farshizzo 09-12-2007 11:20 AM

Here is a small example that should provide you with enough to get started. You can use the left/right arrow keys to rotate the menu. Let me know if something is not clear.
Code:

import viz
viz.go()

import math


QUADS = 8                #Number of menu quads
RADIUS = 2                #Radius of menu
ANGLE = (360.0 / QUADS)

#Create overlay window for floating menu, with its own view/scene
menuScene = viz.addScene()

menuView = viz.addView()
menuView.setScene(menuScene)

menuWindow = viz.addWindow()
menuWindow.setClearMask(viz.GL_DEPTH_BUFFER_BIT)
menuWindow.setPosition(0,1)
menuWindow.setSize(1,1)
menuWindow.viewpoint(menuView)


#Create root node for menu quads
menu = viz.addGroup(scene = menuScene)
menu.translate(0,1.8,5)

#Create texture to apply to quads
tex = viz.addTexture('ball.jpg')

#Add each menu quad
for x in xrange(QUADS):
        quad = viz.addTexQuad(parent=menu)
       
        angle = ANGLE * x
       
        x = math.sin( viz.radians(angle) ) * RADIUS
        z = math.cos( viz.radians(angle) ) * RADIUS
       
        quad.translate(x,0,z)
        quad.rotate(0,1,0,angle+180)
        quad.texture(tex)
        quad.alpha(0.7)

#Rotate menu using arrow keys
vizact.onkeydown(viz.KEY_LEFT,menu.addAction,vizact.spin(0,1,0,ANGLE*5,0.2))
vizact.onkeydown(viz.KEY_RIGHT,menu.addAction,vizact.spin(0,1,0,-ANGLE*5,0.2))

#Add some model to the normal scene
viz.add('gallery.ive')


cookey 09-17-2007 07:15 PM

thanks
 
thanks..i'll let you know...;)

cookey 09-17-2007 07:51 PM

hye...then how i'm going to declare each menu for each different screen?
i develop a different scene on differ .py file..then, i develop one menu.py, as a main scene , i wonder why i cant link to another .py file by following the scene tutorial??

farshizzo 09-18-2007 05:06 PM

I'm sorry, I don't understand what you are asking. Can you explain it in more detail?

cookey 09-18-2007 05:41 PM

(*^*)
 
hehe..sorry...
i had create a few different scene on different file..let's say scaffold.py and planetDemo.py. Then, i create a transparent menu as i ask before. then i tried to make the button function by click one of the button, and it can link to the scaffold.py file.but the problem is, it only function with .wrl but not .py?why does it happened?:confused:


All times are GMT -7. The time now is 01:43 AM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Copyright 2002-2023 WorldViz LLC