1
D / setRepeated() is not work. :/
« on: May 25, 2015, 01:42:29 pm »
Hello.
I just got a problem when i copied a example code of 'SFML Essentials(38 page)' like this:
yes. it's used Derelict-SFML. Execute is well, but not work tile repeated.
I don't know why. Is any problem with my code? reply please..
thanks.
I just got a problem when i copied a example code of 'SFML Essentials(38 page)' like this:
import derelict.sfml2.window;
import derelict.sfml2.graphics;
import derelict.sfml2.system;
void main(){
DerelictSFML2Window.load();
DerelictSFML2Graphics.load();
DerelictSFML2System.load();
sfVideoMode videoMode = {640, 480, 32};
sfRenderWindow* window = sfRenderWindow_create( videoMode, "The title", sfClose, null );
sfTexture* texture = sfTexture_createFromFile( "tile.png", null );
//Set the texture in repeat mode
sfTexture_setRepeated( texture, sfTrue );
sfRectangleShape* rectShape = sfRectangleShape_create();
sfRectangleShape_setSize( rectShape, sfVector2f( 128*3, 221*2 ) );
//Bigger texture rectangle than the size of the texture
sfRectangleShape_setTextureRect( rectShape, sfIntRect(0, 0, 128*3, 221*2) );
sfRectangleShape_setTexture( rectShape, texture, sfTrue );
while( sfRenderWindow_isOpen(window) ){
sfEvent event;
while( sfRenderWindow_pollEvent(window, &event) ){
if( event.type == sfEvtClosed ){ sfRenderWindow_close( window ); }
sfRenderWindow_clear( window, sfWhite );
sfRenderWindow_drawRectangleShape( window, rectShape, null );
sfRenderWindow_display( window );
}
}
}
import derelict.sfml2.graphics;
import derelict.sfml2.system;
void main(){
DerelictSFML2Window.load();
DerelictSFML2Graphics.load();
DerelictSFML2System.load();
sfVideoMode videoMode = {640, 480, 32};
sfRenderWindow* window = sfRenderWindow_create( videoMode, "The title", sfClose, null );
sfTexture* texture = sfTexture_createFromFile( "tile.png", null );
//Set the texture in repeat mode
sfTexture_setRepeated( texture, sfTrue );
sfRectangleShape* rectShape = sfRectangleShape_create();
sfRectangleShape_setSize( rectShape, sfVector2f( 128*3, 221*2 ) );
//Bigger texture rectangle than the size of the texture
sfRectangleShape_setTextureRect( rectShape, sfIntRect(0, 0, 128*3, 221*2) );
sfRectangleShape_setTexture( rectShape, texture, sfTrue );
while( sfRenderWindow_isOpen(window) ){
sfEvent event;
while( sfRenderWindow_pollEvent(window, &event) ){
if( event.type == sfEvtClosed ){ sfRenderWindow_close( window ); }
sfRenderWindow_clear( window, sfWhite );
sfRenderWindow_drawRectangleShape( window, rectShape, null );
sfRenderWindow_display( window );
}
}
}
yes. it's used Derelict-SFML. Execute is well, but not work tile repeated.
I don't know why. Is any problem with my code? reply please..
thanks.