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

Pages: [1]
1
General / Re: Font or Text render exception
« on: November 19, 2021, 07:06:00 pm »
The conan bit you showed was for imgui-sfml, do you also get SFML that way? Which package are you using?
Is Conan providing freetype as part of the SFML package or as a separate package?

Yes you are right. Updated Conan for correct library.
conan_cmake_run(
            REQUIRES
            sfml/2.5.1
            OPTIONS
            BASIC_SETUP
            CMAKE_TARGETS
            BUILD
            missing
    )
I see it links following libs:
sfml-audio-s-d.lib
sfml-graphics-s-d.lib
sfml-main-d.lib
sfml-network-s-d.lib
sfml-system-s-d.lib
sfml-window-s-d.lib

Conan: Settings= -s;arch=x86_64;-s;build_type=Debug;-s;compiler=Visual Studio;-s;compiler.version=16;-s;compiler.runtime=MDd

But still get same exception on Win10.

2
General / Re: Font or Text render exception
« on: November 18, 2021, 10:45:37 am »
Update:
  • I have managed to build project with Conan release settings. Unfortunately it didn't help for Win10. On Ubuntu everything works both on debug and release build.
  • sf::Glyph glyph = font.getGlyph('A', 20u, false); <- produce same exception.


3
General / Re: Font or Text render exception
« on: November 17, 2021, 04:03:57 pm »
Are you linking release libraries in debug mode? (linking sfml-graphics.lib instead of sfml-graphics-d.lib)

It is a good question. I build my project on CMake and get libraries from Conan.
Is there any way to distinguish release and debug package from conan?
Right now it is like:

conan_cmake_run(
            REQUIRES
            imgui-sfml/2.1@bincrafters/stable
            BUILD
            missing
    )

...

target_link_libraries(
        ${PROJECT_NAME}
        CONAN_PKG::imgui-sfml
)
I doubt if building CMake with release option will link right library. No?

4
General / Font or Text render exception
« on: November 16, 2021, 08:26:44 pm »
Some strange exception are always thrown on Windows 10.
"Access violation reading location ".
I reduced it to problem code. Everything else, including graphics, sprites, music - working. All libraries are included. But once I put "window.draw(text)" - > I get this exception. It worth noticed that same project is working on Linux. But Windows got some issue.
Please help.
Source code:

#include <SFML/Graphics.hpp>
int main()
{
  sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window");

  sf::Font font;
  if (!font.loadFromFile("C:/Users/user/source/repos/BattleCity2/media/arial.ttf"))
    return EXIT_FAILURE;

  sf::Text text("Hello SFML", font, 50);

  while (window.isOpen())
  {
    sf::Event event;
    while (window.pollEvent(event))
    {
      if (event.type == sf::Event::Closed)
        window.close();
    }
    window.clear();
    window.draw(text);
    window.display();
  }
  return EXIT_SUCCESS;
}
 

Call stack:
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!af_shaper_get_elem()
BattleCity2.exe!FT_Load_Glyph()
BattleCity2.exe!FT_Load_Char()
BattleCity2.exe!sf::Font::loadGlyph(unsigned int,unsigned int,bool,float)
BattleCity2.exe!sf::Font::getGlyph(unsigned int,unsigned int,bool,float)
BattleCity2.exe!sf::Text::ensureGeometryUpdate(void)
BattleCity2.exe!sf::Text::draw(class sf::RenderTarget &,class sf::RenderStates)
BattleCity2.exe!sf::RenderTarget::draw(class sf::Drawable const &,class sf::RenderStates const &)
BattleCity2.exe!main() Line 22

5
General / Failed to open X11 display on GitHub Actions pipeline
« on: November 14, 2021, 07:57:25 pm »
Trying to configure yml file for GitHub actions.
It configures and builds just fine using Conan packages. But when try to run ctest with 1 test case that using from SFML only loadFromFile function it aborts with message:
"Failed to open X11 display; make sure the DISPLAY environment variable is set correctly".

Already tried:
sudo apt install libsfml-dev mesa-utils xorg-dev ... etc.
export DISPLAY=:0.0, export DISPLAY=:1.0, export DISPLAY=:99.0 ... etc.
export LIBGL_ALWAYS_INDIRECT=0
(all things from https://en.sfml-dev.org/forums/index.php?topic=28293.0)

Nothing worked out.
yml file configuration: https://github.com/PavelCherniavskyi/BattleCity2/blob/master/.github/workflows/BuildAndTest.yml

Please help.

6
General / Re: fstream & SFML - uploading and downlading data
« on: June 10, 2016, 09:31:33 pm »
Alright... here it is...
First run the programm and everything is ok. But in second time do comment funcions "save_profile" in main and you get the error...
Even though you after "read_saves" function write that:
temp[0].avatar_spr_ = spr.sprite_;
temp[1].avatar_spr_ = spr2.sprite_;
You still get the error...

#include <iostream>
#include <SFML/Graphics.hpp>
#include <fstream>
#include <io.h>
using namespace std;
using namespace sf;

class SpriteManager{
public:
        String file_;
        Image image_;
        Texture texture_;
        Sprite sprite_;
        SpriteManager() {}
        SpriteManager(String File, int X = 0, int Y = 0){
                file_ = File;
                image_.loadFromFile("images/" + file_);
                texture_.loadFromImage(image_);
                sprite_.setTexture(texture_);
                sprite_.setPosition(X, Y);
        }
};

class profile
{
public:
        string name_;
        Sprite avatar_spr_;
        profile() {};
        profile(string name) { name_ = name; }
};

void save_profile(profile & player)
{
        ofstream file(player.name_ + ".save", ios_base::out | ios_base::binary);
        if (!file.is_open()){
                cerr << "Can't open file for output:\n";
                exit(EXIT_FAILURE);
        }
        file.write((char *)&player, sizeof player);
        file.close();
}

void read_saves(profile * temp)
{
        int hFile, count = 0;
        _finddata_t file[2];
        if ((hFile = _findfirst("*.save", &file[count])) == -1){
                cerr << "Can't open file for output:\n" << endl;
        }
        else while (_findnext(hFile, &file[++count]) == 0);

        ifstream save;
        for (int i = 0; i < count; i++){
                string temp_str(file[i].name);
                save.open(temp_str, ios_base::in | ios_base::binary);
                if (!save.is_open()){
                        cerr << "Can't read a file" << endl;
                }
                else{
                        save.read((char *)&temp[i], sizeof temp[i]);
                        save.close();
                }
        }
        _findclose(hFile);
}

int main()
{
        RenderWindow window(VideoMode(900, 450), "Lesson 1. kychka-pc.ru");
        View view;
        Vector2f pos;
        Event event;
        SpriteManager spr("image1.png"), spr2("image2.png");
        profile player1("First"), player2("Second"), temp[2];
        player1.avatar_spr_ = spr.sprite_;
        player2.avatar_spr_ = spr2.sprite_;
       
        save_profile(player1);
        save_profile(player2);
        read_saves(temp);

        while (window.isOpen())
        {
               
                while (window.pollEvent(event)){
                        if (event.type == Event::Closed)
                                window.close();
                }
                window.clear();
                temp[0].avatar_spr_.setPosition(385, 90);
                window.draw(temp[0].avatar_spr_);
                temp[1].avatar_spr_.setPosition(185, 120);
                window.draw(temp[1].avatar_spr_);
                window.display();
        }

        return 0;
}

7
General / fstream & SFML - uploading and downlading data
« on: June 09, 2016, 04:34:11 pm »
Hey friends, I faced with the problem of data input and output.
All variables write in a file and read in binary form, but the trouble with sprites. There no mistake on reading and writing.
Programm compilation passes, but when I try to draw a sprite downloaded from a file this application crashes during execution.

Either I'm somewhere made a mistake or something I do not know.
Nobody faced such problem?

8
SFML projects / Re: How to make a release?
« on: March 17, 2016, 10:22:42 pm »
Guys, thanks for your answers. I am a student only and my knowlege is not so deep.
Im working on Win7x64 and runnig on VS2013.
I am attaching screenshots so you could see how I am linking the SFML library.
The dll files are plased in: C:\Users\PAVLENTIY\Desktop\Dropbox\STEP\C\Projects\Chess-SFML\Debug

If you need more information please ask. I will provide.
It is very nessesary for me to make it done...

9
SFML projects / How to make a release?
« on: March 16, 2016, 02:32:59 pm »
Hello dear friends!

I faced with a problem to release my game. I mean I have no clue how to make it separate from my computer and launch on another. For example, I need to send it to my friends and colleagues so they could see it.
Didn't find common information all over the internet.
Please provide me with some hint towards to a right direction.

Thanks in advance!

Pages: [1]
anything