def __init__(self, w, h, title): self.cam = Camera(90.0, 800/600,1, 100000.0) self.eye = [0.0, -2000.0, 3800.0] self.target = [0.0, 0.0, 2500.0] self.up = [0.0, 0.0, 1.0] self.cam.setPos(self.eye, self.target) self.timer = Timer() self.gridMode = False self.gridAngle = 0 self.gridAxis = [1,0,0] self.graphics = Graphics() self.lighting = Lighting() self.scene = Scene() self.background = Background() self.obj_basic = OBJ('island_basic_1.obj', swapyz=True) self.obj_snow = OBJ('island_basic_snow.obj', swapyz=True) self.obj_rain = OBJ('island_basic_rain.obj', swapyz=True) self.obj = self.obj_basic glutInit(sys.argv) glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH) glutInitWindowSize(w, h) glutInitWindowPosition(800, 600) glEnable(GL_DEPTH_TEST) glShadeModel(GL_SMOOTH) self.lighting.LightSet()
def attack(self): now = pygame.time.get_ticks() if self._current_mana > 0 and now - self._last_attack_time > self._attack_interval: self._last_attack_time = now if self._selected_attack == GameEnums.AttackTypes.FIREBALL.value: shell = Fireball.Fireball( self._rect.centerx, self._rect.centery, 'resources/images/shells/fireball.png', (float(pygame.mouse.get_pos()[0] - self._rect.centerx), float(pygame.mouse.get_pos()[1] - self._rect.centery))) self._current_mana -= 4 return [shell] else: shell_1 = Lighting.Lighting( self._rect.centerx, self._rect.centery, animation_images=Textures.LIGHTING, shooting_direction=(float(pygame.mouse.get_pos()[0] - self._rect.centerx), float(pygame.mouse.get_pos()[1] - self._rect.centery))) shell_2 = Lighting.Lighting( self._rect.centerx, self._rect.centery, animation_images=Textures.LIGHTING, shooting_direction=(float(pygame.mouse.get_pos()[0] - 50 - self._rect.centerx), float(pygame.mouse.get_pos()[1] - 50 - self._rect.centery))) shell_3 = Lighting.Lighting( self._rect.centerx, self._rect.centery, animation_images=Textures.LIGHTING, shooting_direction=(float(pygame.mouse.get_pos()[0] - 50 - self._rect.centerx), float(pygame.mouse.get_pos()[1] + 50 - self._rect.centery))) shell_4 = Lighting.Lighting( self._rect.centerx, self._rect.centery, animation_images=Textures.LIGHTING, shooting_direction=(float(pygame.mouse.get_pos()[0] + 50 - self._rect.centerx), float(pygame.mouse.get_pos()[1] - 50 - self._rect.centery))) shell_5 = Lighting.Lighting( self._rect.centerx, self._rect.centery, animation_images=Textures.LIGHTING, shooting_direction=(float(pygame.mouse.get_pos()[0] + 50 - self._rect.centerx), float(pygame.mouse.get_pos()[1] + 50 - self._rect.centery))) self._current_mana -= 20 return [shell_1, shell_2, shell_3, shell_4, shell_5] return []
def __init__(self, w, h, title): self.KeyInputState = { "reset": False, "space": False, "b": False, "v": False, "g": False, "h": False, "n": False } self.cam = Camera(60., 1.0, 0.1, 1000.0) #self.cam.setPos([0,10,1], [0,0,0]) #self.cam.setPos([10,10,10], [0,0,0]) #self.cam.setPos([10,5,10], [0,0,0]) #self.cam.setPos([10,2,10], [0,0,0]) self.cam.setPos([20, 10, 10], [0, 0, 0]) self.timer = Timer() self.gridMode = False self.gridAngle = 0 self.gridAxis = [1, 0, 0] self.graphics = Graphics() self.lighting = Lighting() self.scene = Scene() self.background = Background() glutInit(sys.argv) glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB | GLUT_DEPTH) glutInitWindowSize(w, h) glutInitWindowPosition(100, 100) glutCreateWindow(title) glClearColor(0.25, 0.25, 0.25, 1.0) glEnable(GL_DEPTH_TEST) self.lighting.LightSet()
def __init__(self): self.loading = LoadingScreen(self) self.camera = Camera(self) self.lighting = Lighting(self) self.balltable = BallTable(self) self.menu = Menu(self) self.decision = Decision(self) self.mousekey = MouseKey(self) self.shotStrength = ShotStrength(self) self.state = GameState.START self.mode = GameMode.TUTORIAL self.balls = [Ball(self)] * 16 self.ballinHole = [None] * 16 self.LastFrameTimePoint = 0
self.updateForce() print(self.vel[0]) print("\n") acc = self.gravity + self.force / self.mass self.vel = self.vel + acc*time self.loc = self.loc + self.vel*time ## initialize object ## game = myGame(750, 750, "201724515 À±½ÂÈñ assigment02") game.grid(True) table = BillTable(billSize, [0, billSize[1]/2.0, 0]) ball1 = Ball(billSize, 5, [1, 0, 0, 1]) ball2 = Ball(billSize, -5, [0, 0, 1, 1]) clock = Timer() clock.start() light = Lighting([0, 100, 0, 0]) light.LightSet() ## toggle setting ## round = False; lightON = True; def draw(): global angle game.frame() drawBackGround() if(round is True) : angle = angle + 0.02 game.setCamera([cameraPos[0]*math.cos(angle) , cameraPos[1], cameraPos[2]*math.sin(angle)], cameraCen, [0, 1, 0]) table.showing() ball1.simulate(clock.getDt())
def __init__(self): QMainWindow.__init__(self) UI.Ui_MainWindow.__init__(self) self.setupUi(self) self.stackedWidget.setCurrentIndex(0) if not (os.path.exists("process")): os.makedirs("process") # 程序启动即初始化栈数据结构 global s s = Stack() s.__init__() global lig lig = Lighting() global col col = Color() # 打开 self.open_.clicked.connect(self.open) # 储存 self.save_.clicked.connect(self.save) # 重置按钮 self.reset_.clicked.connect(self.reset) # 撤销按钮 self.undo_.clicked.connect(self.undo) # 裁剪 self.btn_cut.clicked.connect(self.cut_) # 旋转 self.rotate.clicked.connect(self.page_rotate_show) self.rotate_ensure.clicked.connect(self.rotate_) # 分页 self.editor.clicked.connect(self.page_0_show) self.btn_text.clicked.connect(self.page_1_show) self.btn_denoise.clicked.connect(self.page_2_show) self.btn_statistic.clicked.connect(self.page_3_show) self.btn_filter.clicked.connect(self.page_4_show) self.btn_cutout.clicked.connect(self.page_5_show) self.btn_face.clicked.connect(self.page_6_show) self.btn_sticker.clicked.connect(self.page_7_show) self.btn_change_face.clicked.connect(self.page_8_show) self.filter_more.clicked.connect(self.page_9_show) self.filter_back.clicked.connect(self.page_4_show) # 光效 self.brightness.sliderReleased.connect(self.bright_) self.contrast.sliderReleased.connect(self.contrast_) self.sharpness.sliderReleased.connect(self.sharpness_) # 色彩 self.saturate.sliderReleased.connect(self.saturate_) # 直方图 self.btn_rgb.clicked.connect(self.showRGB) self.btn_pixel.clicked.connect(self.showPixel) # 降噪 self.btn_gaussian.clicked.connect(self.gaussian_) self.btn_blur.clicked.connect(self.blur_) self.btn_smooth_more.clicked.connect(self.smooth_more_) # 文字 self.text_color.clicked.connect(self.text_color_) self.textEnsure.clicked.connect(self.text_) # 滤镜 self.filter_pencil.clicked.connect(self.pencil) self.filter_emboss.clicked.connect(self.emboss) self.filter_blur.clicked.connect(self.blur__) self.filter_smooth.clicked.connect(self.smooth) self.filter_sharpen.clicked.connect(self.sharpen) self.filter_edge.clicked.connect(self.edge) self.filter_sunny.clicked.connect(lambda :self.filter_more_("sunny")) self.filter_trip.clicked.connect(lambda: self.filter_more_("trip")) self.filter_sakura.clicked.connect(lambda: self.filter_more_("sakura")) self.filter_jiangnan.clicked.connect(lambda: self.filter_more_("jiang_nan")) self.filter_wangjiawei.clicked.connect(lambda: self.filter_more_("wangjiawei")) self.filter_prague.clicked.connect(lambda: self.filter_more_("prague")) # 抠图 self.cutout_auto.clicked.connect(self.autocutout_) self.cutout_manu.clicked.connect(self.manucutout_) # 人像 self.face_ensure.clicked.connect(self.face_) # 贴图 self.stick_select.clicked.connect(self.stick_open) self.stick_ensure.clicked.connect(self.stick_) # 换脸 self.change_face_select.clicked.connect(self.change_face_open) self.change_face_ensure.clicked.connect(self.changeface_)