<https://lh3.googleusercontent.com/-k8qFSmb4CkA/WpPf1Ou2k2I/AAAAAAAAAFA/85r6ycJHV64u-XpSp8gt-vaTf6SEUA20wCL4CGAYYCw/s1600/capture.png>
Hi Benjamin,

Merci beaucoup for the fast answer!
Thank you for idea of the drawing list it will help me a lot! 
Before I got your message, I already started a new class called ring with a 
dictionnary for the midi keys mapping and I writed two render functions. 
One for iddle state and the second when an event occurs.

What I want to implement:
I want to keep the ring printed on screen and when an event occur, the 
sector concerned would glown shine or I dont know what kind of fancy effect 
(here I drawn a blue sector).

I don't know much about pyglet structure, batch or vlist. and I don't know 
how to implement it properly. Should I integrate the draw_list into my ring 
class? Can I write a function in the sector class who tweak the sector and 
I call this function directly on the dictionnary? There is a lot of points 
I don't master and I want to write it like KISS. (Keep It Simple and Stupid)

Thank you for your support! I appreciate that :D I sought an active 
community to ask questions and learn. here I am 

Eelke

Here is my code:
from pyglet.gl import *
from math import *
from pyglet.window import key

class sector(object):
    def __init__(self, radius, inner_radius, angle, angle_in,points):
        self.radius = radius
        self.inner_radius = inner_radius
        self.angle = angle
        self.angle_in = angle_in
        self.points = points
        self.vertex = []
        self.color = []
        self.indices = []
        for i in range(points):
            angle=self.angle*(i/(points-1))+angle_in
            x=cos(angle)*radius
            y=sin(angle)*radius
            z=0
            self.vertex.extend([x,y,z])
            self.color.extend([255,800,45])
        for i in range(points):
            angle=self.angle-self.angle*(i/(points-1))+angle_in
            x=cos(angle)*inner_radius
            y=sin(angle)*inner_radius
            z=0
            self.vertex.extend([x,y,z])
            self.color.extend([255,120,12])
        for i in range(points-1):
            n = 2*points-1
            self.indices.extend([i,i+1,n-i])
            self.indices.extend([n-i,n-1-i,i+1])
    def render(self):
        self.vertices = pyglet.graphics.draw_indexed(2*self.points,
GL_TRIANGLES,self.indices,('v3f', self.vertex),('c3B',self.color))
    def played(self):
        self.color = []
        for i in range(2*self.points):
            self.color.extend([0,0,255])
        self.vertices = pyglet.graphics.draw_indexed(2*self.points,
GL_TRIANGLES,self.indices,('v3f', self.vertex),('c3B',self.color))

class ring(object):
    def __init__(self):
        self.notes = {
        'c' : None,
        'c#': None,
        'd' : None,
        'd#': None,
        'e' : None,
        'f' : None,
        'f#': None,
        'g' : None,
        'g#': None,
        'a' : None,
        'a#': None,
        'b' : None
        }
        i=0
        for note in self.notes:
            self.notes[note] = sector(0.7,0.6,pi/6.4,2*i*pi/12,360)
            i+=1
    def render(self):
        for note in self.notes:
            self.notes[note].render()


-- 
You received this message because you are subscribed to the Google Groups 
"pyglet-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pyglet-users+unsubscr...@googlegroups.com.
To post to this group, send email to pyglet-users@googlegroups.com.
Visit this group at https://groups.google.com/group/pyglet-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to