Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - logo123

Pages: [1]
1
Python / where is the wheel or installer???
« on: September 01, 2019, 09:24:04 pm »
i have tried to complie myself in 24 hours,but all of my tried were failed

where can i download pysfml2.2(or above)msi or exe or wheel for python3.4 to python3.7

... now i have pysfml2.2 for cp2.7... ...it is good but if i can have the pysfml for python3.x is best...

thanks


 :o :o :o :o :'( :'( :'( :'( :'(

2
Python / Re: Pysfml .exe for python 3.4
« on: September 01, 2019, 06:51:11 pm »
can you give the site where to download pySFML-2.2.0-cp34-none-win32.whl????

 :) :) :) :)thanks


3
Feature requests / batch draw
« on: July 18, 2019, 02:32:39 am »
Pyglet's batch draw different sprites without sfml fast
But pyglet's batch draw the same sprite (each sprite has the same texture) much faster than sfml's draw(sprite)... such as batch draw 10000 sprites.

Can you add a batch draw of the same texture sprite in sfml later? This is  faster, on some occasions


#pysmfl example:  not full,but you can use c++ sfml to test the speed of draw 10000 same sprite

windowStyle=sf.Style.DEFAULT

if 1:
    window = sf.RenderWindow(sf.VideoMode(640, 480),
                             'Drawing an image with SFML',windowStyle)

#sf.Style.NONE
    window.vertical_synchronization = True

    window.framerate_limit = 60

    window.key_repeat_enabled=False
   
    running = True
    #texture = sf.Texture.from_file('zblow3.png')
   
    ls=list()

    png=pngList[0]
    texture = sf.Texture.from_file(png)
    texture.smooth=True
    for i in xrange(10000):
        #png=choice(pngList)
        #png=pngList[0]
        #texture = sf.Texture.from_file(png)
        #texture.smooth=True
        sprite = sf.Sprite(texture)
        x=randint(0,640)
        y=randint(0,480)
        sprite.position=x,y
        sprite.rotation=randint(1,360)
        ls.append(sprite)

... ...
        t1=time.clock()
        for s in ls:
            #x=randint(0,640)
            #y=randint(0,480)
            #s.position=x,y
            #s.rotation=x
            window.draw(s)
            pass
        #window.draw(sprite)
        t2=time.clock()
        print 'cost is',t2-t1

###test result:
cost is 0.0336539525734
cost is 0.0295262057547
cost is 0.0373839061182
cost is 0.0333649108478
cost is 0.0326527325671
cost is 0.0181461101111
cost is 0.0336869950792
cost is 0.0303814612936
cost is 0.0413666508726
cost is 0.0317208055827
cost is 0.0334431862985
cost is 0.0297379344328
cost is 0.0289368942675
cost is 0.0311719150249


#pyglet(pure python code) example result:
cost time is 0.0121541885226
cost time is 0.01268735983
cost time is 0.0138351859058
cost time is 0.0119851263812
cost time is 0.0135422945678
cost time is 0.012218027927
cost time is 0.011419874971
cost time is 0.0114622207066
cost time is 0.0113592435768
cost time is 0.0118051570048
cost time is 0.0114689575282
cost time is 0.0115831626939
cost time is 0.0117217487377
cost time is 0.0115045664422
cost time is 0.0115616690251
cost time is 0.0116351324603
cost time is 0.011666570961
cost time is 0.0113877948683
cost time is 0.0114237245833
cost time is 0.0116152427967


full pyglet example code follow (need a same png with pysfml example)

# -*- coding: cp936 -*-
import pyglet
pyglet.options['debug_gl'] = False
from pyglet.gl import *
import os
import sys
import time

from random import *


from pyglet.window import key
from pyglet.window import mouse


window = pyglet.window.Window(width=640,height=480)


pyglet.gl.glEnable(GL_BLEND)
pyglet.gl.glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)


fps_display = pyglet.clock.ClockDisplay()
fps_display.label.color=(0.5,1,1,1)
fps_display.label.x=10
fps_display.label.y=300



Layer1_Batch = pyglet.graphics.Batch()



pic=pyglet.image.load("shot5.png").get_texture()
sprite = pyglet.sprite.Sprite(pic, x=100, y=100, batch=None)


def getallpng():
    ls=list()
    walk=os.walk("images")
    for i in walk:
        dir1,subdirlist,filelist=i
        for filename in filelist:
            if filename.endswith("png"):
                pngPath=dir1+"\\"+filename
                ls.append(pngPath)

    return ls



pngList=getallpng()


ls=list()
def makeSprite():
    pic=pyglet.image.load(pngList[0]).get_texture()
    for i in xrange(10000):
        #png=choice(pngList)
        #pic=pyglet.image.load(png).get_texture()
        x=randint(0,640)
        y=randint(0,480)
        sprite = pyglet.sprite.Sprite(pic, x, y, batch=Layer1_Batch)
        sprite.rotation=randint(1,360)
        ls.append(sprite)



makeSprite()




@window.event
def on_draw():
    global camx,camy
    window.clear()
   
    t1=time.clock()
    Layer1_Batch.draw()
    t2=time.clock()
    print 'cost time is',t2-t1
    fps_display.draw()






def update(dt):
    #print 'dt is',dt
    dt = 1.0/60. #override dt to keep physics simulation stable
    #whenKeyPressed()
   
    pass


#no window,the result is fake
def costTime():
    t1=time.clock()
    Layer1_Batch.draw()
    t2=time.clock()
    print 'cost time222 is',t2-t1




pyglet.clock.set_fps_limit(60)
pyglet.clock.schedule_interval(update, 1/60.0)
#pyglet.clock.schedule_once(spawn_logo, .1)
#pyglet.clock.schedule_interval(spawn_logo, 10/6.)
pyglet.app.run()













4
Python / Re: Can't install PySFML
« on: July 11, 2019, 12:29:20 pm »
you can donwload some example to start learn pysfml... it is easy to test it out...


and there are some small broken in examples.... like the pong.py example

you need to change
        if event == sf.Event.CLOSED:
            window.close()

to
        # close window : exit
        if type(event) is sf.CloseEvent:
            window.close()

and change
       event['code'] 
to
       event.code


change import sfml as sf    to  from sfml import sf 

then it can be a workable example...

 :) :) :)

5
Python / Re: Can't install PySFML
« on: July 11, 2019, 12:23:55 pm »
it is hard to compile it from sources...

pip install pysfml  dont work now

the besst way is that down the wheel and   pip install xxx.wheel yourself

download link:
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pysfml


6
Python / Re: Building pysfml on windows?
« on: July 11, 2019, 12:22:03 pm »
nice work...

i tried to in stall pysfml with gcc + setup.py .... ... ends with some ld error... ....

pysfml is great... it is faster than pyglet in many sections... but it is hard to install.... ...

the best way to install is that download a pysfml.wheel then pip install wheel...

pysfml wheel download
https://www.lfd.uci.edu/~gohlke/pythonlibs/#pysfml







7
Python / Re: Back and working on restoring pysfml
« on: July 10, 2019, 07:31:58 pm »
i have been work with pyglet about some years...

pymunk+pyglet is a good idea... ...   but when your game have more than 200
dynamic sprites which move with pymunk, pyglet will get a little even too much slow......   so i have been going to find a faster python's game engine

def testSpriteUpdate():
    t1=time.clock()
    for body in logols:
        sprite.rotation = math.degrees(body.angle)
        #sprite.rotation = body.angle
        sprite.position=body.position
        #sprite.set_position(*body.position) #slower than sprite.position=x.x
        #a=math.degrees(body.angle)
        #b=body.angle   #cost time without the #lines....
        #sprite.x,sprite.y=body.position
    t2=time.clock()
    print len(logols),t2-t1

logols is a list with 200 pymunk's body... ...
it will take about 0.012s ..... ...with nuitka pyglet's sprite.py to sprite.pyd ,it will still cost 0.009s in my computer  it will be hard to keep frames in 100 when there are more than 200 sprites or animation on a same screen


but... ...when i tried out pysfml about 1.5 day , it is quick a lot than pyglet... ...

pymunk+pysfml is better than pymunk+pyglet.... (i dont want the pygame it is not so pythonic)

a small tip is that rotated sprite in pysfml... ...set texture.smooth=True, it will be beautiful as same as pyglet

pysfml is soooo good to use.... python and c++ speed... ...

pyglet has a animation class, and pysfml can get one by myself etc...

:)

pyglet and pysfml is similar,,,, and pysfml is a lot faster than pyglet in many sections....
pyglet is pure python code... ...

pyglet has a batch.draw .... a lot of sprite can be added to a batch...
but when the sprites come from different image it still cost more time than for i in spritelist: window.draw(i) with pysfml...  pysfml is a lot faster than pyglet when sprites with different textures

when lots of sprites come from a same image... batch.draw can faster a  lot than pysfml's draw i for i in list...

.... ....

pysfml is great... ...







Pages: [1]