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()
########################################## 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()
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)
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()
########################################## 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()
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)