def on_draw(): window.clear() glEnable(GL_BLEND) glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA) rectangle(0, 0, 500, 250, (0.58, 0.64, 0.65, 1)) rectangle(0, 250, 500, 500, (0.17, 0.24, 0.31, 1)) player.draw()
def add_rect(self, layer, offset, width, height): """Adds a rectangle on a given layer,offset with width and height""" # negative layers indicate "unused" layers in a given technology layerNumber = techlayer[layer] if layerNumber >= 0: self.objs.append( geometry.rectangle(layerNumber, offset, width, height))
def add_rect(self, layer, offset, width, height): """Adds a rectangle on a given layer,offset with width and height""" debug.info( 3, "adding rectangle (" + str(layer) + ") :" + str(width) + "x" + str(height) + " @ " + str(offset)) # negative layers indicate "unused" layers in a given technology layerNumber = techlayer[layer] if layerNumber >= 0: self.objs.append( geometry.rectangle(layerNumber, offset, width, height))
def add_rect(self, layer, offset, width=0, height=0): """Adds a rectangle on a given layer,offset with width and height""" if width==0: width=drc["minwidth_{}".format(layer)] if height==0: height=drc["minwidth_{}".format(layer)] # negative layers indicate "unused" layers in a given technology layer_num = techlayer[layer] if layer_num >= 0: self.objs.append(geometry.rectangle(layer_num, offset, width, height)) return self.objs[-1] return None
def add_rect_center(self, layer, offset, width=0, height=0): """Adds a rectangle on a given layer at the center point with width and height""" if width==0: width=drc["minwidth_{}".format(layer)] if height==0: height=drc["minwidth_{}".format(layer)] # negative layers indicate "unused" layers in a given technology layer_num = techlayer[layer] corrected_offset = offset - vector(0.5*width,0.5*height) if layer_num >= 0: self.objs.append(geometry.rectangle(layer_num, corrected_offset, width, height)) return self.objs[-1] return None
def show_zoom(x,y): h, w = img.dimensions img_box = rectangle() img_box.pos = coordinates(0,0) img_box.dim = coordinates(w,h) box = img_box.get_rectangle_inside(zoom_window_size/zoom_factor, coordinates(x,y)) f, t = box.corners() #zoom = cv2.getRectSubPix(img, (800, 600), (x+0.5, y+0.5)) #cv2.GetSubRect(img, (60, 70, 32, 32)) #zoom = cv2.getRectSubPix(img, (200, 200), (x, y)) #zoom = img[f.y:t.y, f.x:t.x] ## http://docs.opencv.org/modules/imgproc/doc/geometric_transformations.html#resize cv2.resize(img.data[f.y:t.y, f.x:t.x], dsize=(zoom_window_size,zoom_window_size), dst=zoom, interpolation=cv2.INTER_NEAREST) cv2.imshow('Detail', zoom)
def add_rect(self, layer, offset, width=None, height=None): """ Adds a rectangle on a given layer,offset with width and height """ if not width: width = drc["minwidth_{}".format(layer)] if not height: height = drc["minwidth_{}".format(layer)] # negative layers indicate "unused" layers in a given technology lpp = techlayer[layer] if lpp[0] >= 0: self.objs.append(geometry.rectangle(lpp, offset, width, height)) return self.objs[-1] return None
cam1.process_keyboard(camera.Movement.backward, delta_time) if keys[GLFW_KEY_A]: cam1.process_keyboard(camera.Movement.left, delta_time) if keys[GLFW_KEY_D]: cam1.process_keyboard(camera.Movement.right, delta_time) window = initialize_glfw(width=600, height=600, key_callback=key_callback, mouse_callback=mouse_callback, scroll_callback=scroll_callback) # glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED) w, h = glfwGetFramebufferSize(window) glViewport(0, 0, w, h) # glDepthRange(-10, 10) # Create objects points2, indices2 = box() points1, indices1 = rectangle(3, 3) colors2 = np.array([ 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 1, 1, 1, 0, 0, 1, 0, 1, 1, 1, 0, 1, 1, 1, ], dtype=np.float32) vao1, vbo1, ebo1 = create_vertex_array2(coords=points1, indices=indices2) vao2, vbo2, ebo2 = create_vertex_array2(coords=points2, colors=colors2, indices=indices2)
import geometry figure = input( "What figure will you choose? Enter S for square, R for rectangle, T for triangle, C for circle, \n RH for rhombus or TR for trapezium. " ) if figure.lower() == 's': dimension_x = int(input("Please enter length of the side this square: ")) print("The field of this figure is: ", geometry.square(dimension_x)) elif figure.lower() == 'r': dimension_x = int( input("Please enter length of the one side this rectangle: ")) dimension_y = int(input("And the other side has dimension: ")) print("The field of this figure is: ", geometry.rectangle(dimension_x, dimension_y)) elif figure.lower() == 't': dimension_a = int(input("Please enter length of the triangle base: ")) dimension_h = int(input("And its height: ")) print("The field of this figure is: ", geometry.triangle(dimension_a, dimension_h)) elif figure.lower() == 'c': dimension_r = int(input("Please enter length of the radius: ")) print("The field of this figure is: ", geometry.circle(dimension_r)) elif figure.lower() == 'rh': dimension_e = int( input("Please enter length of the one diagonal this rhombus: ")) dimension_f = int(input("And the other diagonal has dimension: ")) print("The field of this figure is: ", geometry.rhombus(dimension_e, dimension_f)) elif figure.lower() == 'tr': dimension_a = int(input("Please enter length of the trapezium base: "))