Page 1 of 1

C++ FLTK GRAPHICS TUTORIAL C++ FLTK GRAPHICS TUTORIAL Rate Topic: -----

#1 Elcric  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 102
  • View blog
  • Posts: 453
  • Joined: 02-May 09

Posted 29 August 2009 - 12:17 AM

C++ FLTK GRAPHICS TUTORIAL



WHAT YOU WILL LEARN IN THIS TUTORIAL:

1. You will learn how to download FLTK.

2. You will learn how to install FLTK.

3. You will learn how to use FLTK in visual studio.

4. You will learn how to test FLTK.

• I. INTRODUCTION

Hello; nice to meet you! Welcome to the “C++ FLTK Graphics Tutorial.”

This tutorial describes how to install FLTK using Microsoft Visual Studio. If you use another system refer to the downloaded files main folder for directions for your system.

This tutorial assumes you have a basic understanding of classes, inheritance, pointers and dynamic memory allocation.

This tutorial also assumes you already have Microsoft Visual Studio C++ installed on your computer and you are familiar with its use.

• II. FLTK

Fast Light Tool Kit (FLTK) pronounced full tick is a cross-platform Graphical User Interface (GUI) library. FLTK is free open source software, it is fun and easy to learn, and has a short learning curve for new users.

• III. DOWNLOADING FLTK

Use the following steps to download FLTK:

1. Go to http://www.fltk.org/

2. Click download in the navigation menu.

3. Choose FLTK 1.1.9 in the menu.

4. Choose the zip file format download.

The file you will receive will be in a zip file format. Use WinZip or a similar program to unzip and extract the files into normal files on your C drive. When you are done you will have a folder on your C drive that looks like this:

C:\fltk-1.1.9

• IV. INSTALLING FLTK

Use the following steps to install FLTK:

1. Open the VISUALC folder.

Double click the FLTK setup file that looks like a green, orange, and yellow infinity symbol.

The FLTK setup file update will open your Microsoft Visual Studio C++ program and begin the FLTK installation.

2. When Microsoft Visual Studio C++ asks about updating old projects choose “Yes to All.”

When the updating of old projects is completed you will see “Ready” appear in the bottom left corner of your screen.

3. From the Microsoft Visual Studio C++ “Build Menu,” choose “Build Solution.”

When the “Build Solution” has successfully completed you will see 71 succeeded, 0 failed, 0 up to date, and 0 skipped.

If you do not receive this message, the Build failed and you will see error messages telling you what went wrong. If this happens post a question on the DIC website in the forums and either I or someone else will help you.

4. Close Visual Studio.

5. Open your C:\ drive directory.

From C:\fltk-1.1.9 open the lib folder. Copy all the seven .lib files, except for the README.LIB, into:

C:\Program Files\Microsoft Visual Studio\Vc\lib

6. From C:\fltk-1.1.9 copy the FL folder into:

C:\Program Files\ Microsoft Visual Studio\Vc\include

• V. USING FLTK IN MICROSOFT VISUAL STUDIO

Use the following steps to use FLTK in Microsoft Visual Studio:

1. Open Visual Studio

Create a Win32 console application empty project.

2. From Visual Studio main top menu choose Project and from the drop-down menu choose Properties.

To expand a sub-menu click the Linker folder in the left menu of the Properties dialog box. In the sub-menu click Input. On the right, in the additional dependencies text field enter the following text:

fltkd.lib wsock32.lib comctl32.lib fltkjpegd.lib fltkimagesd.lib

In the “Ignore Specific Library” text field enter the following text:

libcd.lib

3. From Visual Studio create a new .cpp file.

From Visual Studio main top menu choose Project and from the drop-down menu choose Properties.

In the left menu of the Properties window click C\C++ to expand a sub-menu. Click the “Code Generation” sub-menu item. On the right, change the “Runtime Library” drop-down to:

Multi-threaded Debug DLL (\MDd)

Click OK to close the Properties window.

• VI. TESTING FLTK

Use the following steps to test FLTK:

1. From the .cpp file type the following code:

#include <Fl/Fl.h>
#include <Fl/Fl_Box.h>
#include <Fl/Fl_window.h>

int main()
{
	 Fl_Window window(200,200, "Window title");
	 Fl_Box box(0,0,200,200,"Hello World!");
	 window.show();
	 return Fl::run();
}



2. Build and Debug the .cpp file.

A successful run will create a blank FLTK window.

Future tutorials will explain how to use FLTK.

If you did not have a successful run post questions in the DIC website forum and either I or someone else will help you.

Is This A Good Question/Topic? 1
  • +

Page 1 of 1