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

Author Topic: Drag drop file message information needed!  (Read 4734 times)

0 Members and 1 Guest are viewing this topic.

kileyi

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Drag drop file message information needed!
« on: December 15, 2018, 11:09:52 pm »
I'm using windows version,and SFML 2.5.1 does not support this.
Other framework such as SDL2,GLFW,bgfx,they all support drag drop file message.

It's easy to achieve with about 10 line codes,but I suggest SFML official built-in to do this.
That means I don't need to re-do this when I update SFML.

Just search WM_DROPFILES with SDL2 or GLFW or bgfx source code you will see how it works.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #1 on: December 16, 2018, 04:37:46 am »
This was discussed previously (I was for it but.. ::) ): https://en.sfml-dev.org/forums/index.php?topic=19096.0

There's a wokraround WinAPI client side implementation there if you want it (it's not a SFML patch, you can put it in your program once and forget it, just change the part where names are queried to somehow store them for later use or use a callback or something, the sf::Window pointer is tucked into one of the userdata pointers somewhere too, I think): https://gist.github.com/FRex/3f7b8d1ad1289a2117553ff3702f04af
« Last Edit: December 16, 2018, 04:40:19 am by FRex »
Back to C++ gamedev with SFML in May 2023

kileyi

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #2 on: December 16, 2018, 07:04:50 am »
Nice work,thanks.

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #3 on: December 16, 2018, 07:20:48 am »
This is WinAPI though, there's also a COM way that gives way more control. And obviously both are Windows only. :P
Back to C++ gamedev with SFML in May 2023

kileyi

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #4 on: December 16, 2018, 07:56:20 am »
This is good enough for me.

Hey,I notice that you look like a game programmer.

Did you know anything about SFML audio or Unity3D Audio programming?

I want to port a simple Audio Synthesizer from Unity3D to SFML and I failed.

If you do know maybe and interested,maybe we can work out?

FRex

  • Hero Member
  • *****
  • Posts: 1845
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #5 on: December 16, 2018, 08:12:14 am »
To avoid globals you could also subclass RenderWindow or Window to give yourself nicer API in your class and to cast back to your class from your message function and use (cast back to your class) the this ptr that SFML Window sets.

I'm not a proper game programmer as I've never made any proper finished/complete games and I know nothing about Unity (and I don't plan to use it myself). I don't know how you'd port an audio synthesizer exactly. It depends on what it is and how it works. Like is it an endless/very large stream of audio or something like SFXR that you can generate samples and load them? Look into audio classes in SFML and you should ask on Audio sub-forum.

I'm also not a 'Windows C/C++ programmer' but many parts of WinAPI are really nice and easy to use (like adding this file/filename drop or maximizing or minimizing a window - both are possible with SFML's getSystemHandle) but often get arcane or weird, like this piece of code I had to take desktop screenshot and set a desktop wallpaper (I was making an app to design grid-ish wallpapers around a screenshot of your desktop icons but ended up not finishing it).
Back to C++ gamedev with SFML in May 2023

kileyi

  • Newbie
  • *
  • Posts: 10
    • View Profile
    • Email
Re: Drag drop file message information needed!
« Reply #6 on: December 16, 2018, 11:16:10 am »

 

anything