import sys
import sdl2.ext

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

def run():

    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
    print(i)
    i += 0.9
    print(i)
        
       # if s == 1:
        #sprite.position=200,10
            #sprite.position=int(i),10
        #elif s == 0:
        #   sprite.position=600,10
        #else:
        #    break
while True:
    #processor = sdl2.ext.TestEventProcessor()
    i = 0
    i = i + 1
    sprite1.position=i,150
    sdl2.SDL_FlushEvent(sdl2.SDL_MOUSEMOTION)
    spriterenderer = factory.create_sprite_render_system(window)
    spriterenderer.render(spritebg)
    spriterenderer.render(sprite1)
    #processor.run(window)

sdl2.ext.quit()
#return 0
if __name__ == "__main__":
    sys.exit(run())
