Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: [Release][GUI] ImGui-SFML  (Read 71673 times)

0 Members and 1 Guest are viewing this topic.

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #15 on: September 01, 2017, 10:10:53 am »

ImGui-SFML got Android port by Peter Repukat! Get it in the latest version.
« Last Edit: February 01, 2018, 03:02:53 pm by Elias Daler »
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Hawkrex

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [Release][GUI] SFML + ImGui lib
« Reply #16 on: October 10, 2017, 11:33:11 pm »
Hi,

first thank you for the lib <3

There's just one thing that don't work, when I try to do :
const sf::Texture& tex = TextureManager::getTexture("randomName");
ImGui::Image(tex);

but the compiler tells me :

Quote
'ImGui::Image' : the function doesn't take 1 argument

Can somebody help me please ?

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #17 on: October 13, 2017, 12:45:37 am »
Are you sure you've included ImGui-SFML's header in this file?
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

Hawkrex

  • Newbie
  • *
  • Posts: 3
    • View Profile
Re: [Release][GUI] SFML + ImGui lib
« Reply #18 on: October 14, 2017, 01:43:01 pm »
I just find out that in the version of imgui-SFML.h I had, there was no include guard. So I added a #pragma once and it works.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #19 on: November 20, 2017, 05:34:39 am »
I've made a script to merge imgui and imgui-sfml into a pair of files, maybe someone will find it useful too. https://gist.github.com/FRex/41b41708daf87d22cf3557766b9dff9b
Back to C++ gamedev with SFML in May 2023

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: [Release][GUI] SFML + ImGui lib
« Reply #20 on: January 06, 2018, 12:56:51 pm »
Is there a way to use imgui & imgui-sfml using git submodules? I encountered a problem related to the custom     imgui config, which needs to be overwritten (as you wrote on your github readme). My workaround is to fork the official imgui, replace the config and use this repo as submodule. But I'm not satisfied by this solution.

Is there a way to determine an external imconfig without replacing the file?

Like
./
    extlibs/
        imgui --> submodule to the offical imgui
        imgui-sfml --> submodule to your imgui-sfml
    include/
        imconfig.h --> my custom imconfig


I want to keep thirdparty libs and my code separate.
« Last Edit: January 06, 2018, 12:59:33 pm by Glocke »
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: [Release][GUI] SFML + ImGui lib
« Reply #21 on: January 06, 2018, 11:06:53 pm »
I've just added a #include <imgui-sfml/imconfig-SFML.h> to my imconfig.h.

Make the compiler do the copying for me.

For reference, I have a similar project file structure:

./project-root/
    imgui/
    imgui-sfml/
    project/
        imconfig.h
        ...

Glocke

  • Sr. Member
  • ****
  • Posts: 289
  • Hobby Dev/GameDev
    • View Profile
Re: [Release][GUI] SFML + ImGui lib
« Reply #22 on: January 11, 2018, 09:38:53 am »
Make the compiler do the copying for me.

I didn't get it managed. Can you explain your approach more in detail, please? :)
Current project: Racod's Lair - Rogue-inspired Coop Action RPG

dabbertorres

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
    • website/blog
Re: [Release][GUI] SFML + ImGui lib
« Reply #23 on: January 11, 2018, 04:26:32 pm »
Sure.

Here's the project layout:
Code: [Select]
./
  imgui/
    imgui.h
    ...
  imgui-sfml/
    imconfig-SFML.h
    imgui-SFML.h
    ...
  project/
    imconfig.h
    main.cpp

project/imconfig.h contains
#include <imgui-sfml/imconfig-SFML.h>

project/main.cpp contains
#include <imgui.h>
#include <imgui-sfml/imgui-SFML.h>

I have the project root directory, project/, and imgui/ folders as include directories, ie: "-I$PROJECT_DIR -I$PROJECT_DIR/project -I$PROJECT_DIR/imgui"
This is needed because imgui.h has #include "imconfig.h", and imgui-SFML.cpp has #include <imgui.h>

You'll also have to make sure you delete, (or rename) imgui/imconfig.h, otherwise you'll run into conflicts at compile time with your project/imconfig.h
Or you could even just use imgui/imconfig.h, and not have a project/imconfig.h
« Last Edit: January 11, 2018, 04:30:06 pm by dabbertorres »

Zinidane

  • Newbie
  • *
  • Posts: 4
    • View Profile
Re: [Release][GUI] SFML + ImGui lib
« Reply #24 on: January 30, 2018, 06:43:28 pm »
Just integrated it to my project... works great !

I want to do a tilemap like your example and i'm wondering how you did it ? Did you use a imagebutton for each tile ? Selectable something ?

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #25 on: February 01, 2018, 03:02:24 pm »
Just integrated it to my project... works great !
Glad it works well for you!

I want to do a tilemap like your example and i'm wondering how you did it ? Did you use a imagebutton for each tile ? Selectable something ?
Nope, I'm drawing the image and then I detect a click on it. Then I just do this:
tileIndex = (clickPos - tileImagePos) / tileSize
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #26 on: February 09, 2018, 12:38:20 am »
Context management is now explicit in imgui so your SFML-imgui doesn't work with imgui master head (i.e. it uses the now gone Shutdown()).
Back to C++ gamedev with SFML in May 2023

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #27 on: February 09, 2018, 08:37:04 am »
Yes, an issue was created about that. I plan to create a separate branch to handle both master and latest release of Imgui. :)
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #28 on: February 09, 2018, 11:56:42 am »
Great. It's kinda annoying there wasn't a shortcut provided by IMGUI since overloading functions was why it was in C++ in the first place. I'm using commit 07ee5390 from it now but it was surprising it failed to work out of the box on two masters.
Back to C++ gamedev with SFML in May 2023

Elias Daler

  • Hero Member
  • *****
  • Posts: 599
    • View Profile
    • Blog
    • Email
Re: [Release][GUI] SFML + ImGui lib
« Reply #29 on: February 10, 2018, 01:08:40 am »
Yeah, it was pretty weird to just merge it into master without time to react to that, heh. :/
Tomb Painter, Re:creation dev (abandoned, doing other things) | edw.is | @EliasDaler

 

anything