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()
def draw(self, Window): Window.draw(self.highlight)
from code.sfml_plus import Window from code.sfml_plus import key window = Window((1200,600), "Animation") ########################################## from code.sfml_plus import Animation from code.sfml_plus.animation import Oscillate ########################################## 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():
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()
y = 2 if char in Text_Ref.numbers: 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))
from code.sfml_plus import Window from code.sfml_plus import key window = Window((1200, 600), "Animation") ########################################## from code.sfml_plus import Animation from code.sfml_plus.animation import Oscillate ########################################## 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():
from code.sfml_plus import Window from code.sfml_plus import Key from code.sfml_plus import Camera Window = Window((1200, 600), "Text Class") Camera = Camera(Window) Camera.zoom = 2 Camera.position = 0, 0 ##################################### from sfml import Drawable from code.sfml_plus import Rectangle from code.sfml_plus.graphics import Font, Text from sfml import Color from sfml import RectangleShape # from code.sfml_plus import Animation class Speech(Drawable, Rectangle): # * write # * position # * alpha # * fanciness: # boxes Text in a speech bubble. # opens/closes in a fancy way. # WIP - shows each letter one-by-one. def __init__(self):
y = 2 if char in Text_Ref.numbers: 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))
from code.sfml_plus import Window from code.sfml_plus import Key from code.sfml_plus import Mouse Window = Window((1200, 600), "Hivemind - Demo 1") Mouse = Mouse(Window) ################################################ from code.game import WorldMap from code.sfml_plus import SmoothCamera from code.level_editor import LevelEditor WorldMap = WorldMap(10, 10) Camera = SmoothCamera(Window) LevelEditor = LevelEditor(Window) ################################################ while Window.is_open: if Window.is_focused: LevelEditor.camera_controls(Key, Mouse, Camera) Camera.smooth.play() LevelEditor.controls(Key, Mouse, Camera, WorldMap) Window.clear((255, 255, 255)) Window.view = Camera LevelEditor.draw_background(Window, Camera) WorldMap.draw(Window, Camera) LevelEditor.draw_objects(Window, Camera) Window.display(Mouse)
from code.sfml_plus import Window from code.sfml_plus import Key Window = Window((1200,600), "Untitled") while Window.is_open: if Window.is_focused: if Key.ENTER.pressed(): print 1 Window.clear((255,220,0)) Window.display()
from code.sfml_plus import Window from code.sfml_plus import key window = Window((1200, 600), "MySprite") from sfml import Texture from code.sfml_plus import MySprite t = Texture.from_file("assets/tilesets/1.png") sprite = MySprite(t) sprite.position = 100, 100 sprite.clip.set(25, 25) sprite.clip.use(0, 0) while window.is_open: if window.is_focused: if key.ENTER.pressed(): pass window.clear((255, 220, 0)) window.draw(sprite) window.display()