Buttons and Graphics

Jun 26, 2008 at 2:39pm
Im thinking off trying to add some stuff to my project i would like to add some graphics and some buttons whats the best update or whatever call it for that???

And also how do i do it??
Jun 26, 2008 at 6:28pm
This is very much the same question you asked about trying to make C++ more "stylish".

You NEED to use a GUI Toolkit OR Code your Windows directly using Win32 API. There isn't really any other way.

With Dev-C++. You can install Dev-Paks from their Website Manager Tool, or from a site like www.devpak.org. Some of the available GUI Toolkits (last time I checked) are FLTK, WxWidgets/wxWindows, GTK, Fox (Maybe).

Otherwise, Download a copy of a Win32 API Reference file and look up "CreateWindow" function.
Last edited on Jun 26, 2008 at 6:38pm
Jun 26, 2008 at 7:32pm
Hmm i dwnloaded some off the Toolkits except i dunno how to use them......im using Bloodshed Dev-C++ for anyone who doesnt know already
Jun 26, 2008 at 7:42pm
There is no 1-answer for all Toolkits unfortunately. This is a downside of C++ and Graphical Application Programming.

Each toolkit has it's own VERY different API, Rules and Syntax. Unless you have programmed in it before, then you are going to have to do some very serious studying of the tutorials for that toolkit. Myself, I have worked in FLTK (not for many years) and WxWidgets. So I am of no use to someone working in QT or GTK specific code. You will need to pick the one you are keen in using, and head off to their website and go through their tutorials. Each Toolkit will be as difficult (if not more) than learning C++ again unfortunately.
Jun 26, 2008 at 7:49pm
I have 2 things one is called FLTK 1.1.9 and also something called Allegro but i dont even know what i do or how to do something with them??? If i can get them working then i could mess about and see what all the functions are and do but i dont know how to get it working...
Last edited on Jun 26, 2008 at 7:50pm
Jun 26, 2008 at 7:55pm
You will need to head to the FLTK website and look at their tutorials and documentation. They have their own VERY specific implementation of things.

Jun 26, 2008 at 8:01pm
Im on the FLTK webby been on all day...it tells u how to use it and etc but not how to get it too start up...
Jun 26, 2008 at 8:03pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Box.H>

int main(int argc, char **argv) {
  Fl_Window *window = new Fl_Window(300,180);
  Fl_Box *box = new Fl_Box(20,40,260,100,"Hello, World!");
  box->box(FL_UP_BOX);
  box->labelsize(36);
  box->labelfont(FL_BOLD+FL_ITALIC);
  box->labeltype(FL_SHADOW_LABEL);
  window->end();
  window->show(argc, argv);
  return Fl::run();
}


Thats their code for a Hello World example. You should be able to compile that and run it with no problem is FLTK is installed.

http://www.fltk.org/documentation.php/doc-1.1/basics.html#basics
Jun 26, 2008 at 8:09pm
It says linker problem like last time i copied that src...
Jun 26, 2008 at 8:15pm
Goto
http://www.fltk.org/documentation.php/doc-1.1/basics.html#basics

Scroll down to "Compiling Programs with Standard Compilers". You need to add the libraries in for your linker to use.
Jun 26, 2008 at 8:32pm
ZOMG im so stupid i was making just plain codes when i should have been making Projects lol xD i think it should be outlined more
Jun 26, 2008 at 8:38pm
They can't outline it. Because they don't know which of a dozen+ IDEs you are using across multiple-platforms.

You could be using
VI/Command Line with GCC/BCC
Eclipse
Visual Studio 6
Visual Studio .NET
Dev-C++
Anjuta
Code::Blocks
NetBeans
// Just to name but a few of the IDEs. Each one VERY different from the last.

And, if you were just compiling it from a command line, then you would have no "projects" etc. Just execute the command against your compiler directly.
Jun 26, 2008 at 8:42pm
Right now i done all that and know how to put graphics in how do i make my own graphics paint???
Jun 26, 2008 at 9:12pm
Explain more please. What do you want to achieve?
Jun 27, 2008 at 8:27am
This is a guess, but I suspect you want to draw pictures on the screen, lines shapes etc. If you had Visual Studio I'd say start looking at the MFC CDC class. For the really clever stuff you need DirectX or OpenGL. I don't know if Bloodshed Dev-C++supports any of these.

Judging by your other posts, asking to be taught C++ etc, I think you are still learning the language. It would not recommend attempting to use any of these packages without a good grounding in C or C++ first. Walk before you try and run otherwise you'll end up very frustrated and disillusioned with the whole thing.
Jun 29, 2008 at 6:58pm
All compilers have OpenGL support. You don't need additional libraries for it :) So that includes MingW under Dev-C++. Dev-C++ also should have DirectX DevPaks.

Topic archived. No new replies allowed.