import sys
import sdl2.ext

BLACK=sdl2.ext.Color(0,0,0)
RESOURCES = sdl2.ext.Resources(__file__, "resources")

sdl2.ext.init()
window = sdl2.ext.Window("Hello World!", size=(640, 480))
window.show()
if "-hardware" in sys.argv:
    print("Using hardware acceleration")
    renderer = sdl2.ext.Renderer(window)
    factory = sdl2.ext.SpriteFactory(sdl2.ext.TEXTURE, renderer=renderer)
else:
    print("Using software rendering")
    factory = sdl2.ext.SpriteFactory(sdl2.ext.SOFTWARE)
sprite1 = factory.from_image(RESOURCES.get_path("o_def.png"))
spritebg = factory.from_image(RESOURCES.get_path("j.png"))



i=0
X=0
Y=0
s=0
while True:
    for event in sdl2.ext.get_events():
        if event.type == sdl2.SDL_QUIT:
            running = False
            break
    spriterenderer = factory.create_sprite_render_system(window)
    spriterenderer.render(spritebg)
    spriterenderer.render(sprite1)
    sprite1.position=150,i
        
       # if s == 1:
        #sprite.position=200,10
            #sprite.position=int(i),10
        #elif s == 0:
        #   sprite.position=600,10
        #else:
        #    break

    #sdl2.SDL_FlushEvent(sdl2.SDL_MOUSEMOTION)
    i += 1
    #processor.run(window)
    sdl2.ext.fill(sprite1,BLACK)

