Update: Irrlicht and FLTK !!!

Announce new projects or updates of Irrlicht Engine related tools, games, and applications.
Also check the Wiki
Post Reply
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Update: Irrlicht and FLTK !!!

Post by Acki »

Hi,
I now created 2 Demos for using Irrlciht with FLTK !!!
I also created a hdcWidget for FLTK that I use in demo 2 !!!

If you're using FLTK with Windows and want to use Irrlicht, check this out !!! 8)

(have a look at my site ;) )
Last edited by Acki on Fri Dec 23, 2005 7:53 pm, edited 1 time in total.
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Pilsowski

Post by Pilsowski »

Hi Acki,

this one is gonna be great. I am looking forward to get it working.
I have installed the two required Devpaks but still get a linker error which says:

-lfltk_s not found

Any idea?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Hmmm,
did you set up the lib path correctly ???
The compiler can't find this FLTK lib...
Be sure your project settings are correct !!!
The demos are written with FLTK 2, so if you're using an older version, include the correct libs and includes...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Pilsowski

Post by Pilsowski »

First example works, second doesn't.

DevCpp:
-------

In "Project ->Project Options -> Parameter" I had to remove all the _s
and the -ALLE. I also choose OPENGL instead of DX9 in the main.cpp.
This way i got the first example running. Looks great, thank you Acki.

On the second one i had no joy:
K:\irrlicht-0.14.0\examples\fltk\2\hdcWidget.cpp In member function `virtual void fltk::hdcWidget::draw()':

14 K:\irrlicht-0.14.0\examples\fltk\2\hdcWidget.cpp 'class fltk::Symbol' has no member named 'dx'
14 K:\irrlicht-0.14.0\examples\fltk\2\hdcWidget.cpp 'class fltk::Symbol' has no member named 'dy'
14 K:\irrlicht-0.14.0\examples\fltk\2\hdcWidget.cpp 'class fltk::Symbol' has no member named 'dw'
14 K:\irrlicht-0.14.0\examples\fltk\2\hdcWidget.cpp 'class fltk::Symbol' has no member named 'dh'

K:\irrlicht-0.14.0\examples\fltk\2\Makefile.win [Build Error] [obj/hdcWidget.o] Error 1
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I has this problem as I forgot to include the box.h to the widget...
Be sure, all necessery includes are done in hdcWidget.h !!!

Code: Select all

#include <windows.h>
#include <fltk/Widget.h>
#include <fltk/Box.h>
#include <fltk/Window.h>
#include <fltk/x.h>
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Pilsowski

Post by Pilsowski »

Hi Acki,

looks much like you updated it before i downloaded, as the includes are already exactly
as you stated. Bad thing is that i still have the errors. What else could it be?
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Hmmm,
You'r using FLTK1, don't you ???
The widget was written for FLTK2...
But if you're got it that far, you should be able to run it with FLTK1... ;)
I had a look at the old version and it seems you have to change them to X(), Y(), W() and H() !!!
Or maybe in lower case (x(), y(), w() and h()), this should solve the problem...

Otherwise I have no clue... :(

But I suggest all FLTK1 users to update to FLTK2 !!! ;)
(just in my oppinion)

CU, Acki
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Vox
Posts: 47
Joined: Fri Apr 01, 2005 5:25 pm

Post by Vox »

I'm waiting for FLTK2 to mature. It is not what I expected to be.
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Well, I'm very pleased with it !!! :P
I also started with FLTK1 and changed to FLTK2, when it was released...
Now I'm working with v2 since then and it's great... :D

Well, as I wrote in my last post: just my oppinion... ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

Hi,
I removed a bug that caused the hdcWidget not to draw at the correct position inside its parent !!!

And the demo 1 was changed to show how hcdWidget also can be used without Irrlicht !!!

CU ;)
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
weber
Posts: 1
Joined: Thu Sep 14, 2006 8:51 am

Post by weber »

The widget is not working linking with the new fltk2 snapshot libs which are constantly changing.
So please create it for fltk1.1.7 which is stable. I tried to port it but it gives problems.

Code: Select all

//----------------------------------------------------------------
#ifndef hdcWidget_H
#define hdcWidget_H

#include <windows.h>
#include <FL/Fl_Widget.h>
#include <FL/Fl_Box.h>
#include <FL/Fl_Window.h>
#include <FL/x.h>


class hdcWidget : public Fl_Widget{
  private:
    HWND hIrrlichtWindow;
    
	public:
    hdcWidget(int,int,int,int,const char* =0);
		HWND getHWND(HINSTANCE hInstance = 0);

    virtual void draw();
    
};

#endif // hdcWidget_H
hdcwidget.cpp

Code: Select all

#include "hdcWidget.h"
#include <windows.h>
#include <FL/Fl_Widget.h>
#include <FL/Fl_Box.h>
#include <FL/Fl_Window.h>
#include <FL/x.h>

hdcWidget::hdcWidget(int X, int Y, int H, int W, const char* txt): Fl_Widget(X, Y, H, W, txt){
  hIrrlichtWindow = 0;
}

void hdcWidget::draw(){
  static int curX = 0, curY = 0, curW = 0, curH = 0;
  
  if(hIrrlichtWindow){
    if((curX != this->x()) || (curY != this->y()) || (curW != this->w()) || (curH != this->h())){
//==PROBLEM=======================================
int X = this->x() + this->box()->dx(), Y = this->y() + this->box()->dy(), W = this->w() - this->box()->dw(), H = this->h() - this->box()->dh();
//PROBLEM ABOVE WITH dx() etc=============================
      curX = this->x();
      curY = this->y();
      curW = this->w();
      curH = this->h();
      Fl_Widget* p = this;
      while((p = p->parent()) != NULL){
        if(!p->window()){//is_window
          X += p->x();
          Y += p->y();
        }
      }
      MoveWindow(hIrrlichtWindow, X, Y, W, H, true);
    }
  }
//===PROBLEM HERE==============  
 Fl_Widget::draw();//problem here==========================Problem here
}

HWND hdcWidget::getHWND(HINSTANCE hInstance){
  if(hIrrlichtWindow == 0){
    Fl_Widget* root = this;
    while(root->parent() != NULL) root = (Fl_Widget*)root->parent();
    if(root->window()){//is_window
      HWND hDesktop = GetDesktopWindow();
      RECT lpRect;
      GetWindowRect(hDesktop, &lpRect);
    	HWND hMainWindow = fl_xid((Fl_Window*)root);
      if(hMainWindow != NULL)
        hIrrlichtWindow = CreateWindow("BUTTON", "", WS_CHILD | WS_VISIBLE | BS_OWNERDRAW, lpRect.left, lpRect.top, lpRect.right - lpRect.left, lpRect.bottom - lpRect.top, hMainWindow, NULL, hInstance, NULL);
      if(hIrrlichtWindow) UpdateWindow(hIrrlichtWindow);
    }
  }
  return hIrrlichtWindow;
}
defFltk.h

Code: Select all

// (C) 2005/2006 by A.Buschhueter
// abusoft@freenet.de
//adapted for fltk1.1.7


#define WIN32_LEAN_AND_MEAN

#ifndef FLTKDEF_H
#define FLTKDEF_H

#include <FL/Fl.h>
#include <FL/Fl_Adjuster.h>
#include <FL/Fl_ask.h>
#include <FL/Fl_Bitmap.h>
#include <FL/Fl_BMP_Image.h>
#include <FL/Fl_Box.h>
#include <FL/Fl_Browser.h>
#include <FL/Fl_Browser_.h>
#include <FL/Fl_Button.h>
#include <FL/Fl_Chart.h>
#include <FL/Fl_Check_Browser.h>
#include <FL/Fl_Check_Button.h>
#include <FL/Fl_Choice.h>
#include <FL/Fl_Clock.h>
#include <FL/Fl_Color_Chooser.h>
#include <FL/Fl_Counter.h>
#include <FL/Fl_Dial.h>
#include <FL/Fl_Double_Window.h>
#include <FL/fl_draw.h>
#include <FL/Fl_Export.h>
#include <FL/Fl_File_Browser.h>
#include <FL/Fl_File_Chooser.h>
#include <FL/Fl_File_Icon.h>
#include <FL/Fl_File_Input.h>
#include <FL/Fl_Fill_Dial.h>
#include <FL/Fl_Fill_Slider.h>
#include <FL/Fl_Float_Input.h>
#include <FL/Fl_FormsBitmap.h>
#include <FL/Fl_FormsPixmap.h>
#include <FL/Fl_Free.h>
#include <FL/Fl_GIF_Image.h>
#include <FL/Fl_Gl_Window.h>
#include <FL/Fl_Group.h>
#include <FL/Fl_Help_Dialog.h>
#include <FL/Fl_Help_View.h>
#include <FL/Fl_Hold_Browser.H>
#include <FL/Fl_Hor_Fill_Slider.H>
#include <FL/Fl_Hor_Nice_Slider.H>
#include <FL/Fl_Hor_Slider.H>
#include <FL/Fl_Hor_Value_Slider.H>
#include <FL/Fl_Image.H>
#include <FL/Fl_Input.H>
#include <FL/Fl_Input_.H>
#include <FL/Fl_Input_Choice.H>
#include <FL/Fl_Int_Input.H>
#include <FL/Fl_JPEG_Image.H>
#include <FL/Fl_Light_Button.H>
#include <FL/Fl_Line_Dial.H>
#include <FL/Fl_Menu.H>
#include <FL/Fl_Menu_.H>
#include <FL/Fl_Menu_Bar.H>
#include <FL/Fl_Menu_Button.H>
#include <FL/Fl_Menu_Item.H>
#include <FL/Fl_Menu_Window.H>
#include <FL/fl_message.H>
#include <FL/Fl_Multi_Browser.H>
#include <FL/Fl_Multi_Label.H>
#include <FL/Fl_Multiline_Input.H>
#include <FL/Fl_Multiline_Output.H>
#include <FL/Fl_Nice_Slider.H>
#include <FL/Fl_Object.H>
#include <FL/Fl_Output.H>
#include <FL/Fl_Overlay_Window.H>
#include <FL/Fl_Pack.H>
#include <FL/Fl_Pixmap.H>
#include <FL/Fl_PNG_Image.H>
#include <FL/Fl_PNM_Image.H>
#include <FL/Fl_Positioner.H>
#include <FL/Fl_Preferences.H>
#include <FL/Fl_Progress.H>
#include <FL/Fl_Radio_Button.H>
#include <FL/Fl_Radio_Light_Button.H>
#include <FL/Fl_Radio_Round_Button.H>
#include <FL/Fl_Repeat_Button.H>
#include <FL/Fl_Return_Button.H>
#include <FL/Fl_Roller.H>
#include <FL/Fl_Round_Button.H>
#include <FL/Fl_Round_Clock.H>
#include <FL/Fl_Scroll.H>
#include <FL/Fl_Scrollbar.H>
#include <FL/Fl_Secret_Input.H>
#include <FL/Fl_Select_Browser.H>
#include <FL/Fl_Shared_Image.H>
#include <FL/fl_show_colormap.H>
#include <FL/fl_show_input.H>
#include <FL/Fl_Simple_Counter.H>
#include <FL/Fl_Single_Window.H>
#include <FL/Fl_Slider.H>
#include <FL/Fl_Spinner.H>
#include <FL/Fl_Sys_Menu_Bar.H>
#include <FL/Fl_Tabs.H>
#include <FL/Fl_Text_Buffer.H>
#include <FL/Fl_Text_Display.H>
#include <FL/Fl_Text_Editor.H>
#include <FL/Fl_Tile.H>
#include <FL/Fl_Tiled_Image.H>
#include <FL/Fl_Timer.H>
#include <FL/Fl_Toggle_Button.H>
#include <FL/Fl_Toggle_Light_Button.H>
#include <FL/Fl_Toggle_Round_Button.H>
#include <FL/Fl_Tooltip.H>
//#include <FL/C>
#include <FL/Fl_Value_Input.H>
#include <FL/Fl_Value_Output.H>
#include <FL/Fl_Value_Slider.H>
#include <FL/Fl_Widget.H>
#include <FL/Fl_Window.H>
#include <FL/Fl_Wizard.H>
#include <FL/Fl_XBM_Image.H>
#include <FL/Fl_XPM_Image.H>
#include <FL/forms.H>
#include <FL/gl.H>
#include <FL/gl2opengl.H>
#include <FL/gl_draw.H>
#include <FL/glut.H>
//#include <FL/mac.H>
#include <FL/math.H>
//#include <FL/win32.H>
#include <FL/x.H>
#endif
Please help by showing how to solve this. If anybody is having a version for 1.1.7 ,please post it.
[/code]
Post Reply