def __init__(self, start_particles, x, y): Thing.__init__(self) self.width = SIZE self.height = SIZE self.x = x self.y = y self.output_buffer = [] self.output_buffer_count = 0 self.particle_life = 50000.0 # set up physics engine self.ode = ode.World() #self.ode.setGravity( (0,0.1,0) ) #self.ode.setERP(0.8) #self.ode.setCFM(10E-10) #self.ode.setContactMaxCorrectingVel(10.0) self.ode_space = ode.Space(type=1) # hashspace #self.ode_space = ode.QuadTreeSpace((0,0,0),(1,1,1),4) # create walls self.ode_floor = ode.GeomPlane(self.ode_space, (0, -1, 0), -TheWorld.unit_range) self.ode_wall_right = ode.GeomPlane(self.ode_space, (-1, 0, 0), -TheWorld.unit_range) self.ode_wall_left = ode.GeomPlane(self.ode_space, (1, 0, 0), -TheWorld.unit_range) self.ode_celing = ode.GeomPlane(self.ode_space, (0, 1, 0), -TheWorld.unit_range) # contact group for collision detection self.ode_contactgroup = ode.JointGroup() # jointgroup for constraining movement to 2d self.ode_2dgroup = ode.JointGroup() # motor group ? self.ode_motorgroup = ode.JointGroup() # jointgroup for fixed objects self.ode_anchorgroup = ode.JointGroup() # create some bodies self.ode_bodies = [] self.start_particles = start_particles #for i in range(start_particles): # self.ode_bodies.append(self.create_body()) # a wall #thick = 5.0 self.ode_walls = [] #self.ode_walls.append(self.create_wall(0.0, -TheWorld.unit_range, TheWorld.unit_range*2 - thick, thick)) # top #self.ode_walls.append(self.create_wall(-TheWorld.unit_range, 0.0, thick, TheWorld.unit_range*2 - thick)) # left #self.ode_walls.append(self.create_wall(0.0, TheWorld.unit_range, TheWorld.unit_range*2 - thick, thick)) # bottom #self.ode_walls.append(self.create_wall(TheWorld.unit_range, 0.0, thick, TheWorld.unit_range*2 - thick)) # right # create a rotor self.rotor = None self.skip = 10 self.skipcount = 0
def __init__(self, x, y, label, target): Thing.__init__(self, x, y, Button.size, Button.size) self.label = label self.target = target # lock position #self.can_drag = False self.color = lambda context : context.set_source_rgb(1.0, 1.0, 1.0)
def __init__(self, root_node): Thing.__init__(self) self.root_node = root_node self.x_offset = 0.0 self.y_offset = 0.0 self.width = 1.5 self.height = 1.5 self.cache_drawing_operations = False self.cached_render = None self.cached_scale = TheWorld.scale
def __init__(self): Thing.__init__(self) TextEditor.__init__(self, "> ") self.cursorindex = 2 self.x = 0.0 self.y = 0.0 self.width = 0.2 self.height = 0.2 fontDescription = pango.FontDescription("Monospace 10") self.layout.set_font_description(fontDescription) self.lock_scale = False self.lock_position = True self.first = True
def __init__(self, x, y, w, h): Thing.__init__(self, x, y, w, h) self.render_children = True self.decorator_size = 10.0 self.mouse_over = False self.mouse_over_sizer = False self.mouse_over_scaler = False self.mouse_over_input = False self.mouse_over_output = False self.mouse_over_rotater = False self.scale_to_container = True self.is_toolbox = ( False ) # TODO We need another way to associate these kind of aspects with objects than base classes as they swell base classes unneccesarily
def __init__(self, label, points = 6.0, font = "Comic Sans MS"): Thing.__init__(self) self.width = 1.0 self.height = 1.0 self.pixel_width = 0.0 self.pixel_height = 0.0 self.scale_x = 1.0 self.scale_y = 1.0 self.size_thing_to_content = True self.size_content_to_thing = not self.size_thing_to_content # pango font_description = pango.FontDescription(font + " " + str(points)) self.layout = TheWorld.text_layout self.layout.set_font_description(font_description) self.label = label
def __init__(self, target): Thing.__init__(self) self.target = target # TODO Need a way of making world objects exempt from scaling, rotation and/or translation transforms size = 0.25 self.width = size self.height = size # set & lock position self.x = -1.0 + (ClassEditor.num_editors * (size * 1.5)) + (size / 2.0) self.y = -1.0 - (size / 2.0) self.can_drag = False # image self.svg = rsvg.Handle('resources/classeditor.svg') ClassEditor.num_editors += 1
def __init__(self, target): Thing.__init__(self) self.target = target # set & lock position self.x = (random() * 2.0) - 1 self.y = (random() * 2.0) - 1 self.width = 0.1 self.height = 0.1 self.pixel_width = 0.0 self.pixel_height = 0.0 # pango self.layout = pango.Layout(TheWorld.pango_context) fontDescription = pango.FontDescription("Sans 8") self.layout.set_font_description(fontDescription) self.text = self.target.__class__.__name__ + "\n" + self.target.code # calc text metrics self.recalc_text_size()