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

Pages: [1]
1
Help requests / Re: Conversion from CImg to TGUI
« on: 28 March 2020, 22:59:23 »
Indeed! Thank you for your answer, texus!

Very soon after asking the question I managed to code a satisfactory solution myself.
 I planned to publish the solution I found, and thus contribute to the community. But the life delayed me. I'm sorry. :-(

 Anyway, it's not perfect, because I can't load the alpha channel of the PNG images. But I know that the problem has nothing to do with SFML or TGUI.

I paste the current code (for now):

Code: [Select]
m_imagen.load("recursos/imagen_png.png");
//m_imagen.load("recursos/imagenBN_jpg.jpg");
//m_imagen.load("recursos/imagen_jpg.jpg");

sf::Image imagen;
imagen.create(m_imagen.width(), m_imagen.height(), sf::Color::Black);

switch (m_imagen.spectrum())
{
case 0:
{
//The image is empty


}
break;

case 1:  //Grayscale image
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 0), 255);
imagen.setPixel(i, j, color);
}
}
}
break;
case 3:   //The image is RGB
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 1), m_imagen(i, j, 0, 2), 255);
imagen.setPixel(i, j, color);
}
}
}
break;

case 4: //The image is RGBA?
{
for (std::size_t i = 0; i < m_imagen.width(); ++i)
{
for (std::size_t j = 0; j < m_imagen.height(); ++j)
{
sf::Color color = sf::Color(m_imagen(i, j, 0, 0), m_imagen(i, j, 0, 1), m_imagen(i, j, 0, 2), m_imagen(i, j, 0, 3));
imagen.setPixel(i, j, color);
}
}
}
break;

default:

break;
}



sf::Texture textura;
textura.loadFromImage(imagen);

tgui::Picture::Ptr panoramica = m_gui_principal.get<tgui::Picture>("Picture1");
panoramica->getRenderer()->setTexture(textura);



DJuego

P.S: Thank you for your commitment to the forum.


2
Help requests / Conversion from CImg to TGUI
« on: 28 March 2020, 15:57:08 »
Windows 10. Microsoft Visual Studio 2019

Hi. I'm new to CImg.

I'm trying to load images into SFML from CImg. My idea is that CImg will take care of the image processing while the interface is developed based on SFML (more specifically with TGUI. For example in a PictureBox.). Has anyone tried this conversion successfully?

My attempts have been unsuccessful. For example; this code produces an exception.

Code: [Select]
cimg_library::CImg<unsigned char> image_cimg("recursos/imagen_png.png");

sf::Image image_sfml;
image_sfml.create(image_cimg.width(), image_cimg.height(), image_cimg.data());

Any idea?
Thank you!

DJuego

3
Installation help / Re: tgui master.
« on: 11 April 2018, 01:58:10 »
Thank you again for your inmediate support, texus. (And thanks for answering my question)

This is my last script version. It works!

Quote
[...] But for finding the latest SFML version it is recommended to just keep SFML_ROOT and CMAKE_MODULE_PATH empty and set the SFML_DIR to the SFML build directory (or the location where it was installed)

With "Debug mode" release

Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Debug -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_DIR=$DIRECTORIO_INSTALACION/SFML/lib/cmake/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../.. [/code]

With "Release mode" release

Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_DIR=$DIRECTORIO_INSTALACION/SFML/lib/cmake/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../..   



4
Installation help / Re: tgui master.
« on: 10 April 2018, 23:04:30 »
texus, Thank you for your very swift answer! I am using 0.8-dev (l like the danger).

Yes. I am using SFML_ROOT.

With "Debug" release

Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Debug -D CMAKE_MODULE_PATH=$DIRECTORIO_INSTALACION/SFML/cmake/Modules -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_INCLUDE_DIR=$DIRECTORIO_INSTALACION/SFML/include -D SFML_ROOT=$DIRECTORIO_INSTALACION/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../.. [/td]

With "Release" release
Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Release -D CMAKE_MODULE_PATH=$DIRECTORIO_INSTALACION/SFML/cmake/Modules -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_INCLUDE_DIR=$DIRECTORIO_INSTALACION/SFML/include -D SFML_ROOT=$DIRECTORIO_INSTALACION/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../..

Now i have changed to:
Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Debug -D CMAKE_MODULE_PATH=$DIRECTORIO_INSTALACION/SFML/cmake/Modules -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_INCLUDE_DIR=$DIRECTORIO_INSTALACION/SFML/include -D SFML_DIR=$DIRECTORIO_INSTALACION/SFML/lib/cmake/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../..
and

Code: [Select]
cmake -G 'NMake Makefiles' -D CMAKE_BUILD_TYPE=Release -D CMAKE_MODULE_PATH=$DIRECTORIO_INSTALACION/SFML/cmake/Modules -D CMAKE_INSTALL_PREFIX=$DIRECTORIO_INSTALACION_LIBRERIA -D SFML_INCLUDE_DIR=$DIRECTORIO_INSTALACION/SFML/include -D SFML_DIR=$DIRECTORIO_INSTALACION/SFML/lib/cmake/SFML -D TGUI_BUILD_DOC:BOOL=ON -D TGUI_BUILD_EXAMPLES:BOOL=ON -D TGUI_BUILD_TESTS:BOOL=OFF -D TGUI_BUILD_GUI_BUILDER:BOOL=ON -D DOXYGEN_EXECUTABLE=$ARCHIVO_DOXYGEN ../..

and it works very well, but there are a new error in "installation"

Code: [Select]
[...]
-- Installing: W:/Archivos_de_Programa/MSVC2017/x64/TGUI/./themes/Black.png
-- Installing: W:/Archivos_de_Programa/MSVC2017/x64/TGUI/./themes/Black.txt
CMake Error at cmake_install.cmake:52 (file):
  file INSTALL cannot find
  "P:/Compilados/x32-x64/TRABAJO_MSVC2017_x64/TGUI/cmake/Modules/FindTGUI.cmake".



DJuego

P.S: By the way, when do you plan to release the new stable version 0.8? :-D

5
Installation help / tgui master.
« on: 10 April 2018, 22:25:47 »
Hi! I just registered. Thank you for tgui! I've used it several times and it's great. I always build the master branch and I have not had problems for a long time. I use a script. However in the last weeks a problem has appeared.

Code: [Select]
Instalacion TGUI en x64
-- The C compiler identification is MSVC 19.13.26128.0
-- The CXX compiler identification is MSVC 19.13.26128.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.13.26128/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of void*
-- Check size of void* - done
CMake Warning at CMakeLists.txt:171 (find_package):
  By not providing "FindSFML.cmake" in CMAKE_MODULE_PATH this project has
  asked CMake to find a package configuration file provided by "SFML", but
  CMake did not find one.

  Could not find a package configuration file provided by "SFML" (requested
  version 2) with any of the following names:

    SFMLConfig.cmake
    sfml-config.cmake

  Add the installation prefix of "SFML" to CMAKE_PREFIX_PATH or set
  "SFML_DIR" to a directory containing one of the above files.  If "SFML"
  provides a separate development package or SDK, be sure it has been
  installed.


CMake Error at CMakeLists.txt:184 (message):
  CMake couldn't find SFML.

  Either set SFML_DIR to the directory containing SFMLConfig.cmake or set the
  SFML_ROOT entry to SFML's root directory (containing "include" and "lib"
  directories).


-- Configuring incomplete, errors occurred!
See also "P:/Compilados/x32-x64/TRABAJO_MSVC2017_x64/TGUI/builds/debug/CMakeFiles/CMakeOutput.log".



I do not know if they are due to changes in SFML (branch master) or tgui (branch master). (?) I work in Windows 10 x64 with Visual Studio 2017.
Interestingly, if I configure and generate the files with cmake-gui (without changes), it works!

Any idea? Thanks!

DJuego

Pages: [1]