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 - Zeus-Ammon

Pages: [1]
1
General / SFML CMake Windows
« on: March 14, 2020, 05:29:22 pm »
Hi,

Im using SFML as a base to build another library on top. Until now I have been working on Linux with cmake (SFML from repositories) and i've been able to build my library with this simple CMakeLists.txt:

cmake_minimum_required(VERSION 3.5)
project(my-lib)

find_library(SYS sfml-system)
find_library(GRAPHICS sfml-graphics)
find_library(WINDOW sfml-window)

add_library(
    my-lib
    SHARED
    source files .....
)

target_include_directories(my-lib PUBLIC ${PROJECT_SOURCE_DIR})
target_link_libraries(my-lib "${SYS}" "${GRAPHICS}" "${WINDOW}")
 

This generates my-lib.so which is exactly what I need to use elsewhere.

On Windows "find_library()" does not seem to find the libraries even after I have compiled SFML from source with nmake and running nmake install which installed SFML on Program Files.

Any help would be immensly appreciated.

2
Graphics / Re: sf::Sprite streches the Texture
« on: September 28, 2019, 11:09:42 pm »
Thanks for your concern. It has come to my attention that the View I was using was being instantiated with is default constructor and thus created with a size of 1000*1000 which did not match the window resolution which resulted in the strange effect where displayed textures had different sizes to what I expected. Noob mistake !

3
Graphics / sf::Sprite streches the Texture
« on: September 27, 2019, 04:25:33 pm »
Hi. I have recently started playing around with SFML and have come across a strange problem.

I am creating a Tile Map implementation and the texture I'm using for the tiles is a 64*64 png but when it comes time to draw the sprites they seem to be stretched in the X axis to what appears to be exactly double the size (128*64).

I have no idea why this is happening. I load the tile texture from the file directly and I have checked that it loads with the correct size. When I create the sprites I use the constructor that receives a Texture which is my understanding that it creates the sprite such that it displays the texture in its original size. Then I simply move the sprite to its correct position (using move function).

EDIT:
To clarify even simply creating a sprite with said 64*64 texture and drawing it on screen still reproduces these results independently of any of my Tile Map implementation code being run.

To the effect of:

sf::RenderWindow window(sf::ViewMode(1920,1080), "Title", sf::Style::Fullscreen);
sf::Texture t;
t.loadfromfile("path");
sf::Sprite s( t );

// Somewhere in render loop
window.draw(t);

Any help would be appreciated.
Thanks in advance.

Pages: [1]
anything