Beispiel #1
0
def init(width, height, resources, starting_screen):
    game = Game(width, height, resources, starting_screen)    
    # We have to allow JS to interact with this object for some operations
    # eg. assigning resources automatically from resources.js
    window.game = game

    # Game Scripts. Load after Brython so window.game is defined.
    # Plugins
    javascript.load("lib/debugPanel.js")
    # Content
    javascript.load("js/entities/entities.js")    
    javascript.load("js/entities/HUD.js")
    javascript.load("js/screens/play.js")
    
    game.onload()
Beispiel #2
0
    def __floordiv__(self, other):
        _v = LongInt(self.value.div(_get_value(other)))
        if _v >= 0:
            return LongInt(_v.value.round(0, 0))  #round down

        return LongInt(_v.value.round(0, 3))  #round up

    def __pow__(self, other):
        if isinstance(other, LongInt):
            _value = int(other.value.toString(10))
        elif isinstance(other, str):
            _value = int(other)

        return LongInt(self.value.pow(_value))


_path = __file__[:__file__.rfind('/')] + '/'

#to use decimal.js library uncomment these 2 lines
#javascript.load(_path+'decimal.min.js', ['Decimal'])
#LongInt=DecimalJS

#to use bignumber.js library uncomment these 2 lines
javascript.load(_path + 'bignumber.min.js', ['BigNumber'])
LongInt = BigNumberJS

#big.js does not have a "base" so only base 10 stuff works.
#to use big.js library uncomment these 2 lines
#javascript.load(_path+'big.min.js', ['Big'])
#LongInt=BigJS
Beispiel #3
0
document <= html.LINK(rel="stylesheet",
    href=_path+'css/smoothness/jquery-ui.css')

# The scripts must be loaded in blocking mode, by using the function 
# load(script_url[, names]) in module javascript
# If we just add them to the document with script tags, eg :
#
# document <= html.SCRIPT(sciprt_url)
# _jqui = window.jQuery.noConflict(True)
#
# the name "jQuery" is not in the Javascript namespace until the script is 
# fully loaded in the page, so "window.jQuery" raises an exception

# Load jQuery and put name 'jQuery' in the global Javascript namespace
javascript.load(_path+'jquery-1.11.2.js', ['jQuery'])
javascript.load(_path+'jquery-ui.js')

_jqui = window.jQuery.noConflict(True)

_events = ['abort',
'beforeinput',
'blur',
'click',
'compositionstart',
'compositionupdate',
'compositionend',
'dblclick',
'error',
'focus',
'focusin',
Beispiel #4
0
_path = __file__[: __file__.rfind("/")] + "/"

document <= html.LINK(rel="stylesheet", href=_path + "css/smoothness/jquery-ui.css")

# The scripts must be loaded in blocking mode, by using the function
# load(script_url[, names]) in module javascript
# If we just add them to the document with script tags, eg :
#
# document <= html.SCRIPT(sciprt_url)
# _jqui = window.jQuery.noConflict(True)
#
# the name "jQuery" is not in the Javascript namespace until the script is
# fully loaded in the page, so "window.jQuery" raises an exception

# Load jQuery and put name 'jQuery' in the global Javascript namespace
javascript.load(_path + "jquery-1.11.2.min.js", ["jQuery"])
javascript.load(_path + "jquery-ui.min.js")

_jqui = window.jQuery.noConflict(True)

_events = [
    "abort",
    "beforeinput",
    "blur",
    "click",
    "compositionstart",
    "compositionupdate",
    "compositionend",
    "dblclick",
    "error",
    "focus",
Beispiel #5
0
  def __floordiv__(self, other):
      _v=LongInt(self.value.div(_get_value(other)))
      if _v >= 0:
         return LongInt(_v.value.round(0, 0))  #round down

      return LongInt(_v.value.round(0, 3))  #round up

  def __pow__(self, other):
      if isinstance(other, LongInt):
         _value=int(other.value.toString(10))
      elif isinstance(other, str):
         _value=int(other)

      return LongInt(self.value.pow(_value))


_path = __file__[:__file__.rfind('/')]+'/'

#to use decimal.js library uncomment these 2 lines
#javascript.load(_path+'decimal.min.js', ['Decimal'])
#LongInt=DecimalJS

#to use bignumber.js library uncomment these 2 lines
javascript.load(_path+'bignumber.min.js', ['BigNumber'])
LongInt=BigNumberJS

#big.js does not have a "base" so only base 10 stuff works.
#to use big.js library uncomment these 2 lines
#javascript.load(_path+'big.min.js', ['Big'])
#LongInt=BigJS
Beispiel #6
0
document <= html.LINK(rel="stylesheet",
                      href=_path + 'css/smoothness/jquery-ui.css')

# The scripts must be loaded in blocking mode, by using the function
# load(script_url[, names]) in module javascript
# If we just add them to the document with script tags, eg :
#
# document <= html.SCRIPT(sciprt_url)
# _jqui = window.jQuery.noConflict(True)
#
# the name "jQuery" is not in the Javascript namespace until the script is
# fully loaded in the page, so "window.jQuery" raises an exception

# Load jQuery and put name 'jQuery' in the global Javascript namespace
javascript.load(_path + 'jquery-1.11.2.min.js', ['jQuery'])
javascript.load(_path + 'jquery-ui.min.js')

_jqui = window.jQuery.noConflict(True)

_events = [
    'abort', 'beforeinput', 'blur', 'click', 'compositionstart',
    'compositionupdate', 'compositionend', 'dblclick', 'error', 'focus',
    'focusin', 'focusout', 'input', 'keydown', 'keyup', 'load', 'mousedown',
    'mouseenter', 'mouseleave', 'mousemove', 'mouseout', 'mouseover',
    'mouseup', 'resize', 'scroll', 'select', 'unload'
]


class JQFunction:
    def __init__(self, func):