from examples.server_address import SERVER_ADDRESS

device = Connector(SERVER_ADDRESS, 'FooBar')
device.clear_playground()
device.configure_playground(
    width=100,
    height=100,
    origin_x=50,
    origin_y=50
)

id = device.add_circle(
    pos_x=0,
    pos_y=40,
    radius=5,
    color=Colors.RED,
    direction=[0, -1],
    speed=1,
    time_span=4
)

device.sleep(3)

speed = 1

device.update_circle(
    id=id,
    movements={
        'repeat': 2,
        'movements': [
            {
sys.path.insert(0,
                os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from smartphone_connector import Connector, SpriteClickedMsg, Colors, time_s
from examples.server_address import SERVER_ADDRESS
from math import cos, sin, pi, radians

device = Connector(SERVER_ADDRESS, 'FooBar')

RADIUS = 40
device.clear_playground()
device.configure_playground(width=100,
                            height=100,
                            shift_x=-50,
                            shift_y=-50,
                            color=Colors.WHITE)
device.add_circle(radius=RADIUS, pos_x=0, pos_y=0, border_color="black")
for deg in range(0, 360, 6):
    device.add_line(x1=sin(radians(deg)) * (RADIUS - 3),
                    y1=cos(radians(deg)) * (RADIUS - 3),
                    y2=cos(radians(deg)) * RADIUS,
                    x2=sin(radians(deg)) * RADIUS,
                    line_width=0.3)

for deg in range(0, 360, 30):
    device.add_line(x1=sin(radians(deg)) * (RADIUS - 5),
                    y1=cos(radians(deg)) * (RADIUS - 5),
                    y2=cos(radians(deg)) * RADIUS,
                    x2=sin(radians(deg)) * RADIUS,
                    line_width=1)

device.add_line(id='hour',
Beispiel #3
0
import os
import sys
sys.path.insert(0,
                os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from smartphone_connector import Connector, AccMsg, KeyMsg, Colors
from random import randint
from examples.server_address import SERVER_ADDRESS

device = Connector(SERVER_ADDRESS, 'FooBar')
device.clear_playground()

id = device.add_circle(pos_x=0, pos_y=0, radius=5, color=Colors.RED)

device.sleep(3)

speed = 3

device.update_circle(id=id,
                     movements={
                         'repeat':
                         10,
                         'movements': [{
                             'movement': 'relative',
                             'direction': [0, 1],
                             'distance': 50,
                             'speed': speed
                         }, {
                             'movement': 'relative',
                             'direction': [0, -1],
                             'distance': 50,
                             'speed': speed
Beispiel #4
0
                        'movement': 'absolute',
                        'to': [-50, -40],
                        'speed': 10
                    },
                    {
                        'movement': 'absolute',
                        'to': [50, -40],
                        'time': 0
                    },
                ]
            })

id = device.add_circle(pos_x=0,
                       pos_y=40,
                       radius=5,
                       color=Colors.RED,
                       direction=[0, -1],
                       speed=1,
                       time_span=4)

device.add_circle(pos_x=0,
                  pos_y=0,
                  radius=5,
                  color=Colors.BLACK,
                  movements={
                      'movements': [{
                          'movement': 'absolute',
                          'to': [-50, 50],
                          'time': 5
                      }]
                  })
import os
import sys
sys.path.insert(0,
                os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from smartphone_connector import Connector, SpriteClickedMsg, Colors
from examples.server_address import SERVER_ADDRESS

device = Connector(SERVER_ADDRESS, 'FooBar')
device.clear_playground()
device.configure_playground(width=100, height=50, origin_x=50, origin_y=25)
device.add_line(-50, -25, 50, 25, color="purple", line_width=0.2)
lw = 0.1
for x in range(-50, 100, 25):
    device.add_circle(pos_x=x,
                      pos_y=x / 2,
                      radius=2,
                      color='red',
                      border_width=lw,
                      border_color='black',
                      border_style='dashed')
    device.add_line(x1=-50, y1=x / 2, x2=50, y2=x / 2)
    device.add_line(x, -25, x, 25)
    lw = lw + 0.3
device.disconnect()
import os
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.path.dirname(__file__), '..')))
from examples.server_address import SERVER_ADDRESS
from smartphone_connector import Connector

device = Connector(SERVER_ADDRESS, 'FooBar')

device.clear_playground()
device.configure_playground(100, 100, 50, 50, color="white")
device.add_circle(pos_x=0, pos_y=0, radius=5, color='red')
device.add_square(pos_x=0, pos_y=0, size=10, color='yellow', text='hi', clickable=True)
device.add_rectangle(pos_x=-20, pos_y=-40, width=10, height=5, color='orange', text='hi', clickable=True, z_index=999)
device.add_circle(pos_x=0, pos_y=0, radius=13, color='green', clickable=True)
device.add_square(pos_x=15, pos_y=0, size=10, color='red', anchor=[0.5, 0.5])
device.add_text(text='1', pos_x=-20, pos_y=10)
device.add_text(text='1', pos_x=-20, pos_y=10, background_color='unset')
device.add_text(text='Hello', pos_x=-20, pos_y=0, border_color='red')
device.add_text(text='Hello', pos_x=-20, pos_y=0, border_color='red', rotate=90, anchor=[0, 1])
device.add_text(text='Hello My Friend', pos_x=-20, pos_y=-10, clickable=True)
device.add_text(text='Hello There', pos_x=-40, pos_y=-40, font_color='white', font_size=10)
device.add_text(text='Hello There', pos_x=-40, pos_y=-40, font_color='white', font_size=10, rotate=-90)

device.on_sprite_clicked = lambda x: print(x)
device.sleep(10)
device.disconnect()