In order to learn the ins and outs of fltk, I'm writing a sudoku game.
So far I like fltk, it works well and is generally easy to figure out
whats going on. One thing puzzles me though.
The app (Fl_Double_Window) and Board have the same size passed to them.
I would have expected to have to make the app taller by the menubar's
height, but in order for everything to fit, I have to make them the
same. Why?
Here's main() of my program...
#include <FL/Fl.h>
#include <FL/Fl_Menu_Bar.h>
#include "menus.h"
#include "board.h"
const int appW= 500;
const int appH= 500;
const char *appName= "Sudoku";
Board *bp;
int main(int argc, char** argv)
{
Fl::scheme("plastic");
Fl_Double_Window app(appW, appH, appName);
Fl_Menu_Bar menubar(0,0,appW,30);
menubar.menu(mainMenu);
Board board(0,30,appW,appH);
bp= &board;
board.recoil_= &menubar.menu()[15];
board.beep_= &menubar.menu()[16];
board.hAll_= const_cast<Fl_Menu_Item*> (&menubar.menu()[17]);
board.hCursor_= const_cast<Fl_Menu_Item*> (&menubar.menu()[18]);
board.notes_= const_cast<Fl_Menu_Item*> (&menubar.menu()[19]);
app.resizable(&board);
app.size_range(300,330);
app.show();
return Fl::run();
}
and here is Board's ctr...
Board::Board(int x, int y, int w, int h)
: Fl_Group(x, y, w, h),
oldH_(-1),
oldW_(-1),
cursor_(0),
error_(false)
{
int a[]= {1,2,3,4,5,6,7,8,9};
set<int> all(a,a+9);
for ( int i=0; i<81; ++i )
{
cell_.push_back( new Cell );
cell_.back()->ebleco(all);
}
}
I'm using fltk 1.1.9 under Linux.
Mike
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk