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 - mayou

Pages: [1]
1
Graphics / Re: My sprites are not the same as input file
« on: April 29, 2013, 10:34:28 pm »
Yup, it is 1.6... may I upgrade to 2.0 ?

Unfortunately
brick_image = sf.Image()
brick_image.LoadFromFile("brick_.png")
brick_image.SetSmooth(False)
or
brick_image = sf.Image()
brick_image.SetSmooth(False)
brick_image.LoadFromFile("brick_.png")
do not change anything.

2
Graphics / My sprites are not the same as input file
« on: April 29, 2013, 09:54:45 pm »
Hi all,

i just start to learn your API, and I just meet a display problem.
When SFML draws a sprite in the window it's not the same as input :
My source image :

My SFML app :


Why ?

Here is my code :

#!/usr/bin/python
# -*- coding: utf-8 -*-

from PySFML import sf

brick_image = sf.Image()
brick_image.LoadFromFile("brick_.png")

window = sf.RenderWindow(sf.VideoMode(320,240,32), "SFML")

while True:

        window.Clear()

        for j in range(0,24) :
                for i in range(0,16) :
                        sprite = sf.Sprite(brick_image)
                        sprite.SetPosition(i * 20, j * 10)
                        idx = (i+j)%2
                        sprite.SetSubRect(sf.IntRect(20 * idx, 0, 20 + 20 * idx, 10))
                        window.Draw(sprite)

        window.Display()

Thanks in advance.

Pages: [1]