示例#1
0
    def onInit(self):
        player.loadPlugin("libavg_cefplugin")
        self.remote = libavg_cefplugin.CEFnode(pos=(0, 100),
                                               size=(self.size.x,
                                                     self.size.y - 100),
                                               id="remote",
                                               parent=self)
        self.local = libavg_cefplugin.CEFnode(size=(self.size.x, 100),
                                              transparent=True,
                                              id="local",
                                              parent=self)

        self.local.addJSCallback("setscroll", self.onSetScroll)
        self.local.addJSCallback("refresh", self.onRefresh)
        self.local.addJSCallback("loadurl", self.onLoadURL)
        self.local.addJSCallback("setvolume", self.onSetVolume)
        self.local.addJSCallback("testloop", self.onTestLoop)

        self.local.onPluginCrash = self.onPluginCrash
        self.local.onRendererCrash = self.onRendererCrash

        self.local.onLoadEnd = self.onLoadEnd

        url = "file:///"
        url += os.getcwd()
        url += "/testpage.html"
        self.local.loadURL(url)

        self.local.mouseInput = True
        player.subscribe(player.KEY_DOWN, self.onKey)
        player.subscribe(player.KEY_UP, self.onKey)

        pass
示例#2
0
 def loadPlugin():
     if platform.system() != 'Windows':
         if os.getenv('srcdir') in ('.', None):
             player.pluginPath += ":../.."
         else:
             # make distcheck
             player.pluginPath += ":../../_build/src/test/plugin/.libs"
     player.loadPlugin("colorplugin")
 def loadPlugin():
     if platform.system() != "Windows":
         if os.getenv("srcdir") in (".", None):
             player.pluginPath += ":../.."
         else:
             # make distcheck
             player.pluginPath += ":../../_build/src/test/plugin/.libs"
     player.loadPlugin("colorplugin")
示例#4
0
        def loadPlugin():
            if platform.system() != 'Windows':
                if os.getenv('srcdir') in ('.', None):
                    # make check or ./Test.py
                    addpth = './'
                else:
                    # make distcheck
                    addpth = '../../_build/src/test/'

                player.pluginPath += ":"+addpth+"plugin/.libs"
            player.loadPlugin("colorplugin")
示例#5
0
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from libavg import avg, app, player

player.loadPlugin('heatmap')

BLUR_CROP_VAL = 0.015


class HeatMapNode(avg.DivNode):
    def __init__(self,
                 id=id,
                 size=None,
                 parent=None,
                 colormap=None,
                 valuerangemin=None,
                 valuerangemax=None,
                 overlay_src=None,
                 blur_level=1,
                 **kwargs):
示例#6
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Current versions can be found at www.libavg.de
#
# Original author of this file: Thomas Schott <*****@*****.**>

# See the LICENSE file for license information regarding the media
# used by this sample.

from random import randint

from libavg import avg, player
from libavg import app
from libavg.utils import getMediaDir

player.loadPlugin('collisiondetector')

def playVideo(video):
    if not player.isUsingGLES():
        video.play()


### game elements ###

class Bullet(avg.VideoNode):
    __SPEED = 360 # px/s

    def __init__(self, parent=None, **kwargs):
        super(Bullet, self).__init__(href='bullet.mov', loop=True, active=False, **kwargs)
        self.registerInstance(self, parent)
        self.pause()
示例#7
0
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
#
# Current versions can be found at www.libavg.de
#
# Original author of this file: Thomas Schott <*****@*****.**>

# See the LICENSE file for license information regarding the media
# used by this sample.

from random import randint

from libavg import avg, player
from libavg import app
from libavg.utils import getMediaDir

player.loadPlugin('collisiondetector')


def playVideo(video):
    if not player.isUsingGLES():
        video.play()


### game elements ###


class Bullet(avg.VideoNode):
    __SPEED = 360  # px/s

    def __init__(self, parent=None, **kwargs):
        super(Bullet, self).__init__(href='bullet.mov',
示例#8
0
 def loadPlugin():
     if platform.system() != 'Windows':
         if not(os.getenv('srcdir') in ('.', None)):
             # make distcheck
             player.pluginPath += ":../../_build/src/test/plugin/.libs"
     player.loadPlugin("colorplugin")
示例#9
0
# 
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

from libavg import avg, app, player
player.loadPlugin("plots")


class MyMainDiv(app.MainDiv):
    def onInit(self):
        self.widths = [1,30,30,10]
        self.opacities = [0.05,0.1,0.2,0.3]

        points = [avg.Point2D(10, 10), avg.Point2D(100, 100), avg.Point2D(120, 10), avg.Point2D(200, 10)]
        self.__create_line(points)

        points = [avg.Point2D(10, 250), avg.Point2D(100, 150), avg.Point2D(200, 250), avg.Point2D(300, 250)]
        self.__create_line(points)

        points = [avg.Point2D(10, 300), avg.Point2D(100, 340), avg.Point2D(110, 380), avg.Point2D(120, 340)]
        self.__create_line(points)
示例#10
0
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sqlite3
import math
from libavg import avg, player
import glob, os
import numpy as np

from helper import csvtime_to_float

player.loadPlugin("pyglm")
TIME_STEP = 1. / 30

wall_width = 4.90
wall_height = 2.06
# pos_range = [[-0.5,0,0.5], [5.5,2.5,2.5]]  # User head position minimum and maximum
pos_range = [[-0.5, 0, 0.5], [5.5, 2.5,
                              5]]  # User head position minimum and maximum
max_time = 0
time_offset = 0
touch_range = [4 * 1920, 3 * 1080]
x_wall_range = [0, wall_width]
y_wall_range = [0.4, 0.4 + wall_height]


def execute_qry(qry, do_fetch=False):
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import pat_model
import global_values
import vis_panel
from libavg import avg, player

player.loadPlugin("heatmap")


class WallPanel(vis_panel.VisPanel):
    def __init__(self,
                 session,
                 vis_params,
                 parent,
                 mode="user",
                 use_heatmap=False,
                 label=None,
                 **kwargs):
        """
        :param session: The session this panel is based on.
        :type session: Session
        :param vis_params:
示例#12
0
#!/usr/bin/env python

import sys, math
from libavg import player, testcase, testapp
player.loadPlugin('pyglm')


class GLMTestCase(testcase.AVGTestCase):
    def __init__(self, testFuncName):
        testcase.AVGTestCase.__init__(self, testFuncName)

    def testVec3(self):
        def testHash():
            ptMap = {}
            ptMap[pyglm.vec3(0, 0, 0)] = 0
            ptMap[pyglm.vec3(1, 0, 0)] = 1
            ptMap[pyglm.vec3(0, 0, 0)] = 2
            self.assertEqual(len(ptMap), 2)
            self.assertEqual(ptMap[pyglm.vec3(0, 0, 0)], 2)

        def testToTupleConversion():
            pt = pyglm.vec3(10, 20, 30)
            tpl = tuple(pt)
            self.assertEqual(pt.x, tpl[0])
            self.assertEqual(pt.y, tpl[1])
            self.assertEqual(pt.z, tpl[2])

        def testFromTupleConversion():
            tpl = (15, 20, 25)
            pt = pyglm.vec3(tpl)
            self.assertEqual(pt.x, tpl[0])
示例#13
0
文件: plugin.py 项目: winsx/libavg
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from libavg import player

canvas = player.createMainCanvas(size=(160,120))
# Change following line if the plugin is somewhere else.
player.pluginPath = "../test/plugin/.libs"
player.loadPlugin("colorplugin")

rootNode = canvas.getRootNode()
node = colorplugin.ColorNode(fillcolor="7f7f00", parent=rootNode)
node.fillcolor = "7f007f"
player.play()