Exemplo n.º 1
0
def load_font(bold=False, italic=False):
    id_ = options.get("text_fontname", str) + "-%s-%s" % (bold, italic)
    if id_ not in fonts:
        fonts[id_] = pygame.font.SysFont(options.get("text_fontname", str),
                                         options.get("text_fontsize", int),
                                         bold=bold,
                                         italic=italic)
Exemplo n.º 2
0
def draw_text(text, color, pos, offset, size, bold=False, italic=False):
    load_font(bold=bold, italic=italic)

    id_="text-%s-%s-%s-%s" % (text, color, bold, italic)

    fontid=options.get("text_fontname", str)+"-%s-%s" % (bold, italic)
    
    def render():
        surf=fonts[fontid].render(text, True, color)
        return surf

    texture.bind_with_func(render, id_)

    texwidth, texheight=texture.surfaces[id_][0].get_size()

    texwidth/=float(options.get("text_fontsize", int))
    texheight/=float(options.get("text_fontsize", int))

    texwidth*=size
    texheight*=size

    glEnable(GL_TEXTURE_2D)

    glBegin(GL_QUADS)
    glTexCoord2f(0, 0)
    glVertex2f(pos[0]+(texwidth*offset[0]), pos[1]+(texheight*offset[1]))
    glTexCoord2f(0, 1)
    glVertex2f(pos[0]+(texwidth*offset[0]), pos[1]+texheight+(texheight*offset[1]))
    glTexCoord2f(1, 1)
    glVertex2f(pos[0]+texwidth+(texwidth*offset[0]), pos[1]+texheight+(texheight*offset[1]))
    glTexCoord2f(1, 0)
    glVertex2f(pos[0]+texwidth+(texwidth*offset[0]), pos[1]+(texheight*offset[1]))
    glEnd()
Exemplo n.º 3
0
def reopen():
    global win

    dpysize=[options.get("dpy_width", int), options.get("dpy_height", int)]

    win=pygame.display.set_mode(dpysize, RESIZABLE | OPENGL | DOUBLEBUF)
    pygame.display.set_caption("Vectorblast")
    glViewport(0, 0, *dpysize)
Exemplo n.º 4
0
def main():
    """The main application execution."""
    try:
        thread.start_new_thread(start, ())
        suppress = options.get(
            'suppress',
            util.get_configuration_value('suppressBrowser', False)
        )
        if suppress is False:
            webbrowser.open_new_tab('http://localhost:' + str(
                options.get('port', util.get_configuration_value('port', 3333))
            ))

        while(True):
            time.sleep(10)
    except KeyboardInterrupt:
        sys.exit()
Exemplo n.º 5
0
def get_configuration_value(key, default = None):
    """Fetches a configuration value from the configuration file."""
    try:
        return json.loads(
            open(options.get('config', 'configuration.json')).read()
        )[key]
    except:  # pylint: disable=W0702
        return default
Exemplo n.º 6
0
    def __init__(self):
        self.pos=[0, 0, 1]
        self.vel=[0, 0, 0]
        self.rot=[0, 0]

        self.height=Lowpass(self.pos[2], 16) # camera height alignment speed(view smoothing from landings, stairs

        self.step_height=options.get("player_step_height", float)

        self.hit=[0, 0, 0]

        self.recoil=Lowpass(0, 3)

        self.jump=0

        self.controls={}
        self.damping=[ # Air damping, ground damping: it takes that many seconds to get to zero velocity
            options.get("player_damping_air", float),
            options.get("player_damping_ground", float)
            ]
        self.speed=[ # Air speed, ground speed: acceleration per second
            options.get("player_accel_air", float),
            options.get("player_accel_ground", float)
            ]
        
        self.gun_rot=[0, 0, 0]
        self.gun_offset=[0, 0, 0]
        self.gun_mult=0
        self.gun_spin=0

        self.gun_rotation_speed=Lowpass(0, 5)

        self.gun_sway=[
            Lowpass(0, options.get("view_gun_stiffness", float)),
            Lowpass(0, options.get("view_gun_stiffness", float)),
            Lowpass(0, options.get("view_gun_stiffness", float))
            ]

        self.time=0

        self.zoom=0
        
        self.weapon=0
        self.weapons=[]
        for w in wepdefs:
            self.weapons.append(Weapon(self, w))

        for w in self.weapons:
            model.precache("weapon_"+w.name, {"body": [1.0, 1.0, 1.0, 1.0, w.name], "muzzleflash": [1.0, 1.0, 1.0, 0.0, "muzzleflash"]})
            model.precache("weapon_"+w.name, {"body": [1.0, 1.0, 1.0, 1.0, w.name], "muzzleflash": [1.0, 1.0, 1.0, 1.0, "muzzleflash"]})
            if w.wepdef.spin:
                glRotatef(self.gun_spin, 0, 1, 0)
                model.precache("weapon_"+w.name+"_spin", {"spin": [1.0, 1.0, 1.0, 1.0, w.name+"_spin"], "muzzleflash": [1.0, 1.0, 1.0, 0.0, "muzzleflash"]})
                model.precache("weapon_"+w.name+"_spin", {"spin": [1.0, 1.0, 1.0, 1.0, w.name+"_spin"], "muzzleflash": [1.0, 1.0, 1.0, 1.0, "muzzleflash"]})
Exemplo n.º 7
0
def start():
    """Starts up the application server."""
    log.msg('Starting server...')
    # pylint: disable=W0142
    application = tornado.web.Application(URLS, **SETTINGS)
    # pylint: enable=W0142
    port = options.get('port', util.get_configuration_value('port', 3333))
    log.msg('Listening on port ' + str(port) + '.')
    application.listen(port)
    tornado.ioloop.IOLoop.instance().start()
def get_imgs_more(username, session, title, types, n=None, format='[%y-%m-%d] id_ppage', cw=None, mode='media', method='tab', imgs=None):
    print_ = get_print(cw)
    imgs = imgs or []
    print_('imgs: {}, types: {}'.format(len(imgs), ', '.join(types)))

    artist, username = get_artist_username(username, session)#
    
    # Range
    n = max(n or 0, get_max_range(cw))

    ids_set = set(img.id for img in imgs)

    count_no_imgs = 0

    filter_ = '' if options.get('experimental') else ' filter:media' #2687

    while len(imgs) < n:
        if ids_set:
            max_id = min(ids_set) - 1
            q = 'from:{} max_id:{} exclude:retweets{} -filter:periscope'.format(username, max_id, filter_)
        else:
            q = 'from:{} exclude:retweets{} -filter:periscope'.format(username, filter_)
        print(q)

        tweets = []
        for tweet in list(TwitterAPI(session, cw).search(q)):
            id = int(tweet['id'])
            if id in ids_set:
                print_('duplicate: {}'.format(id))
                continue
            ids_set.add(id)
            tweets.append(tweet)
            
        if tweets:
            count_no_imgs = 0
        else:
            count_no_imgs += 1
            change_ua(session)
            if count_no_imgs >= 3:
                break
            print_('retry...')
            continue
        
        for tweet in tweets:
            imgs += get_imgs_from_tweet(tweet, session, types, format, cw)

        msg = '{}  {} (@{}) - {}'.format(tr_('읽는 중...'), artist, username, len(imgs))
        if cw and not cw.alive:
            break
        if cw:
            cw.setTitle(msg)
        else:
            print(msg)

    return imgs
Exemplo n.º 9
0
def draw_text(text, color, pos, offset, size, bold=False, italic=False):
    load_font(bold=bold, italic=italic)

    id_ = "text-%s-%s-%s-%s" % (text, color, bold, italic)

    fontid = options.get("text_fontname", str) + "-%s-%s" % (bold, italic)

    def render():
        surf = fonts[fontid].render(text, True, color)
        return surf

    texture.bind_with_func(render, id_)

    texwidth, texheight = texture.surfaces[id_][0].get_size()

    texwidth /= float(options.get("text_fontsize", int))
    texheight /= float(options.get("text_fontsize", int))

    texwidth *= size
    texheight *= size

    glEnable(GL_TEXTURE_2D)

    glBegin(GL_QUADS)
    glTexCoord2f(0, 0)
    glVertex2f(pos[0] + (texwidth * offset[0]),
               pos[1] + (texheight * offset[1]))
    glTexCoord2f(0, 1)
    glVertex2f(pos[0] + (texwidth * offset[0]),
               pos[1] + texheight + (texheight * offset[1]))
    glTexCoord2f(1, 1)
    glVertex2f(pos[0] + texwidth + (texwidth * offset[0]),
               pos[1] + texheight + (texheight * offset[1]))
    glTexCoord2f(1, 0)
    glVertex2f(pos[0] + texwidth + (texwidth * offset[0]),
               pos[1] + (texheight * offset[1]))
    glEnd()
Exemplo n.º 10
0
 def post_processing(self):
     cw = self.customWidget
     with cw.convert(self):
         outdir = get_outdir(self.type)
         out = os.path.join(outdir, self.title + '.mp4')
         ffmpeg.join(cw.names, out, cw)
         cw.removeDirList.append((self.dir, False))
         self.single = True
         cw.setNameAt(0, out)
         del cw.imgs[1:]
         cw.dones.add(os.path.realpath(out))
         if not options.get('lazy'):
             cw.pageIcon.hide()
             cw.after_label.setText('')
         cw.dir = outdir
Exemplo n.º 11
0
 def start_(self):
     cw = self.customWidget
     self.read()
     if self.status == 'stop':
         return True
     cw.dir = self.dir
     cw.urls = self.urls
     self.size = Size()
     cw.setColor('downloading')
     self.exec_queue.run(lambda: cw.pbar.setMaximum(MAX_PBAR))
     self.exec_queue.run(lambda: cw.pbar.setFormat('%p%'))
     if not options.get('lazy'):
         self.exec_queue.put(
             (cw, 'customWidget.iconLabel.setPixmap(QtGui.QPixmap())'))
     cw.downloader_pausable = True
     self.update_tools_buttons()
     if cw.paused:
         data = cw.pause_data
         self._filesize_prev = data['filesize']
         cw.paused = False
         cw.pause_lock = False
         self.update_tools_buttons()
     torrent.download(self._info,
                      save_path=self.dir,
                      callback=self.callback)
     if cw.alive:
         self.exec_queue.run(lambda: cw.setSpeed(''))
     if cw.pause_lock and cw.pbar.value() < cw.pbar.maximum():
         cw.pause_data = {
             'type': self.type,
             'url': self.url,
             'filesize': self._filesize_prev
         }
         cw.paused = True
         cw.pause_lock = False
         self.update_tools_buttons()
         return True
     self.title = self.name
     if not self.single:
         self.exec_queue.run(lambda: cw.pbar.setMaximum(len(cw.imgs)))
# -*- coding: utf-8 -*-
from collections import deque
import gym
from environment.environment import Environment
import numpy as np
import cv2

cv2.ocl.setUseOpenCL(False)  # prevent opencv to use GPU
import options

flags = options.get()


class GymEnvironment(Environment):
    frames_per_state = 4
    max_step = 3000
    state_scaler = 255.

    def get_action_shape(self):
        return [(1, len(self.actions_set))
                ]  # take 1 action of n possible types

    def get_state_shape(self):
        if self.use_ram:
            return [(128, 1, self.frames_per_state)]
        return [(42, 42, self.frames_per_state)]

    def __init__(self, id, environment_name):
        self.id = id
        # setup environment
        self.__game = gym.make(environment_name)
Exemplo n.º 13
0
OG(
    'mnist_convlstm_stoch',
    'mnist_convlstm',
    MNIST_CONVLSTM_STOCHASTIC=True,
)


def _verify_(key, value):
    print(key, '<-', value)
    assert key in globals(), ('%s is new variable' % key)


if exp_name not in options._options_:
    print('*' * 10 + ' WARNING -- no option group active ' + '*' * 10)
else:
    print('running experiment', exp_name)
    for key, value in options.get(exp_name).items():
        _verify_(key, value)
        globals()[key] = value

#stuff which must be computed afterwards

# camera stuffs
fx = W / 2.0 * 1.0 / math.tan(fov * math.pi / 180 / 2)
fy = fx
focal_length = fx / (W / 2.0)  #NO SCALING

x0 = W / 2.0
y0 = H / 2.0
Exemplo n.º 14
0
        log.debug('message.send delay {}'.format(secs))
        message.send(secs, frate)

        ms = int((message.delivery - time()) * 1000)
        sending.put(PrioritizedItem(ms, message))

        message = Message().get()

    while not (sending.empty()):
        message = sending.get().item
        remaining = message.delivery - time()
        while 0 < remaining:
            log.debug('message {} secs remaining to send'.format(remaining))
            sleep(remaining)
            remaining = message.delivery - time()
        message.put()


if __name__ == '__main__':
    # get configuration values
    #     messages (number of) for producer
    #     update_rate for monitor
    #     mean_processing_time for sender
    #     failure_rate for sender
    #
    config = options.get(sys.argv)
    log = config['log']

    sender(config)
Exemplo n.º 15
0
    def update(self, d):
        for w in self.weapons:
            w.update(d)

        self.recoil.update(d, 0)

        if self.get_control("shoot"):
            if self.weapons[self.weapon].fire():
                self.recoil.value=1

                l=-self.weapons[self.weapon].wepdef.knockback

                xm=cos(radians(self.rot[0]))
                zm=-sin(radians(self.rot[0]))
                self.vel[0]+=sin(radians(self.rot[1]))*xm*l
                self.vel[1]+=cos(radians(self.rot[1]))*xm*l
                self.vel[2]+=zm*l

        self.time+=d

        self.rot[0]=clamp(-90, self.rot[0], 90)
        speed=d*self.get_speed()

        walking=False

        if self.get_control("weapon_next"):
            self.weapon+=1
            self.recoil.value=0.4
        if self.get_control("weapon_prev"):
            self.weapon-=1
            self.recoil.value=0.4
            
        if self.weapon < 0:
            self.weapon+=len(self.weapons)
        elif self.weapon >= len(self.weapons):
            self.weapon-=len(self.weapons)

        if self.get_control("walk_forward"):
            self.vel[0]+=sin(radians(self.rot[1]))*speed
            self.vel[1]+=cos(radians(self.rot[1]))*speed
            walking=True

        if self.get_control("walk_backward"):
            self.vel[0]-=sin(radians(self.rot[1]))*speed
            self.vel[1]-=cos(radians(self.rot[1]))*speed
            walking=True

        if self.get_control("strafe_left"):
            self.vel[0]-=sin(radians(self.rot[1]+90))*speed
            self.vel[1]-=cos(radians(self.rot[1]+90))*speed
            walking=True

        if self.get_control("strafe_right"):
            self.vel[0]+=sin(radians(self.rot[1]+90))*speed
            self.vel[1]+=cos(radians(self.rot[1]+90))*speed
            walking=True

        self.vel[2]-=options.get("gravity", float)*d

        if self.hit[2]:
            self.jump=1
            
        if self.get_control("jump") and self.jump > 0:
            if options.get("player_superjump", bool) and not self.hit[2]:
                l=((self.vel[0]**2)+(self.vel[1]**2)+(self.vel[2]**2))**0.5
                l*=0.5
                xm=cos(radians(self.rot[0]))
                zm=-sin(radians(self.rot[0]))
                self.vel[0]+=sin(radians(self.rot[1]))*xm*l
                self.vel[1]+=cos(radians(self.rot[1]))*xm*l
                self.vel[2]+=zm*l
                self.vel[2]+=options.get("player_jump_force", float)*0.75
                self.jump-=1
            else:
                self.vel[2]+=options.get("player_jump_force", float)

        if world != None:
            boxes=world.hit([-0.5+self.pos[0], -0.5+self.pos[1], self.pos[2]+self.vel[2]*d, 1, 1, 2.0])
            self.hit[2]=False
            hit=False
            jump=False
            for b in boxes:
                if self.vel[2] > 0:
                    if self.pos[2] > b[3]-2:
                        self.pos[2]=b[3]-2
                else:
                    if b[0] == "jumppad":
                        self.vel=[b[7], b[8], b[9]]
                        sound.play_sound("jumppad")
                        jump=True
                    else:
                        if self.pos[2] < b[3]+b[6]:
                            self.pos[2]=b[3]+b[6]
                        self.hit[2]=True
                hit=True

            if hit and not jump:
                self.vel[2]=0

            boxes=world.hit([-0.5+self.pos[0]+self.vel[0]*d, -0.5+self.pos[1], self.pos[2], 1, 1, 2.0])

            height=-float("inf")
            self.hit[0]=False
            for b in boxes:
                if self.vel[0] > 0:
                    if self.pos[0] > b[1]-0.5:
                        self.pos[0]=b[1]-0.5
                else:
                    if self.pos[0] < b[1]+b[4]+0.5:
                        self.pos[0]=b[1]+b[4]+0.5
                if height < b[3]+b[6]:
                    height=b[3]+b[6]
                self.hit[0]=True

            boxes=world.hit([-0.5+self.pos[0], -0.5+self.pos[1]+self.vel[1]*d, self.pos[2], 1, 1, 2.0])

            if height < self.pos[2]+self.step_height and height > self.pos[2]:
                self.pos[2]=height
                self.hit[0]=False
                if self.vel[2] < 0:
                    self.vel[2]=0

            height=0

            self.hit[1]=False
            for b in boxes:
                if self.vel[1] > 0:
                    if self.pos[1] > b[2]-0.5:
                        self.pos[1]=b[2]-0.5
                else:
                    if self.pos[1] < b[2]+b[5]+0.5:
                        self.pos[1]=b[2]+b[5]+0.5
                if height < b[3]+b[6]:
                    height=b[3]+b[6]
                self.hit[1]=True

            if height < self.pos[2]+self.step_height and height > self.pos[2]:
                self.pos[2]=height
                self.hit[1]=False
                if self.vel[2] < 0:
                    self.vel[2]=0

            if self.hit[0]:
                self.vel[0]=0

            if self.hit[1]:
                self.vel[1]=0

        self.height.update(d, self.pos[2])

        self.pos[0]+=self.vel[0]*d
        self.pos[1]+=self.vel[1]*d
        self.pos[2]+=self.vel[2]*d

        self.gun_rotation_speed.update(d, 0)

        if self.get_control("shoot"):
            self.gun_rotation_speed.value=720

        self.vel[0]*=crange(0, d, self.damping[int(self.hit[2])], 1, 0)
        self.vel[1]*=crange(0, d, self.damping[int(self.hit[2])], 1, 0)
        self.vel[2]*=crange(0, d, self.damping[0], 1, 0)

        self.gun_rot[0]-=crange(0, d, 0.1, 0, self.gun_rot[0]-self.rot[0])
        self.gun_spin+=d*self.gun_rotation_speed.value
        self.gun_rot[2]-=crange(0, d, 0.1, 0, self.gun_rot[2]-self.rot[1])

        sway_clamp=5

        self.gun_rot[0]=clamp(self.rot[0]-sway_clamp, self.gun_rot[0], self.rot[0]+sway_clamp)
        self.gun_rot[2]=clamp(self.rot[1]-sway_clamp, self.gun_rot[2], self.rot[1]+sway_clamp)

        self.gun_rot[0]-=self.recoil.value*4
        self.gun_rot[1]=self.recoil.value*8

        self.gun_offset[0]=0.21*(1-self.get_zoom())
        self.gun_offset[1]=0.2-(self.recoil.value*0.08)
        self.gun_offset[2]=-0.24-(self.recoil.value*0.12)

        rot=sin(self.time*10)

        if not self.hit[2]:
            walking=0

        if self.gun_mult < walking:
            self.gun_mult+=d*10
        elif self.gun_mult > walking:
            self.gun_mult-=d*10

        self.gun_mult=clamp(0, self.gun_mult, 1)

        if self.zoom < self.get_control("scope"):
            self.zoom+=d*5
        elif self.zoom > self.get_control("scope"):
            self.zoom-=d*5

        self.zoom=clamp(0, self.zoom, 1)

        self.gun_offset[0]-=self.gun_mult*(sin(rot)*0.02)
        self.gun_offset[2]-=self.gun_mult*((cos(rot)*0.02)-0.02)

        sway_clamp=0.1
        sway_mult=0.004

        self.gun_sway[0].update(d, clamp(-sway_clamp, -self.vel[0]*sway_mult, sway_clamp))
        self.gun_sway[1].update(d, clamp(-sway_clamp, -self.vel[1]*sway_mult, sway_clamp))
        self.gun_sway[2].update(d, clamp(-sway_clamp, -self.vel[2]*sway_mult, sway_clamp))
Exemplo n.º 16
0
def get_imgs_more(username,
                  session,
                  title,
                  types,
                  n=None,
                  format='[%y-%m-%d] id_ppage',
                  cw=None,
                  mode='media',
                  method='tab',
                  imgs=None):
    print_ = get_print(cw)
    imgs = imgs or []
    print_('imgs: {}, types: {}'.format(len(imgs), ', '.join(types)))

    artist, username = get_artist_username(username, session, cw)  #

    # Range
    n = max(n or 0, get_max_range(cw))

    ids_set = set(img.id for img in imgs)

    count_no_tweets = 0
    count_no_imgs = 0

    while check_alive(cw) or len(imgs) < n:
        if options.get('experimental') or count_no_tweets:  #2687, #3392
            filter_ = ''
        else:
            filter_ = ' filter:media'
        cache_guest_token = bool(count_no_tweets)

        if ids_set:
            max_id = min(ids_set) - 1
            q = 'from:{} max_id:{} exclude:retweets{} -filter:periscope'.format(
                username, max_id, filter_)
        else:
            q = 'from:{} exclude:retweets{} -filter:periscope'.format(
                username, filter_)
        print(q)

        tweets = []
        for tweet in list(
                TwitterAPI(session, cw, cache_guest_token).search(q)):
            id = int(tweet['id'])
            if id in ids_set:
                print_('duplicate: {}'.format(id))
                continue
            ids_set.add(id)
            tweets.append(tweet)

        if tweets:
            exists_more_imgs = False
            for tweet in tweets:
                imgs_tweet = get_imgs_from_tweet(tweet, session, types, format,
                                                 cw)
                if imgs_tweet:
                    imgs += imgs_tweet
                    exists_more_imgs = True
            if exists_more_imgs:
                count_no_imgs = 0
            else:
                count_no_imgs += 1
                if count_no_imgs >= RETRY_MORE_IMGS:  #4130
                    break
            count_no_tweets = 0
        else:
            count_no_tweets += 1
            change_ua(session)
            if count_no_tweets >= RETRY_MORE:
                break
            print_('retry... {}'.format(count_no_tweets))
            continue

        msg = '{}  {} (@{}) - {}'.format(tr_('읽는 중...'), artist, username,
                                         len(imgs))
        if cw:
            cw.setTitle(msg)
        else:
            print(msg)

    return imgs
Exemplo n.º 17
0
        for key, value in latest_weather.iteritems():
            name = self.to_underscore(key)
            self.guages["{}".format(key)] = Gauge(
                "weather_{}".format(name), "Current Weather {}".format(name),
                ['city'])

    def report_metrics(self, city):
        self.weather["{}".format(city)] = {}
        self.get_weather(city)
        latest_weather = self.weather["{}".format(city)]
        try:
            self.add_guage(latest_weather['currently'])
        except:
            pass

        try:
            for key, value in latest_weather['currently'].iteritems():
                if type(value) == int or type(value) == float:
                    self.guages["{}".format(key)].labels(city).set(value)
        except:
            pass


if __name__ == "__main__":
    options = options.get()
    exporter = WeatherExporter(options)
    start_http_server(int(options['endpoint_port']))
    while True:
        for city in options['cities'].split(','):
            exporter.report_metrics(city)
        time.sleep(int(options['scrape_interval']))
Exemplo n.º 18
0
import options
from process import Process
import art
import list

if __name__ == '__main__':

    art.header()

    option = options.get()

    tests = option[0]
    resources = option[2]

    if tests:
        process = Process(option[1])
        process.run(tests, option[1])

    elif resources:
        list.simple(option[3], resources)

    else:
        print(
            "execute_tests.py: error: invalid input - check specified resource exists and is spelled correctly"
        )
from matplotlib.patches import Circle
from matplotlib.collections import PatchCollection
from matplotlib.lines import Line2D
from matplotlib.gridspec import GridSpec

import math
import datetime
import re
import numpy as np

import seaborn as sns # heatmaps
import imageio # GIFs
from PIL import Image, ImageFont, ImageDraw # images

import options
flags = options.get() # get command line args

def plot(logs, figure_file):
	# Get plot types
	stats = {}
	key_ids = {}
	for i in range(len(logs)):
		log = logs[i]
		# Get statistics keys
		if log["length"] < 2:
			continue
		(step, obj) = next(log["data"])
		log_keys = sorted(obj.keys()) # statistics keys sorted by name
		for key in log_keys:
			if key not in key_ids:
				key_ids[key] = len(key_ids)
Exemplo n.º 20
0
def load_font(bold=False, italic=False):
    id_=options.get("text_fontname", str)+"-%s-%s" % (bold, italic)
    if id_ not in fonts:
        fonts[id_]=pygame.font.SysFont(options.get("text_fontname", str), options.get("text_fontsize", int), bold=bold, italic=italic)
Exemplo n.º 21
0
def set_experiment(exp_name):
    print('running experiment', exp_name)
    for key, value in options.get(exp_name).items():
        _verify_(key, value)
        globals()[key] = value
Exemplo n.º 22
0
options.set("player_damping_ground", 0.15, False)
options.set("player_accel_air", 6, False)
options.set("player_accel_ground", 50, False)

options.set("view_gun_stiffness", 10, False)

options.set("dpy_width", 1024, False)
options.set("dpy_height", 600, False)
options.set("dpy_fov", 90, False)
options.set("dpy_fov_scope", 35, False)

options.set("mouse_sensitivity", 0.1, False)

options.set("slowmo", 1.0, True)

pygame.mouse.set_pos([options.get("dpy_width", int)/2, options.get("dpy_height", int)/2])

pygame.mouse.set_visible(False)

keys=[]
key_press=[]
key_release=[]

mouse=[]
mouse_press=[]
mouse_release=[]
mouse_pos=[0, 0]

glLineWidth(2)

player=game.init_player()