Example #1
0
##########################################

from sfml import Texture
from code.sfml_plus import MySprite

t = Texture.from_file("assets/tilesets/1.png")
sprite = MySprite(t)
sprite.clip.set(25,25)
sprite.position = 200,100

####
Animation = Animation()
Animation.speed = -0
Animation.vel = -0.1
Animation.end = 150
Animation.mode = Oscillate
####

while window.is_open:
	if window.is_focused:
		if key.ENTER.pressed():
			pass

	sprite.x += Animation.play(sprite.x)
	if Animation.just_passed:
		Animation.speed *= 0.8

	window.clear((255,220,0))
	window.draw(sprite)
	window.display()
Example #2
0
from code.sfml_plus import Window
from code.sfml_plus import Key
################################################
from code.sfml_plus.ui import InputBox, Box

################################################

Window = Window((1200,600), "InputBox")
box1 = Box()
box1.position = 200,200
box1.open()

InputBox1 = InputBox()
InputBox1.position = 5,5
box1.children.append(InputBox1)

while Window.is_open:
	if Window.is_focused:
		box1.controls(Key, None, None)

		if Key.ENTER.pressed():
			print InputBox1.text

	Window.clear((255,220,0))
	Window.draw(box1)
	Window.display()
                x = Text_Ref.numbers.index(char)
                y = 3

            #Highlight it
            w, h = 8, 12
            highlight = RectangleShape((w, h))
            highlight.position = w * x, h * y
            highlight.fill_color = Color(100, 100, 100, 100)
            self.highlight = highlight


#################################

Window = Window((1200, 600), "Text Spacing Tool")
Text_Spacing_Tool = Text_Spacing_Tool("speech")
Camera = Camera(Window)
Camera.zoom = 5
Camera.position = 0, 0
Mouse = Mouse(Window)

while Window.is_open:
    if Window.is_focused:
        if Key.ENTER.pressed(): print 1

        Text_Spacing_Tool\
        .controls(Camera, Mouse, Key, Window)

    Window.view = Camera
    Window.clear((255, 255, 255))
    Text_Spacing_Tool.draw(Window)
    Window.display(Mouse)
Example #4
0
from code.sfml_plus import Window
from code.sfml_plus import Key
################################################
from code.sfml_plus.ui import InputBox, Box

################################################

Window = Window((1200, 600), "InputBox")
box1 = Box()
box1.position = 200, 200
box1.open()

InputBox1 = InputBox()
InputBox1.position = 5, 5
box1.children.append(InputBox1)

while Window.is_open:
    if Window.is_focused:
        box1.controls(Key, None, None)

        if Key.ENTER.pressed():
            print InputBox1.text

    Window.clear((255, 220, 0))
    Window.draw(box1)
    Window.display()
Example #5
0
            update(self._.Text)


#####################################

Speech = Speech()
Speech.write("HiveminD")
Speech.center = Camera.center

while Window.is_open:
    if Window.is_focused:

        if Key.ENTER.pressed():
            from random import randrange
            r = randrange(0, 4)
            txt = [
                "HELLO EVERYONE. MY NAME IS SAM!",
                "I LIKE YOU. You like me. WE ARE HAPPY.",
                "Oh no! Its the police!", "Everyone! On the floor NOW."
            ]
            Speech.write(txt[r])
            Speech.center = Camera.center

        if Key.BACKSPACE.pressed():
            Speech.close()

    Window.view = Camera
    Window.clear((100, 100, 100))
    Window.draw(Speech)
    Window.display()
Example #6
0
##########################################

from sfml import Texture
from code.sfml_plus import MySprite

t = Texture.from_file("assets/tilesets/1.png")
sprite = MySprite(t)
sprite.clip.set(25, 25)
sprite.position = 200, 100

####
Animation = Animation()
Animation.speed = -0
Animation.vel = -0.1
Animation.end = 150
Animation.mode = Oscillate
####

while window.is_open:
    if window.is_focused:
        if key.ENTER.pressed():
            pass

    sprite.x += Animation.play(sprite.x)
    if Animation.just_passed:
        Animation.speed *= 0.8

    window.clear((255, 220, 0))
    window.draw(sprite)
    window.display()
				x = Text_Ref.numbers.index(char)
				y = 3

			#Highlight it
			w,h = 8,12
			highlight = RectangleShape((w,h))
			highlight.position = w*x, h*y
			highlight.fill_color = Color(100,100,100,100)
			self.highlight = highlight


#################################

Window = Window((1200,600), "Text Spacing Tool")
Text_Spacing_Tool = Text_Spacing_Tool("speech")
Camera = Camera(Window)
Camera.zoom = 5
Camera.position = 0,0
Mouse = Mouse(Window)

while Window.is_open:
	if Window.is_focused:
		if Key.ENTER.pressed(): print 1

		Text_Spacing_Tool\
		.controls(Camera, Mouse, Key, Window)

	Window.view = Camera
	Window.clear((255,255,255))
	Text_Spacing_Tool.draw(Window)
	Window.display(Mouse)