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

Pages: 1 2 [3]
31
Graphics / Re: SFML Draw() won't draw sprite on Window
« on: October 15, 2020, 11:26:56 pm »
I'm wondering why I had to add that line (ship = Ship() Is it the same as ship.Ship() ?). I'm pretty new to c++ so I still have a lot to learn.

Because at the moment when global variable get values (i.e. constructor is called) your texture is not yet loaded (it's loading from file inside main function). No, it's not the same (I'm not even sure that ship.Ship() compiled)

About your bullet sprite problem...
Did you try to add setUp method also for bullet?  ;)

32
Graphics / Re: SFML Draw() won't draw sprite on Window
« on: October 14, 2020, 11:37:13 pm »
Well now it's obvious - (btw, code still doesn't compile), your texture load after initialization of global variable.
For quick fix add right after loading e.g:
    textureLoad();
    ship = Ship();

But I strongly recommend refactor all code.

33
Graphics / Re: SFML Draw() won't draw sprite on Window
« on: October 14, 2020, 09:41:16 pm »
In that case can you provide complete (minimal if possible) code for reproducing the behaviour?
Or maybe your project is on Github, Gitlab or something like that?

34
General / Re: Problems when sending a project to someone else.
« on: October 14, 2020, 06:41:35 pm »
In examples folder (located inside main lib folder) or you can get it from Github - https://github.com/SFML/SFML/tree/master/examples/pong

35
General / Re: CMAKE error missing dependencies of SFML
« on: October 14, 2020, 06:35:36 pm »
If I define paths manually:
Quote
set(CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} "SFML-2.5.1\\extlibs\\headers")   
set(CMAKE_LIBRARY_PATH ${CMAKE_LIBRARY_PATH} "SFML-2.5.1\\extlibs\\libs-msvc\\x86")   
CMAKE generate project files.

36
Graphics / Re: SFML Draw() won't draw sprite on Window
« on: October 14, 2020, 04:31:24 pm »
Yes, I've also outputed the position and it says that is at y = 666.
However 5 / 6 != 0
The setPosition(WIDTH / 2, HEIGHT * 5 / 6) means to put the sprite at the 5 / 6 of the screen height, so in the lower part

It probably expected to be so, but because both operands are integer C++ will use integer operations.
#include <iostream>

int main() {
        std::cout<<5 / 6<<'\n';
}
Output: 0

Of course in your code HEIGHT * 5 part is evaluate first, so it won't be 0.

37
SFML projects / Re: Visualization/plot library with SFML and Bazel
« on: October 14, 2020, 04:22:19 pm »
Looks promising, but why not use and contribute to some already existed project(for example SFGraphing)? Because there are a lots projects with basic chart support (line, scatter,...) but I didn't find any that has support for more advance charts (like time series or candlestick chart).

38
General / CMAKE error missing dependencies of SFML
« on: October 14, 2020, 04:01:27 pm »
I want to use SFML with CMAKE but get error:

Quote
CMake Error at /SFML-2.5.1/build/SFMLConfig.cmake:139 (message):
  SFML found but some of its dependencies are missing ( FreeType OpenAL
  VorbisFile VorbisEnc Vorbis Ogg FLAC)
Call Stack (most recent call first):
  CMakeLists.txt:11 (find_package)


CMake Error at CMakeLists.txt:11 (find_package):
  Found package configuration file:

    /SFML-2.5.1/build/SFMLConfig.cmake

  but it set SFML_FOUND to FALSE so package "SFML" is considered to be NOT
  FOUND.


Configuring incomplete, errors occurred!

CMake file:

cmake_minimum_required(VERSION 3.1)

project(SFMLTest)

## If you want to link SFML statically
set(SFML_STATIC_LIBRARIES TRUE)

## In most cases better set in the CMake cache
set(SFML_DIR "SFML-2.5.1\\build")

find_package(SFML 2.5.1 COMPONENTS graphics audio REQUIRED)
add_executable(SFMLTest appl.cpp)
target_link_libraries(SFMLTest sfml-graphics)

I use static SFML 2.5.1 that built myself with CMAKE.

39
General / Re: How to setup CMake in Visual Studio?
« on: October 14, 2020, 03:44:28 pm »
Are you sure that you built static version of SFML?

Pages: 1 2 [3]