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

Author Topic: Self Contained project + text box input + Image resizing  (Read 895 times)

0 Members and 1 Guest are viewing this topic.

Titch

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
Self Contained project + text box input + Image resizing
« on: April 26, 2018, 12:25:19 pm »
Hello, I have recently started using SFML in a project that will be connecting to a FTP, I have the connection working, now need a text box to display so the ftp address, and login details can be changed and I'm Unsure how to tackle this at all.

The other problem/question I'm having is how do I make it so the project is self contained for release as currently for the includes I'm having to use a full directory and not everyone will have the same, is there a way that I am able to make it self contained as such so it is all within the one file. - eg so I dont have to do this - #include <D:\Work\SFML-2.4.2\include/SFML/System.hpp>

Finally, Does SFML allow for image resizing, another part of the program I am working on is for it to take a users selected image, and output the same image in different resolutions, these new files are what will be uploaded to the ftp. - Preferably is there a way that this would use windows file explorer and will be able to take more than one image at a time rather than have the user having to input the file directory of where the image is saved? 

I'm currently developing in VS 2017 community in C++ and developing this as  desktop application.

Thank you for your time reading this, Any suggestions and/or help is much appreciated,
Titch.

Arcade

  • Full Member
  • ***
  • Posts: 230
    • View Profile
Re: Self Contained project + text box input + Image resizing
« Reply #1 on: April 27, 2018, 03:54:56 pm »
1. How do I create a text box?

This is kind of a broad question. Is there something specific about making a text box that you are unsure of? Why not start with looking at the Window and Graphics module tutorials. Once you have the basics down, you'll probably want to draw a sf::RectangleShape to represent the text box, sf::Text to show the text inside of the text box, and use events to know when the textbox has been clicked on (for focus) and to know when the user is typing something. Alternatively you could use an existing GUI library like Imgui, TGUI, or SFGUI.

2. How do I make the project "self contained"?

How exactly are you planning on distributing the project? Are you giving out the source code, or are you planning on compiling it and giving out the final executable? If you are compiling it, then the includes don't matter. Your users don't need the include files to run your program (though, they will need the SFML dlls if you are linking dynamically). If you are giving out the source code, is there a reason you are using full directory locations and not relative path locations?

3. Can I resize images?

SFML doesn't really have many image manipulation functions built in. Someone can correct me if I'm wrong, but if you want to use SFML for this I think the best workaround would be to load your initial image as a texture, create a sprite from it, zoom the sprite to your desired resolution, draw that to a RenderTexture, and then copy that back to an image.

I'm not sure what you mean by "use windows file explorer". Do you mean that you want to drag files from windows file explorer and drop them into the SFML window? If so, no I don't think that functionality has been added to SFML, though there has been some discussion on it in the past.
« Last Edit: April 27, 2018, 04:06:45 pm by Arcade »

 

anything