You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(136) |
Dec
(218) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(214) |
Feb
(208) |
Mar
(186) |
Apr
(15) |
May
(3) |
Jun
(35) |
Jul
(6) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2005 |
Jan
(1) |
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
(58) |
Aug
(123) |
Sep
(31) |
Oct
(9) |
Nov
|
Dec
(1) |
2006 |
Jan
(25) |
Feb
(10) |
Mar
(25) |
Apr
(61) |
May
|
Jun
(78) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
(12) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(10) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: <geo...@us...> - 2003-12-12 16:13:00
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/raceselect/text In directory sc8-pr-cvs1:/tmp/cvs-serv17399/raceselect/text Added Files: barver_backgr.bmp barver_button.bmp down_default.bmp up_default.bmp Log Message: reorganizing interface files --- NEW FILE: barver_backgr.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: barver_button.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: down_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: up_default.bmp --- (This appears to be a binary file; contents omitted.) |
From: <geo...@us...> - 2003-12-12 16:13:00
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/raceselect In directory sc8-pr-cvs1:/tmp/cvs-serv17399/raceselect Added Files: info.txt Log Message: reorganizing interface files --- NEW FILE: info.txt --- gamex/interface/dialogeditor/raceselect/text/barver_backgr_y = 23 gamex/interface/dialogeditor/raceselect/text/barver_backgr_x = 262 gamex/interface/dialogeditor/raceselect/text/down_default_y = 373 gamex/interface/dialogeditor/raceselect/text/down_default_x = 264 gamex/interface/dialogeditor/raceselect/text/up_default_y = 2 gamex/interface/dialogeditor/raceselect/text/up_default_x = 266 gamex/interface/dialogeditor/raceselect/text/backgr_y = 13 gamex/interface/dialogeditor/raceselect/text/backgr_x = 12 |
From: <geo...@us...> - 2003-12-12 16:13:00
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/branches In directory sc8-pr-cvs1:/tmp/cvs-serv17399/branches Added Files: down_default.bmp up_default.bmp Log Message: reorganizing interface files --- NEW FILE: down_default.bmp --- (This appears to be a binary file; contents omitted.) --- NEW FILE: up_default.bmp --- (This appears to be a binary file; contents omitted.) |
From: <geo...@us...> - 2003-12-12 16:11:34
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor In directory sc8-pr-cvs1:/tmp/cvs-serv16945 Modified Files: backgr.bmp info.txt Log Message: reorganizing interface files Index: backgr.bmp =================================================================== RCS file: /cvsroot/timewarp/gamex/interface/dialogeditor/backgr.bmp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 Binary files /tmp/cvswdX994 and /tmp/cvszTyth6 differ Index: info.txt =================================================================== RCS file: /cvsroot/timewarp/gamex/interface/dialogeditor/info.txt,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** info.txt 18 Nov 2003 17:14:18 -0000 1.1.1.1 --- info.txt 12 Dec 2003 16:11:29 -0000 1.2 *************** *** 1 **** --- 1,33 ---- + gamex/interface/dialogeditor/text/barver_backgr_y = 80 + gamex/interface/dialogeditor/text/barver_backgr_x = 692 + gamex/interface/dialogeditor/race_backgr_y = 10 + gamex/interface/dialogeditor/race_backgr_x = 233 + gamex/interface/dialogeditor/state_on_y = 8 + gamex/interface/dialogeditor/state_on_x = 182 + gamex/interface/dialogeditor/prevbranch_default_y = 421 + gamex/interface/dialogeditor/prevbranch_default_x = 85 + gamex/interface/dialogeditor/addbranch_default_y = 368 + gamex/interface/dialogeditor/addbranch_default_x = 93 + gamex/interface/dialogeditor/refresh_default_y = 160 + gamex/interface/dialogeditor/refresh_default_x = 22 + gamex/interface/dialogeditor/branches/down_default_y = 489 + gamex/interface/dialogeditor/branches/down_default_x = 694 + gamex/interface/dialogeditor/branches/up_default_y = 328 + gamex/interface/dialogeditor/branches/up_default_x = 693 + gamex/interface/dialogeditor/text/down_default_y = 256 + gamex/interface/dialogeditor/text/down_default_x = 695 + gamex/interface/dialogeditor/text/up_default_y = 58 + gamex/interface/dialogeditor/text/up_default_x = 694 + gamex/interface/dialogeditor/race/backgr_y = 10 + gamex/interface/dialogeditor/race/backgr_x = 233 + gamex/interface/dialogeditor/state/on_y = 8 + gamex/interface/dialogeditor/state/on_x = 182 + gamex/interface/dialogeditor/prevbranch/default_y = 421 + gamex/interface/dialogeditor/prevbranch/default_x = 85 + gamex/interface/dialogeditor/refresh/default_y = 160 + gamex/interface/dialogeditor/refresh/default_x = 22 + gamex/interface/dialogeditor/branches/backgr_y = 344 + gamex/interface/dialogeditor/branches/backgr_x = 163 + gamex/interface/dialogeditor/text/backgr_y = 70 + gamex/interface/dialogeditor/text/backgr_x = 162 res = 800 |
From: <geo...@us...> - 2003-12-12 16:11:34
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/prevbranch In directory sc8-pr-cvs1:/tmp/cvs-serv16945/prevbranch Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:34
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/text/up In directory sc8-pr-cvs1:/tmp/cvs-serv16945/text/up Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:34
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/branches/up In directory sc8-pr-cvs1:/tmp/cvs-serv16945/branches/up Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/text/down In directory sc8-pr-cvs1:/tmp/cvs-serv16945/text/down Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/state In directory sc8-pr-cvs1:/tmp/cvs-serv16945/state Removed Files: off.bmp on.bmp Log Message: reorganizing interface files --- off.bmp DELETED --- --- on.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/refresh In directory sc8-pr-cvs1:/tmp/cvs-serv16945/refresh Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/raceselect/scroll/up In directory sc8-pr-cvs1:/tmp/cvs-serv16945/raceselect/scroll/up Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/raceselect/scroll/scroll_vert In directory sc8-pr-cvs1:/tmp/cvs-serv16945/raceselect/scroll/scroll_vert Removed Files: backgr.bmp button.bmp Log Message: reorganizing interface files --- backgr.bmp DELETED --- --- button.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/raceselect/scroll/down In directory sc8-pr-cvs1:/tmp/cvs-serv16945/raceselect/scroll/down Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:33
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/race In directory sc8-pr-cvs1:/tmp/cvs-serv16945/race Removed Files: backgr.bmp Log Message: reorganizing interface files --- backgr.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:11:32
|
Update of /cvsroot/timewarp/gamex/interface/dialogeditor/branches/down In directory sc8-pr-cvs1:/tmp/cvs-serv16945/branches/down Removed Files: default.bmp Log Message: reorganizing interface files --- default.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 16:02:52
|
Update of /cvsroot/timewarp In directory sc8-pr-cvs1:/tmp/cvs-serv15290 Modified Files: ingame.txt Log Message: no message |
From: <geo...@us...> - 2003-12-12 16:02:00
|
Update of /cvsroot/timewarp/source/melee In directory sc8-pr-cvs1:/tmp/cvs-serv15141/melee Modified Files: mmain.h Log Message: adding virtual to a ship-class routine Index: mmain.h =================================================================== RCS file: /cvsroot/timewarp/source/melee/mmain.h,v retrieving revision 1.4 retrieving revision 1.5 diff -C2 -d -r1.4 -r1.5 *** mmain.h 24 Aug 2003 10:55:33 -0000 1.4 --- mmain.h 12 Dec 2003 16:01:56 -0000 1.5 *************** *** 55,59 **** int next_choose_new_ships_time; ! void choose_new_ships() ; int indhealthtoggle, indteamtoggle; --- 55,59 ---- int next_choose_new_ships_time; ! virtual void choose_new_ships() ; int indhealthtoggle, indteamtoggle; |
Update of /cvsroot/timewarp/source/games/triggers In directory sc8-pr-cvs1:/tmp/cvs-serv14350/triggers Removed Files: trcontrol.cpp trcontrol.h tredit.cpp tredit.h trgamesetting.cpp trgamesetting.h trhelper.cpp trhelper.h trmath.cpp trmath.h trmissiontest.cpp trmissiontest.h trships.cpp trships.h trtest.cpp trtest.h trvarsetting.cpp trvarsetting.h Log Message: removing trigger-editor --- trcontrol.cpp DELETED --- --- trcontrol.h DELETED --- --- tredit.cpp DELETED --- --- tredit.h DELETED --- --- trgamesetting.cpp DELETED --- --- trgamesetting.h DELETED --- --- trhelper.cpp DELETED --- --- trhelper.h DELETED --- --- trmath.cpp DELETED --- --- trmath.h DELETED --- --- trmissiontest.cpp DELETED --- --- trmissiontest.h DELETED --- --- trships.cpp DELETED --- --- trships.h DELETED --- --- trtest.cpp DELETED --- --- trtest.h DELETED --- --- trvarsetting.cpp DELETED --- --- trvarsetting.h DELETED --- |
From: <geo...@us...> - 2003-12-12 15:58:06
|
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1:/tmp/cvs-serv14041 Added Files: gamebuttonevent.h gametest2.cpp gametest2.h twbutton.cpp twbutton.h twbuttontypes.cpp twbuttontypes.h twhelpers.cpp twhelpers.h twmenuexamples.cpp twmenuexamples.h twpopup.cpp twpopup.h twwindow.cpp twwindow.h Log Message: twgui update --- NEW FILE: gamebuttonevent.h --- #ifndef __GAMEBUTTONEVENT__ #define __GAMEBUTTONEVENT__ template <class G> class BEvent : public ButtonEvent { public: typedef void (G::* ftest) (); G *g; ftest mainpress, mainhold, specialpress, specialhold; BEvent(G *gg, ftest m1, ftest m2); BEvent(G *gg, ftest m1, ftest m2, ftest s1, ftest s2); virtual void handle_main_press(); virtual void handle_main_hold(); virtual void handle_special_press(); virtual void handle_special_hold(); }; template <class G> BEvent<G>::BEvent<G>(G *gg, ftest m1, ftest m2) { g = gg; mainpress = m1; mainhold = m2; } template <class G> BEvent<G>::BEvent<G>(G *gg, ftest m1, ftest m2, ftest s1, ftest s2) { g = gg; mainpress = m1; mainhold = m2; specialpress = s1; specialhold = s2; } template <class G> void BEvent<G>::handle_main_press() { if (mainpress) (g->*mainpress) (); } template <class G> void BEvent<G>::handle_main_hold() { if (mainpress) (g->*mainhold) (); } template <class G> void BEvent<G>::handle_special_press() { if (specialpress) (g->*specialpress) (); } template <class G> void BEvent<G>::handle_special_hold() { if (specialpress) (g->*specialhold) (); } #endif --- NEW FILE: gametest2.cpp --- #include <allegro.h> #include <winalleg.h> //#include <windows.h> #include <stdio.h> #include <string.h> #include "../melee.h" REGISTER_FILE //#include "../melee/mcbodies.h" //#include "../melee/mship.h" //ships #include "../melee/mlog.h" //networking / demo recording / demo playback #include "../melee/mcontrol.h" //controllers & AIs #include "../melee/mframe.h" #include "../melee/mview.h" #include "../melee/mshppan.h" //ship panels... #include "../melee/mitems.h" //#include "../melee/mfleet.h" //fleets... #include "../melee/mcbodies.h" #include "../scp.h" #include "../util/history.h" #include "gametest2.h" #include "twgui.h" //#include "GamePlanetView.h" #include "../scp.h" #include "../melee/mfleet.h" #include "../frame.h" #include "gamebuttonevent.h" /* class ShipPanelToggeable : public ShipPanel { protected: int *toggle; public: ShipPanelToggeable(Ship *s, int *t, Game *g); virtual void animate(Frame *space); }; ShipPanelToggeable::ShipPanelToggeable(Ship *s, int *t, Game *g) : ShipPanel(s) { toggle = t; // a bit weird ... now you got a buffer writing to a buffer before it's finally // written to the screen... I think ;) this->window->surface = g->view->frame->surface; } void ShipPanelToggeable::animate(Frame *space) { if (*toggle) ShipPanel::animate(space); } */ class WedgeIndicatorToggable : public WedgeIndicator { public: WedgeIndicatorToggable(SpaceLocation *target, int length, int color, int *atoggle); int *toggle; virtual void animate(Frame *space); virtual void calculate(); }; WedgeIndicatorToggable::WedgeIndicatorToggable(SpaceLocation *target, int length, int color, int *atoggle) : WedgeIndicator(target, length, color) { toggle = atoggle; } void WedgeIndicatorToggable::animate(Frame *space) { if (*toggle) WedgeIndicator::animate(space); } void WedgeIndicatorToggable::calculate() { //if (*toggle) // better not disable the calculation, cause you'd lose your wedge target if you do !! WedgeIndicator::calculate(); } // W = max width allowed; anything above is scaled down ... BITMAP ** load_fleet_bmps(Fleet *fleet, int W) { BITMAP **fleet_bmp; int i; ShipType *type; DATAFILE *data;//, *data_cached; // create the cache/ directory (if needed ?) mkdir("cache"); fleet_bmp = new BITMAP* [fleet->getSize()+1]; for ( i = 0; i < fleet->getSize(); ++i ) { type = fleet->getShipType(i);//>ship[i]; DATAFILE *alldata = NULL; char fname[512]; RGB *ptest = 0; // hmmm, ship names can have non-standard format ... if (type && type->data) { // first, test if the bitmap is already chached: strcpy(fname, "cache/"); strcat(fname, type->name);//type->data->file); strcat(fname, ".bmp"); BITMAP *btest; btest = load_bmp(fname, ptest); if (btest) { BITMAP *bmp = btest; fleet_bmp[i] = create_bitmap_ex(32, W, W); clear_to_color(fleet_bmp[i], makecol(255,0,255)); if ( bmp->w > W) { // big sprites must be made smaller stretch_blit(bmp, fleet_bmp[i], 0, 0, bmp->w, bmp->h, 0, 0, W, W); } else { int dx, dy; dx = (W - bmp->w)/2; dy = (W - bmp->h)/2; blit(bmp, fleet_bmp[i], 0, 0, dx, dy, bmp->w, bmp->h); } continue; // skip the datafile checks ... } // OTHERWISE, // load the bitmap from scratch, from the (more general) ship data file: // find the 1st ship name (doh) alldata = load_datafile(type->data->file); if (alldata) { int k; // well, standard, the 1st (and sometimes only) ship-rle is on 8th position // hmm, well, almost always - depends on how many panel bitmaps there are ... char *info = (char*) alldata[0].dat; // the info dat header set_config_data(info, alldata[0].size); k = get_config_int("Objects", "PanelBitmaps", 7); data = &alldata[k+1]; } else data = 0; } else data = 0; if (data) { BITMAP *bmp = NULL; if (data->type == DAT_RLE_SPRITE) { RLE_SPRITE* rle = (RLE_SPRITE*) data->dat; BITMAP *bmp2 = create_bitmap_ex(rle->color_depth, rle->w, rle->h); clear_to_color(bmp2, makecol_depth(rle->color_depth, 255,0,255)); // needed, cause rle sprites are drawn transparent by default draw_rle_sprite(bmp2, rle, 0, 0); // change into 32 bits now? bmp = create_bitmap_ex(32, bmp2->w, bmp2->h); blit(bmp2, bmp, 0, 0, 0, 0, bmp2->w, bmp2->h); destroy_bitmap(bmp2); } else if (data->type == DAT_BITMAP) // useful in case you prefer a panel bmp { bmp = (BITMAP*) data->dat; } else { tw_error("Unknown data type"); } fleet_bmp[i] = create_bitmap_ex(32, W, W); clear_to_color(fleet_bmp[i], makecol(255,0,255)); if ( bmp->w > W) { // big sprites must be made smaller masked_stretch_blit(bmp, fleet_bmp[i], 0, 0, bmp->w, bmp->h, 0, 0, W, W); } else { int dx, dy; dx = (W - bmp->w) / 2; dy = (W - bmp->h) / 2; masked_blit(bmp, fleet_bmp[i], 0, 0, dx, dy, bmp->w, bmp->h); } // also, write a copy of this (a cached bmp) to disk: RGB *ptest = 0; int ires = save_bmp(fname, fleet_bmp[i], ptest); if (ires) { tw_error("Could not cache bmp data"); } if (data->type == DAT_RLE_SPRITE) destroy_bitmap(bmp); //unload_datafile_object(data); } else { if (i == 0) fleet_bmp[i] = 0; else fleet_bmp[i] = fleet_bmp[i-1]; tw_error("could not load ship data"); } if (alldata) unload_datafile( alldata ); } fleet_bmp[fleet->getSize()] = 0; // indicates the last element. return fleet_bmp; } void remove_fleet_bmps(BITMAP **fleet_bmp) { int i; i = 0; while (fleet_bmp[i]) { ++i; destroy_bitmap(fleet_bmp[i]); } delete fleet_bmp; } char chars2result[512]; char *chars2(char *c1, char *c2) { if (c1 != chars2result) // in case of nested calls. strcpy(chars2result, c1); strcat(chars2result, c2); return chars2result; } void TWgui::handle_zoom_in() { view->camera.z /= 1 + 0.002 * frame_time; } void TWgui::init(Log *_log) { NormalGame::init(_log); view->window->locate( // 1=in pixels, a fixed amount; 2=in screen width 0, 0, //double x1, double x2 0, 0, //double y1, double y2 0, 1, //double w1, double w2 0, 1 //double h1, double h2 ); // ------- add the menu items --------- unscare_mouse(); show_mouse(window->surface); // which font to use ... that depends on the screen resolution: int i = 2; if (screen->w == 640) i = 2; if (screen->w == 800) i = 3; if (screen->w == 1024) i = 4; // more pixels available for the same "real-life" size. FONT *usefont = videosystem.get_font(i); this->view->frame->prepare(); char menu_filename[512]; set_config_file("client.ini"); strcpy(menu_filename, get_config_string("Menu", "skin", "none")); meleemenu = new TWindow(chars2(menu_filename,"/melee"), 50, 450, this->view->frame->surface); screenswitch = new SwitchButton(meleemenu, "viewscreen_", mapkey(KEY_R, KEY_LCONTROL)); healthbarswitch = new SwitchButton(meleemenu, "healthbars_", mapkey(KEY_H, KEY_ALT)); wedgeindicatorswitch = new SwitchButton(meleemenu, "wedgeindic_", mapkey(KEY_W, KEY_ALT)); captainpanelswitch = new SwitchButton(meleemenu, "cptpanel_", mapkey(KEY_C, KEY_ALT)); chatlogswitch = new SwitchButton(meleemenu, "chatlog_", mapkey(KEY_C, KEY_ALT)); zoomin = new Button(meleemenu, "zoomin_", KEY_EQUALS, 1); zoomin->bind(new BEvent<TWgui>(this, 0, &TWgui::handle_zoom_in)); zoomout = new Button(meleemenu, "zoomout_", KEY_MINUS, 1); abort = new Button(meleemenu, "abort_", mapkey(KEY_A, KEY_LCONTROL)); extraplanet = new Button(meleemenu, "extraplanet_", mapkey(KEY_P, KEY_LCONTROL)); snapshot = new Button(meleemenu, "snapshot_", mapkey(KEY_S, KEY_LCONTROL)); callhelp = new Button(meleemenu, "callhelp_", mapkey(KEY_H, KEY_LCONTROL)); viewmode = new Button(meleemenu, "viewmode_", mapkey(KEY_V, KEY_LCONTROL)); strcpy(texted, "hello"); text_edit = new TextEditBox(meleemenu, "text_", usefont, texted, 512); // text I/O ... experimental !! // experimental, define an alert menu: alertmenu = new PopupT(abort, chars2(menu_filename,"/alert"), 100, 100); alertmenu->center(400, 300); // center around this position, in relative coordinates alertmenu->option.place_relative2mouse = false; alert_yes = new Button(alertmenu, "yes_", KEY_Y); alert_no = new Button(alertmenu, "no_", KEY_N); alert_text = new TextButton(alertmenu, "text_", usefont); alert_text->set_text("Quit game?", makecol(50,50,50)); alertmenu->hide(); //"POPUPLIST" popupviewmode = new PopupList(viewmode, chars2(menu_filename,"/popuplist"), "text/", -50, -50, usefont, 0 ); popupviewmode->tbl->set_optionlist(view_name, num_views, makecol(0,0,0)); // a little help menu // copied from show_file() int L; L = file_size("ingame.txt"); if (L < 0) L = 0; char *helptext = new char [L+1]; PACKFILE *f; f = pack_fopen ("ingame.txt", F_READ); if (f) { L = pack_fread (helptext, L, f); pack_fclose(f); helptext[L] = 0; } else helptext[0] = 0; //, "POPUPHELP" popup2 = new PopupTextInfo(callhelp, chars2(menu_filename,"/popuphelp"), "text/", -50, -50, usefont, helptext, L+1); // the routine makes a copy of the text, so you can delete the original delete helptext; if (!reference_fleet) { tw_error("reference fleet is not available !!"); } BITMAP **bmplist; //bmplist = load_fleet_bmps(reference_fleet, 100); bmplist = 0; // this is invoked in a separate routine, and uses no trigger (=0). //"POPUPFLEET" fleetsel = new PopupFleetSelection(chars2(menu_filename,"/popupfleet"), -50, -50, menu_filename, this->view->frame->surface, bmplist, 1.0, usefont); // winman = new WindowManager; //meleemenu->add(meleemenu); meleemenu->add(alertmenu); meleemenu->add(popupviewmode); meleemenu->add(popup2); meleemenu->tree_doneinit(); // winman->add(fleetsel); // hmm, needed or not ? // some other stuff option.healthbar = 1; option.wedge = 1; option.captain = 1; for ( i = 0; i < 16; ++i ) { always_random[i] = false; // always randomly select ships - prevents menu from popping up player_panel[i] = 0; } } bool TWgui::handle_key(int k) { // toggle the menu on or off, by pressing the space bar. if ((k >> 8) == KEY_SPACE) { if (meleemenu->hidden) meleemenu->show(); else meleemenu->hide(); return true; } return NormalGame::handle_key(k); } void TWgui::calculate() { NormalGame::calculate(); // ------------ INTERPRET RESULTS FROM THE MELEE WINDOW --------------- FULL_REDRAW = true; // only a full_redraw draws the whole frame-surface onto the physical screen. // (otherwise only the small sprites are drawn there ... I think) // I guess this can be a bit slow, but, I don't know why it's slow... perhaps simply // because it's a big screen, or is it because of conversion between color depths? // or something else? meleemenu->tree_calculate(); /* if (zoomin->flag.left_mouse_hold) { // copied this from view_hero : //if (key_pressed(key_zoom_in)) n.z /= 1 + 0.002 * frame_time; //if (key_pressed(key_zoom_out)) n.z *= 1 + 0.002 * frame_time; view->camera.z /= 1 + 0.002 * frame_time; } */ if (zoomout->flag.left_mouse_hold) { view->camera.z *= 1 + 0.002 * frame_time; } // create a snapshot of the screen ... if (snapshot->flag.left_mouse_press) { // copied from game::handle_key pause(); save_screenshot(); unpause(); } // create an extra planet if (extraplanet->flag.left_mouse_press) { // copied from normalgame::handle_key() if (log->type == Log::log_normal) { message.out("MUHAHAHAHAHA!!!!", 5000, 12); create_planet(random(size)); //add(new Planet(random(size), planetSprite, random(planetSprite->frames()))); } } /* if (abort->flag.left_mouse_press) { //meleemenu->focus2other(alertmenu); // meleemenu->disable(); // alertmenu->show(); // alertmenu->focus(); alert_text->set_text("Quit game?", makecol(50,50,50)); } */ option.healthbar = healthbarswitch->state; option.wedge = wedgeindicatorswitch->state; option.captain = captainpanelswitch->state; // ------------ INTERPRET RESULTS FROM THE ALERT WINDOW --------------- // (if the alert window is active, that is). // can an overall menu return a value ?? if (alert_yes->flag.left_mouse_press) { alertmenu->close(-1); game->quit("quit - Game aborted from keyboard"); } if (alert_no->flag.left_mouse_press) { alertmenu->close(-1); //meleemenu->focus(); FULL_REDRAW = true; // redraw the whole scene next iteration. } // check if the viewmode should change: if (popupviewmode->returnvalueready) { int imode; imode = popupviewmode->getvalue(); //message.print(1500, 15, "imode = %i", imode); if (imode >= 0 && imode < num_views) { char *name = popupviewmode->tbl->optionlist[imode]; // change the view, if needed if (get_view_num(view->type->name) != get_view_num(name)) change_view(name); } } } void TWgui::animate(Frame *frame) { /* BITMAP *tmp; tmp = create_bitmap_ex(bitmap_color_depth(screen), screen->w, screen->h); //clear_to_color(tmp, makecol(50,100,150)); // this takes about 2 ms. //blit(tmp, screen, 0, 0, 0, 0, tmp->w, tmp->h); // this takes a long time !! memcpy(screen->dat, tmp->dat, tmp->w * tmp->h); destroy_bitmap(tmp); */ // clear_to_color(screen, makecol(50,100,150)); // this takes 1 to 2 ms. NormalGame::animate(frame); // and the ship panels (which I've put in here ... animate_stuff(frame); // for this to work, you need a full_redraw. // (otherwise, you may need to create dirty items of the menu bitmaps... or something) // I think those write directly to screen memory, and since these bitmaps are big, // you can get some annoying flicker. show_mouse(window->surface); //show_mouse(frame->surface); meleemenu->tree_setscreen(frame->surface); meleemenu->tree_animate(); } // copied and modified from gflmelee ... void TWgui::animate_stuff(Frame *frame) { if (option.captain) { int ix, iy, iw, ih; BITMAP *src; BITMAP *dest = frame->surface; // show the ship panel(s) Ship *s; SpaceObject *t; int i; for ( i = 0; i < num_players; ++i ) { if ( is_local(player_control[0]->channel) ) { s = player_control[i]->ship; if (s) { if (!player_panel[i]) player_panel[i] = new ShipPanelBmp(s); if (player_panel[i]->ship != s) player_panel[i]->ship = s; player_panel[i]->animate_panel(); } // drawing the panel bitmap onto the frame if (player_panel[i]) // needed in case game (ships) isn't initialized yet... { src = player_panel[i]->panel; ix = dest->w - src->w; iy = 0; iw = src->w; ih = src->h; blit(src, dest, 0, 0 , ix, iy, iw, ih); frame->add_box(ix, iy, iw, ih); i = 0; t = player_control[i]->target; i = 1; if (t && t->exists() && t->isShip() ) { if (!player_panel[i]) player_panel[i] = new ShipPanelBmp((Ship*) t); if (player_panel[i]->ship != t) player_panel[i]->ship = (Ship*) t; if (player_panel[i]) { player_panel[i]->animate_panel(); src = player_panel[i]->panel; ix = dest->w - src->w; iy = dest->h - src->h; iw = src->w; ih = src->h; blit(src, dest, 0, 0 , ix, iy, iw, ih); frame->add_box(ix, iy, iw, ih); } } } } } } } void TWgui::animate_predict(Frame *frame, int time) { NormalGame::animate_predict(frame, time); animate_stuff(frame); } void TWgui::animate() { NormalGame::animate(); } void TWgui::choose_new_ships() { // check if there is only 1 nonzero fleet left // in that case, the game should end ... int i, k, m = 0; k = 0; for ( i = 0; i < num_players; ++i ) { Ship *s = player_control[i]->ship; if ( player_fleet[i]->getSize() != 0 || (s && s->exists()) ) { // (a fleet = unused ships; s is the ship used. ++k; m = i; } } if (k == 1) { message.print(1500, 15, "The game ends in victory for player %s", player_name[m]); this->quit("ending game"); } char tmp[40]; pause(); message.out("Selecting ships...", 1000); int *slot = new int[num_players]; //choose ships and send them across network for (i = 0; i < num_players; i += 1) { slot[i] = -2; if (player_control[i]->ship) { } else { bool oncerandom = false; if (!always_random[i]) { // if (player_panel[i]) player_panel[i]->window->hide(); // player_panel[i] = NULL; sprintf (tmp, "Player%d", i+1); Fleet *fleet = player_fleet[i]; if (fleet->getSize() == 0) continue; char buffy[512]; sprintf(buffy, "%s\n%s\n%d of ??? points", player_name[i], fleet->getTitle(), fleet->getCost()); // -------- CHOOSE A SHIP ----------- // (why is that stuffed in class "Control" ??) //slot[i] = player_control[i]->choose_ship2(window, buffy, fleet); BITMAP **ico = load_fleet_bmps(fleet, 100); // 100 = default width fleetsel->newscan(ico, 0.8, player_name[i]); fleetsel->setscreen(screen); fleetsel->center(); fleetsel->focus(); meleemenu->hide(); show_mouse(screen); unscare_mouse(); for (;;) { idle(); fleetsel->tree_calculate(); fleetsel->tree_animate(); if (fleetsel->returnvalueready) break; if (fleetsel->oncerandom->flag.left_mouse_press) { oncerandom = true; fleetsel->oncerandom->flag.left_mouse_press = false; break; } if (fleetsel->alwaysrandom->flag.left_mouse_press) { always_random[i] = true; break; } } fleetsel->hide(); remove_fleet_bmps(ico); // remove the bitmaps from memory } if (oncerandom || always_random[i]) slot[i] = -1; else slot[i] = fleetsel->getvalue(); if (player_control[i]->channel != channel_none) { slot[i] = intel_ordering(slot[i]); log->buffer(player_control[i]->channel, &slot[i], sizeof(int)); log->flush(); //slot[i] = intel_ordering(slot[i]); } } } //recieve the ships that were chosen log->listen(); for (i = 0; i < num_players; i += 1) { if (slot[i] == -2) continue; if (player_control[i]->channel != channel_none) { log->unbuffer(player_control[i]->channel, &slot[i], sizeof(int)); slot[i] = intel_ordering(slot[i]); } } //create the ships that were chosen for (i = 0; i < num_players; i += 1) { if (slot[i] == -2) continue; sprintf (tmp, "Player%d", i+1); //fleet->load("./fleets.tmp", tmp); Fleet *fleet = player_fleet[i]; if (slot[i] == -1) slot[i] = random() % fleet->getSize(); Ship *s = create_ship(fleet->getShipType(slot[i])->id, player_control[i], random(size), random(PI2), player_team[i]); fleet->clear_slot(slot[i]); fleet->Sort();//>sort(); //fleet->save("./fleets.tmp", tmp); s->locate(); add ( new WedgeIndicatorToggable ( s, 30, i+1, &option.wedge ) ); // don't add a ship panel ... that's done later on, if needed. add(s->get_ship_phaser()); // add a healthbar to the ship. add(new HealthBar(s, &option.healthbar)); } delete slot; message.out("Finished selecting ships...", 1500); unpause(); return; } /* //char cliptext[128]; void TWgui2::init(Log *_log) { NormalGame::init(_log); view->window->locate( // 1=in pixels, a fixed amount; 2=in screen width 0, 0, //double x1, double x2 0, 0, //double y1, double y2 0, 1, //double w1, double w2 0, 1 //double h1, double h2 ); // ------- add the menu items --------- unscare_mouse(); show_mouse(window->surface); // which font to use ... that depends on the screen resolution: int i = 2; if (screen->w == 640) i = 2; if (screen->w == 800) i = 3; if (screen->w == 1024) i = 4; // more pixels available for the same "real-life" size. FONT *usefont = videosystem.get_font(i); this->view->frame->prepare(); char menu_filename[512]; set_config_file("client.ini"); strcpy(menu_filename, get_config_string("Menu", "skin", "none")); meleemenu = new TWindow("interfaces/twgui2/melee", 50, 450, this->view->frame->surface); zoomin = new Button(meleemenu, "zoomin_", KEY_EQUALS, 1); zoomout = new Button(meleemenu, "zoomout_", KEY_MINUS, 1); abort = new Button(meleemenu, "abort_", mapkey(KEY_A, KEY_LCONTROL)); Test: this can show contents of the clipboard ... HWND w; w = win_get_window(); OpenClipboard(w); char *txt = (char*) ::GetClipboardData(CF_TEXT); strncpy(cliptext, txt, 128); CloseClipboard(); } void TWgui2::calculate() { NormalGame::calculate(); // ------------ INTERPRET RESULTS FROM THE MELEE WINDOW --------------- FULL_REDRAW = true; // only a full_redraw draws the whole frame-surface onto the physical screen. // (otherwise only the small sprites are drawn there ... I think) // I guess this can be a bit slow, but, I don't know why it's slow... perhaps simply // because it's a big screen, or is it because of conversion between color depths? // or something else? meleemenu->tree_calculate(); } void TWgui2::animate(Frame *frame) { NormalGame::animate(frame); show_mouse(window->surface); meleemenu->tree_setscreen(view->frame->surface); meleemenu->tree_animate(); //message.out(cliptext); } */ REGISTER_GAME(TWgui, "TWgui") --- NEW FILE: gametest2.h --- #ifndef __TWGUI_GAMETEST__ #define __TWGUI_GAMETEST__ #include "twgui.h" #include "../melee/mgame.h" #include "../melee/mmain.h" #include "../games/gflmelee.h" #include "twbutton.h" #include "twwindow.h" #include "twmenuexamples.h" class WindowManager; //class TWgui : public GameLayer class TWgui : public NormalGame { protected: double solarsystemsize, planetsystemsize; Vector2 refpos; bool always_random[16]; ShipPanelBmp *player_panel[16]; char texted[512]; public: // only temp. use !! // GameLayer *prev, *next; // double refscaletime; struct option_str { int healthbar, wedge, captain; } option; TWindow *meleemenu; PopupT *alertmenu; Button *zoomout, *zoomin, *abort, *callhelp, *snapshot, *extraplanet, *viewmode, *alert_yes, *alert_no; TextButton *alert_text; TextEditBox *text_edit; SwitchButton *screenswitch, *healthbarswitch, *wedgeindicatorswitch, *captainpanelswitch, *chatlogswitch; PopupList *popupviewmode; PopupTextInfo *popup2; PopupFleetSelection *fleetsel; virtual void calculate(); virtual bool handle_key(int k); virtual void animate(Frame *frame); virtual void animate_predict(Frame *frame, int time); virtual void animate(); virtual void init(Log *_log); virtual void choose_new_ships(); //void menu_add_keys(); void animate_stuff(Frame *frame); void handle_zoom_in(); }; #endif --- NEW FILE: twbutton.cpp --- #include <allegro.h> #include <stdio.h> #include <string.h> #include "../melee.h" //#include "../../melee/mview.h" REGISTER_FILE #include "twbutton.h" #include "twwindow.h" EmptyButton::EmptyButton(TWindow *menu, char *identbranch, int asciicode, bool akeepkey) { prev = 0; next = 0; selected = false; button_event = 0; menu->add(this); trigger_key = asciicode; //trigger_keepkey = akeepkey; trigger_keydetection = false; passive = false; // by default, I assume that a mouse-touch or a key-press can cause some action // let the area know to what collection it belongs mainwindow = menu; strcpy(ident, mainwindow->ident); // a data block strcat(ident, "/"); if (identbranch) strcat(ident, identbranch); // stuff within the data block //mouse.bmp.init(TWindow->bmp(strmouse)); // use the default menu-mouse, defined for area-reserve: // mouse.bmp.init(mainwindow->mouse.bmp.newmousebmp); // (you can override this with a similar call but using another bitmap later on, if required). size = 0; pos = 0; } EmptyButton::~EmptyButton() { /* NO !! should be handled by the main window. // nothing... if (prev) prev->next = next; if (next) next->prev = prev; */ } bool EmptyButton::hasmouse() { return (mainwindow->mpos.x >= pos.x && mainwindow->mpos.y >= pos.y && mainwindow->mpos.x < (pos+size).x && mainwindow->mpos.y < (pos+size).y); } bool EmptyButton::haskey() { return flag.haskey; } bool EmptyButton::haskeypress() { return flag.haskeypress; } // this should be checked only once per iteration; that's the assumption // made for the detection flag void EmptyButton::check_key() { // this is usually the case. flag.haskey = false; flag.haskeypress = false; // first check, if this button has focus, and the general enter-key is // pressed to activate it. if (flag.focus) { // if the button is hit //if ( keyhandler.pressed('\n') ) if ( keyhandler.keyhit[KEY_ENTER]) { flag.haskey = true; flag.haskeypress = true; return; } // if the button is kept pressed if ( keyhandler.keynew[KEY_ENTER]) { flag.haskey = true; return; } } // check if there's a key-trigger: it's a short-cut key, which overrides normal // mouse/tab navigation. /* bool foundkey = keyhandler.pressed(trigger_key); if ( foundkey ) */ // if the short-cut key-combo is pressed, then ... if (keyhandler.keyhit[unmapkey1(trigger_key)] && keyhandler.keynew[unmapkey2(trigger_key)]) { // either a key-hold, or a key-press: //if (trigger_keepkey || ( (!trigger_keepkey) && (!trigger_keydetection) )) flag.haskey = true; if (!trigger_keydetection) flag.haskeypress = true; trigger_keydetection = true; // the key is being held. } else trigger_keydetection = false; // the key isn't being touched. } void EmptyButton::handle_focus() { //mainwindow->setfocus(this); //focus = 1; flag.focus = true; // if (button_event) // button_event->handle_focus(); } void EmptyButton::handle_defocus() { flag.focus = false; // if (button_event) // button_event->handle_defocus(); } void EmptyButton::check_focus() { flag.lastfocus = flag.focus; if (haskey()) { if (!flag.focus) mainwindow->setfocus(this); } // if the mouse has moved, then check (new) mouse position to see if // the current button has gained or lost focus (so that if the mouse is not // moving, the keys can be used to check this). else if (Tmouse.vx() != 0 || Tmouse.vy() != 0) { if ( hasmouse() ) { if (!flag.focus) mainwindow->setfocus(this); } else { if (flag.focus) handle_defocus(); } } } // This routine is very important, since it can deliver an instant up-date // when the menu as a whole has suddenly lost focus (mouse can move away in // an undetected period of time, eg. an independent game loop), and the usual // calls to calculate aren't made... void EmptyButton::handle_menu_focus_loss() { selected = 0; //update_key(); flag.reset(); } void EmptyButton::calculate() { // copy information from the TWindow manager // update_mouse(); // update_key(); if (!passive) { check_key(); check_focus(); } subcalculate(); // users can put stuff in here, which is then calculated just // before the mouse handles, but just after the mouse/ key updates. // check if button 1 (left) releases -> clicks for this item flag.left_mouse_press = false; flag.left_mouse_release = false; flag.right_mouse_press = false; flag.left_mouse_hold = false; if (flag.focus) { if ( Tmouse.left.press() || haskeypress() ) { flag.left_mouse_press = true; handle_lpress(); if (button_event) button_event->handle_main_press(); } if (Tmouse.left.hold() || haskey()) { flag.left_mouse_hold = true; handle_lhold(); if (button_event) button_event->handle_main_hold(); } if (Tmouse.left.release() && flag.focus) { flag.left_mouse_release = true; handle_lrelease(); // if (button_event) // button_event->handle_lrelease(); } if (Tmouse.right.press()) { flag.right_mouse_press = true; handle_rpress(); if (button_event) button_event->handle_special_press(); } if (Tmouse.right.hold()) { flag.right_mouse_hold = true; handle_rpress(); if (button_event) button_event->handle_special_hold(); } // change the mouse pointer if needed, if it has the mouse: // mouse.bmp.set(); // note, "restore" is done by default by the area manager; this sets // it back to the custom mouse pointer, if needed. } } void EmptyButton::animate() { } EmptyButton::flag_struct::flag_struct() { // these flags are updated by the area's calculate function. // focus = 0; // left_mouse_press = left_mouse_release = left_mouse_hold = 0; // right_mouse_press = right_mouse_release = right_mouse_hold = 0; reset(); } void EmptyButton::flag_struct::reset() { // these flags are updated by the area's calculate function. focus = 0; left_mouse_press = left_mouse_release = left_mouse_hold = 0; right_mouse_press = right_mouse_release = right_mouse_hold = 0; haskey = haskeypress = 0; } bool EmptyButton::isvalid() { return true; } // that was the general part ; now a real rectangular area. // (similarly, you could define triangular and other types // of areas). GraphicButton::GraphicButton(TWindow *menu, char *identbranch, int asciicode, bool akeepkey) : EmptyButton(menu, identbranch, asciicode, akeepkey) { // mainwindow->scalepos(&x, &y); } void GraphicButton::locate(int ax, int ay) { pos.x = ax; pos.y = ay; mainwindow->scalepos(&pos); } GraphicButton::~GraphicButton() { } void GraphicButton::animate() { // check if button 1 (left) releases -> clicks for this item // unconditional drawing: if (flag.focus) { if (flag.left_mouse_hold) draw_selected(); else draw_focus(); } else draw_default(); } void GraphicButton::draw_default() { } void GraphicButton::draw_focus() { } void GraphicButton::draw_selected() { } // check if it's a visible pixel bool check_visibility(BITMAP *bmp, int x, int y) { if (!bmp) return false; if (x < 0 || x >= bmp->w || y < 0 || y >= bmp->h) return false; int col; col = getpixel(bmp, x, y); if (col != makecol(255,0,255)) return true; else return false; } // check a square area to see if it has the mouse on it. bool GraphicButton::hasmouse(BITMAP *bmpref) { // first, check the square bitmap area if (EmptyButton::hasmouse()) { // then, check the bmp if there's a pixel touched... return check_visibility(bmpref, mainwindow->mpos.x - pos.x, mainwindow->mpos.y - pos.y); } else return false; } void GraphicButton::draw_rect() { BITMAP *b = mainwindow->drawarea; int x1, y1, x2, y2; x1 = pos.x; y1 = pos.y; x2 = (pos+size).x - 1; y2 = (pos+size).y - 1; // draw something simple: int D = 4; // width of the rectangle D *= iround(mainwindow->scale - 1); if (D < 0) D = 0; while (D >= 0) { if (x2-x1 > 2*D && y2-y1 > 2*D) rect(b, x1+D, y1+D, x2-D, y2-D, makecol(200,200,200)); --D; } } int rect_fancy_getcolor2(double phase, double L, double Ltot) { unsigned char r, g, b; r = (unsigned char)(128 + 127 * sin(phase + PI2 * L/Ltot)); g = (unsigned char)(128 + 127 * sin(phase + 0.3*PI + PI2 * L/Ltot)); b = (unsigned char)(128 + 127 * sin(phase + 0.7*PI + PI2 * L/Ltot)); return makecol(r, g, b); } void GraphicButton::draw_rect_fancy() { BITMAP *b = mainwindow->drawarea; int x1, y1, x2, y2; x1 = pos.x; y1 = pos.y; x2 = (pos+size).x - 1; y2 = (pos+size).y - 1; int D = 2; // width of the rectangle D = iround(D * mainwindow->scale) - 1; // cause 0 also counts as 1... if (D < 0) D = 0; int ix, iy; double phase = mainwindow->menu_time * 1E-3 * PI; //offset angle int L; while (D >= 0) { double Ltotal = (size.x-2*D) * (size.y-2*D); if (Ltotal <= 0) break; L = 0; iy = y1 + D; ix = x1 + D - 1; while(ix < x2-D ) { ++ix; putpixel(b, ix, iy, rect_fancy_getcolor2(phase, L, Ltotal)); ++L; } while(iy < y2-D ) { ++iy; putpixel(b, ix, iy, rect_fancy_getcolor2(phase, L, Ltotal)); ++L; } while(ix > x1+D ) { --ix; putpixel(b, ix, iy, rect_fancy_getcolor2(phase, L, Ltotal)); ++L; } while(iy > y1+D+1 ) { --iy; putpixel(b, ix, iy, rect_fancy_getcolor2(phase, L, Ltotal)); ++L; } --D; } } void GraphicButton::draw_boundaries(BITMAP *bmpref) { BITMAP *b = mainwindow->drawarea; int i, j; int W = 2; W = iround(W * mainwindow->scale) - 1; int L = 0; int Ltotal = 5 * sqrt( bmpref->w * bmpref->h ); double phase = mainwindow->menu_time * 1E-3 * PI; //offset angle for ( j = -W; j < bmpref->h + W; ++j ) { for ( i = -W; i < bmpref->w + W; ++i ) { if (!check_visibility(bmpref, i, j)) { int wx, wy; for ( wy = -W; wy <= W; ++wy ) { for ( wx = -W; wx <= W; ++wx ) { if (check_visibility(bmpref, i+wx, j+wy)) { putpixel(b, i+pos.x, j+pos.y, //makecol(255,255,255)); rect_fancy_getcolor2(phase, L, Ltotal)); } } } ++L; } } } } /* NEED TO REWRITE THIS (should be completely handled by the main window. */ void GraphicButton::locate_by_backgr(char *strid) { char stron[128]; strcpy(stron, ident); strcat(stron, strid); BITMAP *tmp; bool k; char check_char[128]; strcpy(check_char, stron); strcat(check_char, ".bmp"); //tmp = (BITMAP*) find_datafile_object(TWindow->datafile, check_char)->dat; tmp = load_bitmap(check_char, 0); if (!tmp) { tw_error("Could not find the comparison bmp in the datafile"); } // first, load the last known position from the ini file // set the config file, to guarantee that the correct ini file is used ... set_config_file(mainwindow->configfilename); char strx[256], stry[256]; strcpy(strx, stron); strcat(strx, "_x"); strcpy(stry, stron); strcat(stry, "_y"); pos.x = get_config_int(0, strx, 0); pos.y = get_config_int(0, stry, 0); Vector2 oldpos = pos; k = mainwindow->search_bmp_location(tmp, &pos); // if the position has changed, then set the new position... if (pos != oldpos) { set_config_int(0, strx, pos.x); set_config_int(0, stry, pos.y); } mainwindow->scalepos(&pos); // is normally called by the other init(); if (!k) { tw_error("Could not find the bmp on the background image"); } } // obtain a bitmap, specific to this "object" : BITMAP *GraphicButton::getbmp(char *name) { char streditbox[128]; strcpy(streditbox, ident); strcat(streditbox, name); // a background image is needed of course. return mainwindow->bmp(streditbox); } void GraphicButton::init_pos_size(BITMAP **bmp_default, char *idstr) { *bmp_default = getbmp(idstr); if (*bmp_default) { size.x = (*bmp_default)->w; // note: it's already scaled on initialization. size.y = (*bmp_default)->h; } else { //tw_error("Could not initialize Button bitmap"); size = 0; } if ( *bmp_default ) locate_by_backgr(idstr); // else // { // tw_error("No default Button defined!"); // } } bool GraphicButton::draw(BITMAP *b) { if (b) { masked_blit(b, mainwindow->drawarea, 0, 0, pos.x, pos.y, b->w, b->h); return true; } else return false; } --- NEW FILE: twbutton.h --- #ifndef __TWBUTTON__ #define __TWBUTTON__ #include "utils.h" class ButtonEvent { public: //virtual void handle_char(int c) {}; //virtual void handle_uchar(int c) {}; virtual void handle_main_press() {}; virtual void handle_special_press() {}; virtual void handle_main_hold() {}; virtual void handle_special_hold() {}; }; class TWindow; class EmptyButton { public: EmptyButton *prev, *next; Vector2 pos, size; // these are used to define the box area (top left corner and dimensions) ButtonEvent *button_event; void bind(ButtonEvent *be) {button_event = be;}; // ---------- MOUSE IO ----------- // normalmouse mouse; // void update_mouse(); virtual bool hasmouse(); virtual void handle_click() {}; virtual void handle_doubleclick() {}; virtual void handle_gotmouse() {}; virtual void handle_lostmouse() {}; virtual void handle_wheel(int c) {}; virtual void handle_lpress() {}; virtual void handle_mpress() {}; virtual void handle_rpress() {}; virtual void handle_lrelease() {}; virtual void handle_mrelease() {}; virtual void handle_rrelease() {}; virtual void handle_lhold() {}; virtual void handle_mhold() {}; virtual void handle_rhold() {}; // --------- keyboard IO ----------- int trigger_key; // ascii (+control flags) key-code shortcut to select this area //bool trigger_keepkey; // determines if a key-press, or a key-hold is used bool trigger_keydetection; // stores whether the key's been held or not bool passive; // can it be selected, or not ... virtual void check_key(); virtual void handle_char(int c) {}; virtual void handle_uchar(int c) {}; virtual bool haskey(); virtual bool haskeypress(); struct flag_struct { // these flags are updated by the area's calculate function. bool haskey, haskeypress; bool focus, lastfocus; bool left_mouse_press, left_mouse_release, left_mouse_hold; bool right_mouse_press, right_mouse_release, right_mouse_hold; void reset(); flag_struct(); } flag; // this should point to some master control structure // in order to synch different parts. TWindow *mainwindow; char ident[128]; // a general-purpose flag; is set if left mouse is held; this can // be useful in simple applications. // it's supposed that several items can be selected at once. // this class shows whether the item is part of a selection or // not. bool selected; // whether this button is available for IO or not. int state; // old: "disabled" virtual void calculate(); virtual void animate(); // should be changed; users can put stuff here that should come after the mouse/ key // update, but before the mouse handles (i.e., to pre-process input if needed). virtual void subcalculate() {}; // empty by default EmptyButton(TWindow *menu, char *identbranch = 0, int asciicode = 0, bool akeepkey = 0); virtual ~EmptyButton(); //virtual void init(TWindow *menu, char *identbranch); //int lastfocus, focus; void check_focus(); virtual void handle_menu_focus_loss(); virtual void handle_focus(); virtual void handle_defocus(); virtual bool isvalid(); }; class GraphicButton : public EmptyButton { public: virtual bool hasmouse(BITMAP *bmpref); void draw_rect(); void draw_rect_fancy(); void draw_boundaries(BITMAP *bmpref); // auto-locate button GraphicButton(TWindow *menu, char *identbranch, int asciicode, bool akeepkey = 0); // to override the auto-locate... virtual void locate(int ax, int ay); // virtual void init(TWindow *menu, char *identbranch, int ax, int ay); virtual ~GraphicButton(); void init_pos_size(BITMAP **bmp_default, char *idstr); void locate_by_backgr(char *stron); // should be a function of the main window, really ... BITMAP *getbmp(char *name); virtual void animate(); virtual void draw_default(); virtual void draw_focus(); virtual void draw_selected(); // masked_blits the specified bitmap using the button coordinates. bool draw(BITMAP *b); }; #endif --- NEW FILE: twbuttontypes.cpp --- #include <allegro.h> #include <stdio.h> #include <string.h> #include "../melee.h" #include "../melee/mview.h" REGISTER_FILE #include "twwindow.h" #include "twbuttontypes.h" // to implement a Button, you add bitmaps-feedback to the box-area control // name#default.bmp // name#focus.bmp // name#selected.bmp Button::Button(TWindow *menu, char *identbranch, int asciicode, bool akeepkey) : GraphicButton(menu, identbranch, asciicode, akeepkey) { init_pos_size(&bmp_default, "default"); bmp_focus = getbmp("focus"); bmp_selected = getbmp("selected"); } Button::~Button() { if (bmp_default) destroy_bitmap(bmp_default); if (bmp_focus) destroy_bitmap(bmp_focus); if (bmp_selected) destroy_bitmap(bmp_selected); } // this is the default drawing (at rest): void Button::draw_default() { draw(bmp_default); } void Button::draw_focus() { if (!draw(bmp_focus)) { draw_default(); draw_boundaries(bmp_default); } } void Button::draw_selected() { if (!draw(bmp_selected)) draw_default(); } bool Button::hasmouse() { return GraphicButton::hasmouse(bmp_default); } bool Button::isvalid() { return bmp_default != 0; }; // an additional class, which has its own background and drawing area, which // can be used to create custom representations of information (eg., text or smaller // bitmaps)) // name#backgr.bmp AreaTablet::AreaTablet(TWindow *menu, char *identbranch, int asciicode, bool akeepkey) : GraphicButton(menu, identbranch, asciicode, akeepkey) { init_pos_size(&backgr, "backgr"); if (size.x != 0) drawarea = create_bitmap_ex(bitmap_color_depth(mainwindow->drawarea), size.x, size.y); else drawarea = 0; } AreaTablet::~AreaTablet() { if (backgr) destroy_bitmap(backgr); if (drawarea) destroy_bitmap(drawarea); } void AreaTablet::changebackgr(char *fname) { BITMAP *newb; newb = getbmp(fname); if (newb) { destroy_bitmap(backgr); backgr = newb; } } void AreaTablet::animate() { blit(backgr, drawarea, 0, 0, 0, 0, size.x, size.y); subanimate(); draw(drawarea); } void AreaTablet::subanimate() { // nothing; you can put extra drawing commands here, stuff that's drawn onto // the background before being blitted onto the reserved area. } bool AreaTablet::hasmouse() { // the first rough check whether it's in the boxed bitmap area return GraphicButton::hasmouse(backgr); } bool AreaTablet::isvalid() { return backgr != 0; }; // A button which can be in 2 states (on/off) // name#on.bmp // name#off.bmp SwitchButton::SwitchButton(TWindow *menu, char *identbranch, int asciicode, bool initialstate) : GraphicButton(menu, identbranch, asciicode) { init_pos_size(&bmp_on, "on"); bmp_off = getbmp("off"); state = initialstate; } SwitchButton::~SwitchButton() { if (bmp_on) destroy_bitmap(bmp_on); if (bmp_off) destroy_bitmap(bmp_off); } void SwitchButton::draw_default() { if (state) draw(bmp_on); else draw(bmp_off); } void SwitchButton::draw_focus() { draw_default(); draw_rect_fancy(); } // is the same as focus, cause a switch cannot be selected all the time !! void SwitchButton::draw_selected() { draw_focus(); } void SwitchButton::calculate() { GraphicButton::calculate(); // determine if the state of the button is being changed by (some) interaction: if (flag.left_mouse_press) state = !state; // switch state. } bool SwitchButton::hasmouse() { // the first rough check whether it's in the boxed bitmap area return GraphicButton::hasmouse(bmp_on); } bool SwitchButton::isvalid() { return bmp_on != 0; }; GhostButton::GhostButton(TWindow *menu) : EmptyButton(menu) { passive = true; } GhostButton::~GhostButton() { } ScrollBar::ScrollBar(TWindow *menu, char *identbranch) : AreaTablet(menu, identbranch, 255) { relpos = 0.0; // between 0 and 1 button = getbmp("button"); if (button) { bwhalf = button->w/2; bhhalf = button->h/2; } else { bwhalf = 0; bhhalf = 0; } if (size.y >= size.x) direction = ver; // vertically oriented else direction = hor; // horizontally oriented if (direction == ver) { pmin = bhhalf; pmax = size.y - bhhalf; } else { pmin = bwhalf; pmax = size.x - bwhalf; } pbutton = pmin; } ScrollBar::~ScrollBar() { if (button) destroy_bitmap(button); } void ScrollBar::handle_lhold() { if (direction == ver) pbutton = mainwindow->mpos.y - pos.y; // mouse pos relative in the little bar area else pbutton = mainwindow->mpos.x - pos.x; if (pbutton < pmin) pbutton = pmin; if (pbutton > pmax) pbutton = pmax; relpos = double(pbutton - pmin) / double(pmax - pmin); } void ScrollBar::subanimate() { AreaTablet::subanimate(); if (direction == ver) masked_blit(button, drawarea, 0, 0, size.x/2 - bwhalf, pbutton-bhhalf, button->w, button->h); else masked_blit(button, drawarea, 0, 0, pbutton-bwhalf, size.y/2 - bhhalf, button->w, button->h); } void ScrollBar::setrelpos(double arelpos) { if (relpos == arelpos) return; relpos = arelpos; // also update the button position to reflect this change pbutton = pmin + iround(relpos * (pmax - pmin)); } void ScrollBar::calculate() { AreaTablet::calculate(); } --- NEW FILE: twbuttontypes.h --- #ifndef __TW_BUTTONTYPES__ #define __TW_BUTTONTYPES__ #include "twbutton.h" // to implement a button, you add bitmaps-feedback to the box-area control class Button : public GraphicButton { protected: BITMAP *bmp_default, *bmp_focus, *bmp_selected; public: Button(TWindow *menu, char *identbranch, int asciicode = 0, bool keepkey = 0); virtual ~Button(); virtual void draw_default(); virtual void draw_focus(); virtual void draw_selected(); virtual bool hasmouse(); virtual bool isvalid(); }; // something which has a background, and its own drawing-area class AreaTablet : public GraphicButton { protected: BITMAP *backgr, *drawarea; public: AreaTablet(TWindow *menu, char *identbranch, int asciicode, bool akeepkey = 0); virtual ~AreaTablet(); void changebackgr(char *fname); virtual void animate(); // shouldn't be changed. virtual void subanimate(); virtual bool hasmouse(); virtual bool isvalid(); }; // a switch, is a button that is always in 2 of states (on or off) : // (a "focus" is always indicated by some box around it). class SwitchButton : public GraphicButton { protected: BITMAP *bmp_on, *bmp_off; public: bool state; // true=on, false=off // x, y, W, H are inside the draw area SwitchButton(TWindow *menu, char *identbranch, int asciicode = 0, bool initialstate = false); virtual ~SwitchButton(); virtual void calculate(); virtual void draw_default(); virtual void draw_focus(); virtual void draw_selected(); // is the same as focus, cause a switch cannot be selected all the time !! virtual bool hasmouse(); //void locate_by_backgr(char *stron); virtual bool isvalid(); }; class GhostButton : public EmptyButton { public: GhostButton(TWindow *menu); virtual ~GhostButton(); }; class ScrollBar : public AreaTablet { protected: BITMAP *button; public: enum {hor = 1, ver= 2} direction ; double relpos; int pmin, pmax, bwhalf, bhhalf; // p = position (can be x or y) int pbutton; // x, y, W, H are inside the draw area ScrollBar(TWindow *menu, char *identbranch); virtual ~ScrollBar(); virtual void handle_lhold(); virtual void subanimate(); void setrelpos(double arelpos); virtual void calculate(); }; #endif --- NEW FILE: twhelpers.cpp --- #include <allegro.h> #include <stdio.h> #include <string.h> #include "../melee.h" //#include "../../melee/mview.h" REGISTER_FILE #include "twbutton.h" #include "twwindow.h" #include "twhelpers.h" ScrollControl::ScrollControl() { x = 0; y = 0; left = 0; right = 0; up = 0; down = 0; scrollhor = 0; scrollvert = 0; } void ScrollControl::set(int xscroll, int yscroll, int Nxscroll, int Nyscroll, int Nx_show, int Ny_show) { x = xscroll; // this is top-left corner item of the visible screen y = yscroll; xselect = x; // this has some extra movement capacility within the visible screen yselect = y; Nxshow = Nx_show; // the size (in items) of the visible screen Nyshow = Ny_show; Nx = Nxscroll - Nxshow + 1; // the scrollable freedom Ny = Nyscroll - Nyshow + 1; // note: Nx = 1 indicates the "base" position; values >1 indicate out-of-sight positions. // or: Nx-Nxshow indicates the out-of-sight positions, +1 indicates the base value position. // check ranges. if (Nx < 1) Nx = 1; if (Ny < 1) Ny = 1; check_pos(); } void ScrollControl::check_pos() { // check the scroll position if (x > Nx-1) x = Nx-1; if (y > Ny-1) y = Ny-1; if (x < 0) x = 0; if (y < 0) y = 0; // check the select position // note, the selected item _must_ always lie within the visible area: if (xselect < x) xselect = x; if (xselect > x + Nxshow - 1) xselect = x + Nxshow - 1; if (yselect < y) yselect = y; if (yselect > y + Nyshow - 1) yselect = y + Nyshow - 1; } void ScrollControl::add(int dx, int dy) { x += dx; y += dy; check_pos(); } void ScrollControl::check_sel() { if (xselect < x) x = xselect; if (xselect > x + Nxshow - 1) x = xselect-Nxshow+1; if (yselect < y) y = yselect; if (yselect > y + Nyshow - 1) y = yselect-Nyshow+1; } void ScrollControl::set_sel(int xsel, int ysel) { xselect = xsel; yselect = ysel; check_sel(); check_pos(); } // alpha is a value between 0 and 1 void ScrollControl::set_percent_pos_x(double alpha) { x = iround( (Nx-1) * alpha ); check_pos(); } void ScrollControl::set_percent_pos_y(double alpha) { y = iround( (Ny-1) * alpha ); check_pos(); } void ScrollControl::set_pos(int xnew, int ynew) { if ( xnew >= 0 && xnew < Nx && ynew >= 0 && ynew < Ny ) { x = xnew; y = ynew; if (scrollhor) scrollhor->setrelpos(double(x)/Nx); if (scrollvert) scrollvert->setrelpos(double(y)/Ny); } check_pos(); } void ScrollControl::calculate() { int xold, yold; xold = x; yold = y; if (left && left->flag.left_mouse_press) { --xselect; if (xselect < x) x = xselect; } if (right && right->flag.left_mouse_press) { ++xselect; if (xselect > x + Nxshow - 1) x = xselect-Nxshow+1; } if (up && up->flag.left_mouse_press) { --yselect; if (yselect < y) y = yselect; } if (down && down->flag.left_mouse_press) { ++yselect; if (yselect > y + Nyshow - 1) y = yselect-Nyshow+1; } check_pos(); if (scrollhor && xold != x) scrollhor->setrelpos(double(x)/Nx); if (scrollvert && yold != y) scrollvert->setrelpos(double(y)/Ny); if (scrollhor && scrollhor->flag.left_mouse_hold) set_percent_pos_x(scrollhor->relpos); if (scrollvert && scrollvert->flag.left_mouse_hold) set_percent_pos_y(scrollvert->relpos); } void ScrollControl::bind(EmptyButton *aleft, EmptyButton *aright, EmptyButton *aup, EmptyButton *adown, ScrollBar *ascrollhor, ScrollBar *ascrollvert) { left = aleft; right = aright; up = aup; down = adown; scrollvert = ascrollvert; scrollhor = ascrollhor; } // This loads the required buttons. void ScrollControl::setup_hor(TWindow *A, char *id, ScrollControl *scr) { // create the buttons and bitmaps, finding graphics in some data file, // with strict name conventions having as base the general identifier "ident". // // note that the buttons required, and their layout, are determined by the // graphics in the datafile. char id2[128]; strcpy(id2, id); strcat(id2, "left_"); left = new Button(A, id2); if (!left->isvalid()) { A->rem(left); delete left; left = 0; } strcpy(id2, id); strcat(id2, "right_"); right = new Button(A, id2); if (!right->isvalid()) { A->rem(right); delete right; right = 0; } // add a scroll bar strcpy(id2, id); strcat(id2, "barhor_"); scrollhor = new ScrollBar(A, id2); if (!scrollhor->isvalid()) { A->rem(scrollhor); delete scrollhor; scrollhor = 0; } scr->left = left; scr->right = right; scr->scrollhor = scrollhor; } void ScrollControl::setup_ver(TWindow *A, char *id, ScrollControl *scr) { char id2[128]; strcpy(id2, id); strcat(id2, "up_"); up = new Button(A, id2); if (!up->isvalid()) { A->rem(up); delete up; up = 0; } strcpy(id2, id); strcat(id2, "down_"); down = new Button(A, id2); if (!down->isvalid()) { A->rem(down); delete down; down = 0; } strcpy(id2, id); strcat(id2, "barver_"); scrollvert = new ScrollBar(A, id2); if (!scrollvert->isvalid()) { A->rem(scrollvert); delete scrollvert; scrollvert = 0; } scr->up = up; scr->down = down; scr->scrollvert = scrollvert; } void ScrollControl::setup_hor(EmptyButton *A, char *id, ScrollControl *scr) { setup_hor(A->mainwindow, id, scr); } void ScrollControl::setup_ver(EmptyButton *A, char *id, ScrollControl *scr) { setup_ver(A->mainwindow, id, scr); } void ScrollControl::setup(TWindow *A, char *id, ScrollControl *scr) { setup_hor(A, id, scr); setup_ver(A, id, scr); } TextInfo::TextInfo(FONT *afont, BITMAP *abmp, char *atextinfo, int aNchars) { bmp = abmp; usefont = afont; textinfo = atextinfo; Nchars = aNchars; Htxt = text_height(usefont); text_color = makecol(0,0,0); Nshow = int(bmp->h / Htxt) - 1; // -1, because item 0 is also shown... } TextInfo::~TextInfo() { } void TextInfo::reset(ScrollControl *scroll) { // "initialize" the text: int n, len; n = 0; len = 0; Nlines = 0; linestart[0] = 0; if (textinfo[0] == 0) // empty text { Nlines = 1; // even empty text has 1 line to hold the cursor. linestart[1] = 0; scroll->y = 0; scroll->yselect = 0; scroll->set(0, scroll->y, 1, Nlines, 1, Nshow); return; } ++Nlines; ++n; // check (again) how long the text is... Nchars = strlen(textinfo); while ( n < Nchars ) { if (textinfo[n] == 0 || textinfo[n] == '\n') { linestart[Nlines] = n+1; ++Nlines; len = 0; if (textinfo[n] == 0) break; // value 0 indicates the end of the text. } else { char txt[2]; txt[0] = textinfo[n]; txt[1] = 0; len += text_length(usefont, txt); // if the line exceeds the window width, then you've to look // back for the last space if (len >= bmp->w-1) { while (n > 0 && textinfo[n] != ' ' && textinfo[n] != '.' && textinfo[n] != ',' && textinfo[n] != '!' && textinfo[n] != '?' && textinfo[n] != ';' && textinfo[n] != ':' && textinfo[n] != '-' && textinfo[n] != '/' && textinfo[n] != '\n' && textinfo[n] != 0 ) --n; linestart[Nlines] = n+1; ++Nlines; len = 0; } } if (Nlines >= maxlines) break; ++n; } // check if the scroll position is valid. if (scroll->y > Nlines-1) scroll->y = Nlines-1; if (scroll->yselect > Nlines-1) scroll->yselect = Nlines-1; // is maybe better off in a separate routine but well ... // if ( Nlines > Nshow ) scroll->set(0, scroll->y, 1, Nlines, 1, Nshow); // else // scroll->set(0, scroll->y, 1, 1, 1, 1); } // go from line-coordinate to bitmap coordinate void TextInfo::getxy(int charpos, int *x, int *y) { int iline; iline = 0; while (iline+1 < Nlines && linestart[iline+1] <= charpos) ++iline; *y = iline * Htxt; // on this line, find the x-position... int n, len; n = linestart[iline]; len = 0; while (n < charpos) { char txt[2]; txt[0] = textinfo[n]; txt[1] = 0; len += text_length(usefont, txt); ++n; } *x = len; } // map coordinate to character number int TextInfo::getcharpos(int x, int y) { int iline; iline = y / Htxt; if (iline > Nlines-1) iline = Nlines-1; if (iline < 0) { tw_error("getcharpos : Nlines < 0 should not happen"); } // the last line should be handled with care ... (you don't know it's length, only that it stops) if (iline == Nlines-1) { int n; n = linestart[iline] + x; if (n > (int)strlen(textinfo)) n = strlen(textinfo); return n; } // on this line, find the char-position left-closest to the x value int n, len; len = 0; for ( n = linestart[iline]; n < linestart[iline+1]-1; ++n ) { char txt[2]; txt[0] = textinfo[n]; txt[1] = 0; len += text_length(usefont, txt); if (len > x) return n; } return n; } void TextInfo::changeline(int *charpos, int line1, int line2) { if (line2 > Nlines-1) line2 = Nlines-1; if (line1 > Nlines-1) line1 = Nlines-1; int d; d = *charpos - linestart[line1]; *charpos = linestart[line2] + d; if (*charpos > (int)strlen(textinfo)) *charpos = strlen(textinfo); else if (line2+1 < Nlines) if (*charpos >= linestart[line2+1]) *charpos = linestart[line2+1] - 1; } --- NEW FILE: twhelpers.h --- #ifndef __TWHELPERS__ #define __TWHELPERS__ #include "twbuttontypes.h" // discrete position (x,y = item number, not pixels) //class ScrollBar; //class EmptyButton; class ScrollControl { public: EmptyButton *left, *right, *up, *down; ScrollBar *scrollhor, *scrollvert; ScrollControl(); int x, y; // which Icon is visible top left. int Nx, Ny; // number of Icons that are present. int xselect, yselect; int Nxshow, Nyshow; void set(int xscroll, int yscroll, int Nxscroll, int Nyscroll, int Nx_show, int Ny_show); void set_pos(int xnew, int ynew); void set_percent_pos_x(double alpha); void set_percent_pos_y(double alpha); void add(int dx, int dy); void check_pos(); void calculate(); void set_sel(int xsel, int ysel); void check_sel(); void bind(EmptyButton *left, EmptyButton *right, EmptyButton *up, EmptyButton *down, ScrollBar *scrollhor, ScrollBar *scrollvert); void setup_hor(TWindow *A, char *id, ScrollControl *scr); void setup_ver(TWindow *A, char *id, ScrollControl *scr); void setup_hor(EmptyButton *A, char *id, ScrollControl *scr); void setup_ver(EmptyButton *A, char *id, ScrollControl *scr); // set up both the horizontal and vertical bar (provided the graphics exist) void setup(TWindow *A, char *id, ScrollControl *scr); }; // a class you can use to edit text const int maxlines = 1024; class TextInfo { public: char *textinfo; int linestart[maxlines]; int Nlines, Nchars; FONT *usefont; int W, Htxt, Nshow; int text_color; BITMAP *bmp; TextInfo(FONT *afont, BITMAP *abmp, char *atextinfo, int Nchars); ~TextInfo(); //void set_textinfo(char *atextinfo, int Nchars); void getxy(int charpos, int *x, int *y); int getcharpos(int x, int y); void changeline(int *charpos, int line1, int line2); void reset(ScrollControl *scroll); }; #endif --- NEW FILE: twmenuexamples.cpp --- #include <allegro.h> #include <stdio.h> #include <string.h> #include "../melee.h" //#include "../../melee/mview.h" REGISTER_FILE #include "twbutton.h" #include "twwindow.h" #include "twmenuexamples.h" // make use of this textinfo box, in some "controlled" menu space: PopupTextInfo::PopupTextInfo(EmptyButton *creator, char *ident, char *id2, int axshift, int ayshift, FONT *afont, char *atext, int aNchar) : PopupT(creator, ident, axshift, ayshift) { // add a text list box tia = new TextInfoArea(this, id2, afont, atext, aNchar);//, &scroll); //tia->set_textinfo(atext, aNchar); char s[128]; strcpy(s, id2); strcat(s, "close_"); closebutton = new Button(this, s); exclusive = true; } PopupTextInfo::~PopupTextInfo() { if (tia) delete tia; } void PopupTextInfo::check_end() { if (closebutton->flag.left_mouse_press) close(-1); } PopupTextInfo_toggle::PopupTextInfo_toggle(EmptyButton *creator, char *ident, char *id2, int axshift, int ayshift, FONT *afont, char *atext, int aNchar) : PopupTextInfo(creator, ident, id2, axshift, ayshift, afont, atext, aNchar) { }; void PopupTextInfo_toggle::calculate() { PopupTextInfo::calculate(); } //void PopupTextInfo_toggle::check_end() //{ //}; // This popup is invoked by a push-button somewhere. I'm not going to create some // special push button type for that, I can just as well let this (new) class // access the state of that general button type. // (well, the following one isn't using a button, the one below is...) PopupList::PopupLi... [truncated message content] |
From: <geo...@us...> - 2003-12-12 15:57:33
|
Update of /cvsroot/timewarp/source/games In directory sc8-pr-cvs1:/tmp/cvs-serv13874 Modified Files: gflmelee.cpp gmissions.cpp vgGenSys.cpp Log Message: twgui update Index: gflmelee.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gflmelee.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** gflmelee.cpp 23 Nov 2003 10:01:54 -0000 1.12 --- gflmelee.cpp 12 Dec 2003 15:57:15 -0000 1.13 *************** *** 1976,1987 **** ! AreaReserve *A; // this uses a log_file as well ... to determine the ref screen size. ! A = new AreaReserve("interfaces/gflmelee", 0, 0, screen); // other stuff resets the log file, so make sure you got the correct one. set_config_file("gflmelee.ini"); // don't use log_file, cause that's in memory, while we'd like to save settings on disk. --- 1976,1989 ---- ! // AreaReserve *A; ! TWindow *A; // this uses a log_file as well ... to determine the ref screen size. ! A = new TWindow("interfaces/gflmelee", 0, 0, screen); // other stuff resets the log file, so make sure you got the correct one. set_config_file("gflmelee.ini"); + //log_file("gflmelee.ini"); // don't use log_file, cause that's in memory, while we'd like to save settings on disk. *************** *** 2013,2035 **** col[1] = makecol(200,200,200); ! up[0] = new Button(A, "up1/", -1, -1, 0); ! down[0] = new Button(A, "down1/", -1, -1, 0); ! up[1] = new Button(A, "up2/", -1, -1, 0); ! down[1] = new Button(A, "down2/", -1, -1, 0); ! ok = new Button(A, "ok/", -1, -1, 0); ! fl[0] = new TextButton(A, "text1/", -1, -1, usefont); fl[0]->set_text("", col[0]); ! fl[1] = new TextButton(A, "text2/", -1, -1, usefont); fl[1]->set_text("", col[1]); // the window manager. ! WindowManager *winman; ! winman = new WindowManager; ! winman->add(A); //int select[2]; --- 2015,2037 ---- col[1] = makecol(200,200,200); ! up[0] = new Button(A, "up1_"); ! down[0] = new Button(A, "down1_"); ! up[1] = new Button(A, "up2_"); ! down[1] = new Button(A, "down2_"); ! ok = new Button(A, "ok_"); ! fl[0] = new TextButton(A, "text1_", usefont); fl[0]->set_text("", col[0]); ! fl[1] = new TextButton(A, "text2_", usefont); fl[1]->set_text("", col[1]); // the window manager. ! // WindowManager *winman; ! // winman = new WindowManager; ! // winman->add(A); //int select[2]; *************** *** 2045,2054 **** } ! winman->setscreen(screen); ! for (;;) { ! idle(20); ! winman->calculate(); ! winman->animate(); int k; --- 2047,2058 ---- } ! A->tree_doneinit(); ! A->tree_setscreen(screen); ! ! while ( !ok->flag.left_mouse_press ) { ! idle(5); ! A->tree_calculate(); ! A->tree_animate(); int k; *************** *** 2072,2077 **** } - if (ok->flag.left_mouse_press) - break; } --- 2076,2079 ---- Index: gmissions.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/gmissions.cpp,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** gmissions.cpp 23 Nov 2003 16:21:05 -0000 1.15 --- gmissions.cpp 12 Dec 2003 15:57:19 -0000 1.16 *************** *** 22,25 **** --- 22,26 ---- #include "../twgui/twgui.h" + #include "../twgui/twmenuexamples.h" #include "gflmelee.h" *************** *** 205,210 **** public: PopupTextInfo_toggle *popupinfo; ! AreaReserve *missionselectmenu; ! WindowManager *winman; Button *b_accept, *b_quit, *b_left, *b_right; TextButton *b_title, *b_info; --- 206,211 ---- public: PopupTextInfo_toggle *popupinfo; ! TWindow *missionselectmenu; ! //WindowManager *winman; Button *b_accept, *b_quit, *b_left, *b_right; TextButton *b_title, *b_info; *************** *** 778,798 **** // missionselectmenu = new AreaReserve("SELECTMISSION", 50, 400, "gmissiongui.dat", this->view->frame->surface); ! missionselectmenu = new AreaReserve("interfaces/selectmission/briefing", 50, 400, this->view->frame->surface); ! b_info = new TextButton(missionselectmenu, "info/", -1, -1, usefont); ! b_accept = new Button(missionselectmenu, "accept/", -1, -1, KEY_ENTER); ! b_quit = new Button(missionselectmenu, "quit/", -1, -1, KEY_ESC); ! b_title = new TextButton(missionselectmenu, "title/", -1, -1, usefont); ! b_left = new Button(missionselectmenu, "left/", -1, -1, KEY_LEFT); ! b_right = new Button(missionselectmenu, "right/", -1, -1, KEY_RIGHT); b_ghost = new GhostButton(missionselectmenu); ! popupinfo = new PopupTextInfo_toggle(b_ghost, "interfaces/selectmission/popupinfo", -50, -200, usefont, "", 0); popupinfo->option.disable_othermenu = false; ! popupinfo->option.place_relative2mouse = false; // hmm, a bit late, after it's already been placed... oh well, never mind ... popupinfo->show(); // by default it's inactive, but I'd prefer it's active right away. // delete infotext; --- 779,799 ---- // missionselectmenu = new AreaReserve("SELECTMISSION", 50, 400, "gmissiongui.dat", this->view->frame->surface); ! missionselectmenu = new TWindow("interfaces/selectmission/briefing", 50, 400, this->view->frame->surface); ! b_info = new TextButton(missionselectmenu, "info_", usefont); ! b_accept = new Button(missionselectmenu, "accept_", KEY_ENTER); ! b_quit = new Button(missionselectmenu, "quit_", KEY_ESC); ! b_title = new TextButton(missionselectmenu, "title_", usefont); ! b_left = new Button(missionselectmenu, "left_", KEY_LEFT); ! b_right = new Button(missionselectmenu, "right_", KEY_RIGHT); b_ghost = new GhostButton(missionselectmenu); ! popupinfo = new PopupTextInfo_toggle(b_ghost, "interfaces/selectmission/popupinfo", "text/", 200, 200, usefont, "", 0); popupinfo->option.disable_othermenu = false; ! popupinfo->option.place_relative2mouse = false; // doesn't matter in this case. popupinfo->show(); // by default it's inactive, but I'd prefer it's active right away. // delete infotext; *************** *** 801,810 **** alertwin = new PopupOk("interfaces/selectmission/alertwin", 400, 300, this->view->frame->surface); ! winman = new WindowManager; ! winman->add(missionselectmenu); ! winman->add(popupinfo); ! winman->add(alertlose); ! winman->add(alertwin); set_info_buttons(); --- 802,813 ---- alertwin = new PopupOk("interfaces/selectmission/alertwin", 400, 300, this->view->frame->surface); ! // winman = new WindowManager; ! missionselectmenu->add(popupinfo); ! missionselectmenu->add(alertlose); ! missionselectmenu->add(alertwin); + missionselectmenu->tree_doneinit(); + + popupinfo->focus(); set_info_buttons(); *************** *** 836,840 **** FULL_REDRAW = true; ! winman->calculate(); --- 839,843 ---- FULL_REDRAW = true; ! missionselectmenu->tree_calculate(); *************** *** 927,932 **** //show_mouse(frame->surface); scare_mouse(); ! winman->setscreen(view->frame->surface); ! winman->animate(); unscare_mouse(); --- 930,935 ---- //show_mouse(frame->surface); scare_mouse(); ! missionselectmenu->tree_setscreen(view->frame->surface); ! missionselectmenu->tree_animate(); unscare_mouse(); Index: vgGenSys.cpp =================================================================== RCS file: /cvsroot/timewarp/source/games/vgGenSys.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** vgGenSys.cpp 25 Nov 2003 00:13:13 -0000 1.5 --- vgGenSys.cpp 12 Dec 2003 15:57:24 -0000 1.6 *************** *** 11,14 **** --- 11,15 ---- #include "../twgui/twgui.h" + #include "../twgui/twmenuexamples.h" #include "../melee/mlog.h" *************** *** 791,795 **** PopupList *popupl; ! popupl = new PopupList(screen, "interfaces/gametest/popuplist", 0, 0, videosystem.get_font(2), 0); popupl->tbl->set_optionlist(functitle, Ninit, makecol(255,255,128)); popupl->show(); --- 792,796 ---- PopupList *popupl; ! popupl = new PopupList(screen, "interfaces/gametest/popuplist", "text/", 0, 0, videosystem.get_font(2), 0); popupl->tbl->set_optionlist(functitle, Ninit, makecol(255,255,128)); popupl->show(); *************** *** 798,807 **** popupl->close_on_defocus = false; ! WindowManager *winman; ! winman = new WindowManager; ! winman->add(popupl); ! ! popupl->setscreen(screen); show_mouse(screen); unscare_mouse(); --- 799,809 ---- popupl->close_on_defocus = false; + popupl->tree_doneinit(); + + //WindowManager *winman; + //winman = new WindowManager; + //winman->add(popupl); ! popupl->tree_setscreen(screen); show_mouse(screen); unscare_mouse(); *************** *** 811,816 **** idle(10); ! winman->calculate(); ! winman->animate(); } --- 813,818 ---- idle(10); ! popupl->tree_calculate(); ! popupl->tree_animate(); } |
Update of /cvsroot/timewarp/source/twgui In directory sc8-pr-cvs1:/tmp/cvs-serv13431 Modified Files: twgui.cpp twgui.h utils.cpp utils.h Removed Files: area.cpp area.h gametest.cpp gametest.h Log Message: twgui update Index: twgui.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twgui.cpp,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** twgui.cpp 23 Nov 2003 23:51:57 -0000 1.12 --- twgui.cpp 12 Dec 2003 15:55:06 -0000 1.13 *************** *** 1,4 **** --- 1,5 ---- #include <allegro.h> + #include <winalleg.h> #include <stdio.h> #include <string.h> *************** *** 9,33 **** #include "twgui.h" [...2694 lines suppressed...] - // the first rough check whether it's in the boxed bitmap area - if (AreaBox::hasmouse()) - { - // now check the bitmap, if the mouse is touching a non-transparent sprite. - // only check the default bitmap (buttons that change size aren't cool) - return check_pixel(backgr, mouse.xpos()-x, mouse.ypos()-y); - - } else - return false; - } - - - - AreaTabletScrolled::AreaTabletScrolled(AreaReserve *menu, char *identbranch, int ax, int ay, int asciicode, bool akeepkey) - :AreaTablet(menu, identbranch, ax, ay, asciicode, akeepkey) - { - scrollcontrol.ver(this, identbranch, &scroll); - } --- 1023,1026 ---- Index: twgui.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/twgui.h,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** twgui.h 23 Nov 2003 23:51:57 -0000 1.10 --- twgui.h 12 Dec 2003 15:55:06 -0000 1.11 *************** *** 4,97 **** ! #include "area.h" ! ! ! const int maxlines = 1024; ! ! ! ! ! // to implement a button, you add bitmaps-feedback to the box-area control ! ! class Button : public AreaBox ! { ! protected: ! BITMAP *bmp_default, *bmp_focus, *bmp_selected; ! public: ! // x, y, W, H are inside the draw area ! Button(AreaReserve *menu, char *identbranch, int ax, int ay, int asciicode, bool keepkey = 0); ! virtual ~Button(); ! ! // virtual void init(AreaReserve *menu, char *identbranch, int ax, int ay, unsigned char asciicode); ! ! virtual void draw_default(); ! virtual void draw_focus(); ! virtual void draw_selected(); ! ! virtual bool hasmouse(); ! }; ! ! ! // something which has a background, and its own drawing-area ! class AreaTablet : public AreaBox ! { ! protected: ! BITMAP *backgr, *drawarea; ! ! public: ! ! AreaTablet(AreaReserve *menu, char *identbranch, int ax, int ay, int asciicode, bool akeepkey = 0); ! virtual AreaTablet::~AreaTablet(); ! ! void initbackgr(bool autoplace); ! void changebackgr(char *fname); ! ! void animate(); // shouldn't be changed. ! virtual void subanimate(); ! ! virtual bool hasmouse(); ! }; ! ! ! ! class ScrollBar : public AreaTablet ! { ! protected: ! BITMAP *button; ! public: ! ! enum {hor = 1, ver= 2} direction ; ! ! double relpos; ! ! int pmin, pmax, bwhalf, bhhalf; // p = position (can be x or y) ! int pbutton; ! ! // x, y, W, H are inside the draw area ! ScrollBar(AreaReserve *menu, char *identbranch, int ax, int ay); ! virtual ~ScrollBar(); ! ! virtual void handle_lhold(); ! ! virtual void subanimate(); ! ! void setrelpos(double arelpos); ! }; ! ! // creates a set of buttons for the control of a scrollpos_str ! class ScrollControl ! { ! public: ! Button *left, *right, *up, *down; ! ScrollBar *scrollvert, *scrollhor; - ScrollControl(); - void hor(AreaReserve *A, char *id, scrollpos_str *ascr); - void hor(AreaGeneral *A, char *id, scrollpos_str *ascr); - void ver(AreaReserve *A, char *id, scrollpos_str *ascr); - void ver(AreaGeneral *A, char *id, scrollpos_str *ascr); - }; --- 4,13 ---- ! #include "twwindow.h" ! #include "twbuttontypes.h" ! #include "twhelpers.h" *************** *** 101,124 **** protected: ! scrollpos_str scroll; ! ScrollControl scrollcontrol; public: ! AreaTabletScrolled(AreaReserve *menu, char *identbranch, int ax, int ay, int asciicode, bool akeepkey = 0); ! }; ! ! ! - class GhostButton : public AreaGeneral - { - public: - GhostButton(AreaReserve *menu); - virtual ~GhostButton(); - }; // a text on top of a button. --- 17,34 ---- protected: ! //scrollpos_str scroll; ! ScrollControl scroll; public: ! AreaTabletScrolled(TWindow *menu, char *identbranch, int asciicode, bool akeepkey = 0); + int gety(); + + virtual void calculate(); + }; // a text on top of a button. *************** *** 128,137 **** { public: ! TextButton(AreaReserve *menu, char *identbranch, int ax, int ay, FONT *afont); virtual ~TextButton(); FONT *usefont; ! char text[64]; int text_color; --- 38,47 ---- { public: ! TextButton(TWindow *menu, char *identbranch, FONT *afont); virtual ~TextButton(); FONT *usefont; ! char *text; int text_color; *************** *** 141,229 **** - // a class you can use to edit text - - class TextInfo - { - public: - char *textinfo; - - int linestart[maxlines]; - int Nlines, Nchars; - - FONT *usefont; - int W, Htxt, Nshow; - - int text_color; - - BITMAP *bmp; - - TextInfo(FONT *afont, BITMAP *abmp, char *atextinfo, int Nchars); - ~TextInfo(); - - //void set_textinfo(char *atextinfo, int Nchars); - - void getxy(int charpos, int *x, int *y); - int getcharpos(int x, int y); - void changeline(int *charpos, int line1, int line2); - - void reset(scrollpos_str *scroll); - }; - - class TextEditBox : public AreaTabletScrolled - { - protected: - char *text;//[128]; // can hold 1 line of text. - int maxchars; - int charpos; - - //BITMAP *backgr; - - // this is used to record when the last key-press was made (with a resolution - // of 1 frame at best). - bool keypr[KEY_MAX]; - int lastpressed; - int repeattime, lasttime; - int text_color; - - - TextInfo *textinfo; - - - public: - TextEditBox(AreaReserve *menu, char *identbranch, int ax, int ay, FONT *afont, char *atext, int amaxtext); - virtual ~TextEditBox(); - - FONT *usefont; - - // scrollpos_str scroll; - // ScrollControl scrollcontrol; - - virtual void calculate(); - virtual void subanimate(); - - virtual void handle_lpress(); - - void clear_text(); - void show_text(); - - // set the typematic delay to "atime" milliseconds (default = 100) - void set_repeattime(int atime); - void set_textcolor(int c); - - void text_reset(); - void text_reset(char *newtext); - }; - // Draws a list of text strings onto a background ! class TextList : public AreaTablet { public: ! TextList(AreaReserve *menu, char *identbranch, int ax, int ay, FONT *afont); ~TextList(); ! scrollpos_str scroll; ! ScrollControl scrollcontrol; char **optionlist; --- 51,66 ---- // Draws a list of text strings onto a background ! // Returns the "item" (or line) number that's selected ! // This must support a scroll-bar, in case the list does not fit in the box ! class TextList : public AreaTabletScrolled { public: ! TextList(TWindow *menu, char *identbranch, FONT *afont); ~TextList(); ! //ScrollControl scroll; char **optionlist; *************** *** 256,330 **** - - // a switch, is a button that is always in 2 of states (on or off) : - // (a "focus" is always indicated by some box around it). - - class SwitchButton : public AreaBox - { - protected: - BITMAP *bmp_on, *bmp_off; - public: - bool state; // true=on, false=off - // x, y, W, H are inside the draw area - SwitchButton(AreaReserve *menu, char *identbranch, int ax, int ay, int asciicode); - virtual ~SwitchButton(); - - virtual void calculate(); - - virtual void draw_default(); - virtual void draw_focus(); - virtual void draw_selected(); // is the same as focus, cause a switch cannot be selected all the time !! - - void draw_on(); - void draw_off(); - - virtual bool hasmouse(); - //void locate_by_backgr(char *stron); - }; - - - - // Draws a list of text strings onto a background - // This is useful for a popup menu. - class TextButtonList : public AreaTablet - { - scrollpos_str *scroll; - public: - TextButtonList(AreaReserve *menu, char *identbranch, int ax, int ay, FONT *afont, - scrollpos_str *ascroll); - virtual ~TextButtonList(); - - char **optionlist; - int N; // number of options - - FONT *usefont; - int Htxt, Nshow; - - int yselected; // the selected item. - - void clear_optionlist(); - void set_optionlist(char **aoptionlist, int color); - void set_optionlist(char **aoptionlist, int aN, int color); - - void set_selected(int iy); - - int text_color; - - void initbackgr(bool autoplace); - - virtual void subanimate(); - - virtual void handle_lpress(); - virtual void handle_rpress(); - - int getk(); - }; - - - - - - - // Draw some text into a box... text can consist of many lines. No editing possible. // If there's a lot of text, you could scroll. --- 93,96 ---- *************** *** 333,343 **** class TextInfoArea : public AreaTabletScrolled { //scrollpos_str *scroll; public: ! TextInfoArea(AreaReserve *menu, char *identbranch, int ax, int ay, FONT *afont); virtual ~TextInfoArea(); - char *textinfo; - int linestart[maxlines]; int Nlines; --- 99,111 ---- class TextInfoArea : public AreaTabletScrolled { + protected: + int maxchars; + char *localcopy; + TextInfo *textinfo; //scrollpos_str *scroll; public: ! TextInfoArea(TWindow *menu, char *identbranch, FONT *afont, char *atext, int amaxtext); virtual ~TextInfoArea(); int linestart[maxlines]; int Nlines; *************** *** 348,351 **** --- 116,120 ---- int text_color; + void set_textinfo(char *atextinfo); void set_textinfo(char *atextinfo, int Nchars); *************** *** 358,482 **** ! ! // A popup-list consists of several components, which you've to initialize: ! // (most of it is automatically initialized from the shape of the menu screen- ! // the button images should be present on it as well) ! class PopupGeneral : public AreaReserve ! { ! public: ! int returnstatus; ! ! struct option_str ! { ! bool disable_othermenu, // disables all i/o of the host menu (true) ! place_relative2mouse; // places relative to mouse (true), or the host menu (false) ! } option; ! ! ! bool movingthereserve; // in case you want to move the menu area somewhere else ! ! bool returnvalueready; ! ! int xshift, yshift; ! ! AreaGeneral *trigger; // this controls the on/off of the menu ! ! // Button *left, *right, *up, *down; ! // ScrollBar *scrollvert, *scrollhor; ! ! scrollpos_str scroll; ! ScrollControl scrollcontrol; ! ! // origin relative to the creators' position ! PopupGeneral(AreaGeneral *creator, char *identbranch, int axshift, int ayshift); ! PopupGeneral(char *identbranch, int axshift, int ayshift, BITMAP *outputscreen); ! ~PopupGeneral(); ! virtual void init_components(char *identbranch); ! ! // returnstatus can be (usually is) the array index of a selected item in a list. ! virtual void close(int areturnstatus); ! virtual void enable(); ! virtual void newscan(); ! ! virtual void calculate(); ! virtual void handle_focus_loss(); ! ! // this should call "close" ; you should replace this with your own code, to get the ! // submenu-exit behaviour you want. Default is that it returns value -1 when the mouse ! // pointer leaves the submenu area. ! virtual void check_end(); ! ! // this allows you to acces the return value, but only once after the submenu was ! // closed; otherwise it returns -1. ! int getvalue(); ! ! // this toggles whether the list is auto-closed when focus is lost, or remains ! // focus even if the mouse moves out of sight of the list... ! bool close_on_defocus; ! }; ! ! ! class PopupTextInfo : public PopupGeneral { ! public: ! TextInfoArea *tia; ! PopupTextInfo(AreaGeneral *creator, char *ident, int axshift, int ayshift, ! FONT *afont, char *atext, int aNchar); ! virtual ~PopupTextInfo(); ! }; - // the info screen, can be toggled on/off, by pressing the trigger-button. - // (uhm, well, that didn't work easily, so now it's simply turned on all the time). - class PopupTextInfo_toggle : public PopupTextInfo - { public: ! PopupTextInfo_toggle(AreaGeneral *creator, char *ident, int axshift, int ayshift, ! FONT *afont, char *atext, int aNchar); ! ! // ~PopupTextInfo(); virtual void calculate(); ! virtual void check_end(); ! ! }; ! ! ! ! ! // A popup-list consists of several components, which you've to initialize: ! // (most of it is automatically initialized from the shape of the menu screen- ! // the button images should be present on it as well) ! class PopupList : public PopupGeneral ! { ! public: ! ! int xshift, yshift; ! ! // AreaGeneral *trigger; // this controls the on/off of the menu ! ! // Button *left, *right, *up, *down; ! // scrollpos_str *scroll_control; ! TextButtonList *tbl; ! // ScrollBar *scrollvert, *scrollhor; ! // char **optionslist; ! // just a "list" item ... not really a popup thing ! PopupList(BITMAP *outputscreen, char *ident, int axshift, int ayshift, ! FONT *afont, char **aaoptionslist); ! ! // origin relative to the creators' position ! PopupList(AreaGeneral *creator, char *ident, int axshift, int ayshift, ! FONT *afont, char **aaoptionslist); ! virtual ~PopupList(); ! virtual void check_end(); ! //virtual void calculate(); ! //virtual void handle_focus_loss(); }; --- 127,167 ---- ! class TextEditBox : public TextInfoArea { ! protected: ! char *text;//[128]; // can hold 1 line of text. ! int charpos; ! // this is used to record when the last key-press was made (with a resolution ! // of 1 frame at best). ! bool keypr[KEY_MAX]; ! int lastpressed; ! int repeattime, lasttime; ! int text_color; + + //TextInfo *textinfo; public: + TextEditBox(TWindow *menu, char *identbranch, FONT *afont, char *atext, int amaxtext); + virtual ~TextEditBox(); ! //FONT *usefont; virtual void calculate(); ! virtual void subanimate(); ! virtual void handle_lpress(); ! void clear_text(); ! void show_text(); ! // set the typematic delay to "atime" milliseconds (default = 100) ! //void set_repeattime(int atime); ! void set_textcolor(int c); + void text_reset(); + void text_reset(char *newtext); }; *************** *** 487,496 **** // implement a matrix of icons // the box defines the area where the icons are visible; - // if there are too many, you can scroll perhaps --> so, you need to know the mouse position inside this box... ! class MatrixIcons : public AreaTablet { protected: - scrollpos_str *scroll; int Nx, Ny, Nxshow, Nyshow, maxitems; int Wicon, Hicon; --- 172,179 ---- // implement a matrix of icons // the box defines the area where the icons are visible; ! class MatrixIcons : public AreaTabletScrolled { protected: int Nx, Ny, Nxshow, Nyshow, maxitems; int Wicon, Hicon; *************** *** 509,514 **** BITMAP **listIcon; ! MatrixIcons(AreaReserve *menu, char *identbranch, int ax, int ay, ! scrollpos_str *ascroll, int akey); virtual ~MatrixIcons(); --- 192,196 ---- BITMAP **listIcon; ! MatrixIcons(TWindow *menu, char *identbranch, int akey); virtual ~MatrixIcons(); *************** *** 527,612 **** - class PopupFleetSelection : public PopupGeneral - { - public: - MatrixIcons *icons; - TextButton *info; - Button *oncerandom, *alwaysrandom; - - PopupFleetSelection(AreaGeneral *creator, char *ident, int axshift, int ayshift, char *datafilename, - BITMAP **alistIcon, double ascale, FONT *afont ); - - PopupFleetSelection(char *ident, int axshift, int ayshift, - char *datafilename, BITMAP *outputscreen, - BITMAP **alistIcon, double ascale, FONT *afont ); - - virtual ~PopupFleetSelection(); - - //virtual void close(int areturnstatus); - virtual void check_end(); - - virtual void newscan(BITMAP **alistIcon, double ascale, char *txt); - - //virtual void init_components(); - - }; - - - - - - - class Popup : public AreaReserve - { - int returnstatus; - bool inherited; - - public: - Popup(char *ident, int xcenter, int ycenter, BITMAP *outputscreen, - bool inherited = false); - virtual ~Popup(); - - bool returnvalueready; - - virtual void calculate(); - virtual void check_end(); - - virtual void close(int areturnstatus); - virtual int getvalue(); - virtual void enable(); - - }; - - - - class PopupOk : public Popup - { - Button *ok; - public: - PopupOk(char *ident, int xcenter, int ycenter, - //char *datafilename, - BITMAP *outputscreen, - bool inherited = false); - virtual ~PopupOk(); - virtual void check_end(); - }; - - - class PopupYN : public Popup - { - Button *yes, *no; - public: - PopupYN(char *ident, int xcenter, int ycenter, - //char *datafilename, - BITMAP *outputscreen, - bool inherited = false); - virtual ~PopupYN(); - virtual void check_end(); - - }; - - #endif --- 209,215 ---- #endif + Index: utils.cpp =================================================================== RCS file: /cvsroot/timewarp/source/twgui/utils.cpp,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utils.cpp 26 Oct 2003 10:43:18 -0000 1.5 --- utils.cpp 12 Dec 2003 15:55:06 -0000 1.6 *************** *** 7,12 **** #include "utils.h" ! #include "area.h" ! #include "twgui.h" // ----------------- SOME GENERALLY USEFUL STRUCTURES / FUNCTIONS ------------------ --- 7,20 ---- #include "utils.h" ! //#include "area.h" ! //#include "twgui.h" ! ! ! normalmouse Tmouse; ! ! TKeyHandler keyhandler; ! ! ! // ----------------- SOME GENERALLY USEFUL STRUCTURES / FUNCTIONS ------------------ *************** *** 28,31 **** --- 36,51 ---- } + int unmapkey1(int k) + { + // return the 1st scancode + return k & 0x0FF; + } + + int unmapkey2(int k) + { + // return the 1st scancode + return (k >> 8) & 0x0FF; + } + BITMAP *find_datafile_bmp(DATAFILE *datafile, char *identif) *************** *** 263,477 **** - scrollpos_str::scrollpos_str() - { - x = 0; - y = 0; - - left = 0; - right = 0; - up = 0; - down = 0; - scrollhor = 0; - scrollvert = 0; - } - - - void scrollpos_str::set(int xscroll, int yscroll, int Nxscroll, int Nyscroll, - int Nx_show, int Ny_show) - { - x = xscroll; // this is top-left corner item of the visible screen - y = yscroll; - - xselect = x; // this has some extra movement capacility within the visible screen - yselect = y; - - Nxshow = Nx_show; // the size (in items) of the visible screen - Nyshow = Ny_show; - - Nx = Nxscroll - Nxshow + 1; // the scrollable freedom - Ny = Nyscroll - Nyshow + 1; - - // note: Nx = 1 indicates the "base" position; values >1 indicate out-of-sight positions. - // or: Nx-Nxshow indicates the out-of-sight positions, +1 indicates the base value position. - - // check ranges. - if (Nx < 1) - Nx = 1; - if (Ny < 1) - Ny = 1; - - check_pos(); - } - - - void scrollpos_str::check_pos() - { - // check the scroll position - if (x > Nx-1) - x = Nx-1; - - if (y > Ny-1) - y = Ny-1; - - if (x < 0) - x = 0; - - if (y < 0) - y = 0; - - // check the select position - // note, the selected item _must_ always lie within the visible area: - - if (xselect < x) - xselect = x; - if (xselect > x + Nxshow - 1) - xselect = x + Nxshow - 1; - if (yselect < y) - yselect = y; ! if (yselect > y + Nyshow - 1) ! yselect = y + Nyshow - 1; ! } ! ! ! void scrollpos_str::add(int dx, int dy) { ! x += dx; ! y += dy; ! ! check_pos(); } ! void scrollpos_str::check_sel() { ! if (xselect < x) ! x = xselect; ! ! if (xselect > x + Nxshow - 1) ! x = xselect-Nxshow+1; ! ! if (yselect < y) ! y = yselect; ! if (yselect > y + Nyshow - 1) ! y = yselect-Nyshow+1; } ! ! void scrollpos_str::set_sel(int xsel, int ysel) { ! xselect = xsel; ! yselect = ysel; ! ! check_sel(); ! check_pos(); ! } ! ! ! // alpha is a value between 0 and 1 ! void scrollpos_str::set_percent_pos_x(double alpha) ! { ! x = iround( (Nx-1) * alpha ); ! check_pos(); } - void scrollpos_str::set_percent_pos_y(double alpha) - { - y = iround( (Ny-1) * alpha ); - check_pos(); - } ! void scrollpos_str::set_pos(int xnew, int ynew) { ! if ( xnew >= 0 && xnew < Nx && ynew >= 0 && ynew < Ny ) ! { ! x = xnew; ! y = ynew; ! if (scrollhor) ! scrollhor->setrelpos(double(x)/Nx); ! if (scrollvert) ! scrollvert->setrelpos(double(y)/Ny); ! } ! check_pos(); } ! ! ! void scrollpos_str::bind(AreaGeneral *aleft, AreaGeneral *aright, ! AreaGeneral *aup, AreaGeneral *adown, ! ScrollBar *ascrollhor, ScrollBar *ascrollvert) { ! left = aleft; ! right = aright; ! up = aup; ! down = adown; ! scrollvert = ascrollvert; ! scrollhor = ascrollhor; } ! void scrollpos_str::calculate() { ! int xold, yold; ! ! xold = x; ! yold = y; ! ! if (left && left->flag.left_mouse_press) { ! --xselect; ! if (xselect < x) ! x = xselect; ! ! } ! if (right && right->flag.left_mouse_press) ! { ! ++xselect; ! if (xselect > x + Nxshow - 1) ! x = xselect-Nxshow+1; ! } ! if (up && up->flag.left_mouse_press) ! { ! --yselect; ! if (yselect < y) ! y = yselect; } ! if (down && down->flag.left_mouse_press) { ! ++yselect; ! if (yselect > y + Nyshow - 1) ! y = yselect-Nyshow+1; } - check_pos(); ! if (scrollhor && xold != x) ! scrollhor->setrelpos(double(x)/Nx); ! if (scrollvert && yold != y) ! scrollvert->setrelpos(double(y)/Ny); ! ! if (scrollhor && scrollhor->flag.left_mouse_hold) ! set_percent_pos_x(scrollhor->relpos); ! if (scrollvert && scrollvert->flag.left_mouse_hold) ! set_percent_pos_y(scrollvert->relpos); } --- 283,408 ---- + /* + extern int (*keyboard_callback)(int key); + If set, this function is called by the keyboard handler in response + to every keypress. It is passed a copy of the value that is about to + be added into the input buffer, and can either return this value + unchanged, return zero to cause the key to be ignored, or return + a modified value to change what readkey() will later return. + This routine executes in an interrupt context, so it must be + in locked memory. + */ ! // just make a copy of the input. ! static int my_callback(int key) { ! keyhandler.add(key); ! return key; } ! TKeyHandler::TKeyHandler() { ! keyboard_callback = my_callback; ! clear(); } ! void TKeyHandler::clear() { ! Nbuf = 0; ! Nbackbuf = 0; ! int i; ! for ( i = 0; i < KEY_MAX; ++i ) ! { ! keynew[i] = key[i]; ! keyold[i] = key[i]; ! } } ! void TKeyHandler::add(int key) { ! if (Nbackbuf >= buffmax) ! return; ! keybackbuf[Nbackbuf] = key; ! ++Nbackbuf; } ! void TKeyHandler::clearbuf() { ! Nbuf = 0; } ! void TKeyHandler::update() { ! if (keyboard_needs_poll()) ! poll_keyboard(); ! // detect key changes ... ! // (note that changes in-between updates are not seen by this so it's not 100% accurate) ! int i; ! for ( i = 0; i < KEY_MAX; ++i ) { ! // keep record of prev and new states ! keyold[i] = keynew[i]; ! keynew[i] = key[i]; ! // detect changes ! keyhit[i] = 0; ! keyreleased[i] = 0; ! if (keynew[i] != keyold[i]) ! { ! if (keynew[i]) ! keyhit[i] = 1; ! else ! keyreleased[i] = 1; ! } } ! ! Nbuf = Nbackbuf; ! for ( i = 0; i < Nbuf; ++i ) { ! keybuf[i] = keybackbuf[i]; } + // reset the back-buffer for reading new stuf. + Nbackbuf = 0; + } ! bool TKeyHandler::pressed(char key) ! { ! // only compare if the key != 0, otherwise you can get matches with ! // wierd key combos or something. So, key==0 has the meaning of, don't compare me! ! if (key == 0) ! return false; ! //char teststring[128]; ! int i; ! for (i = 0; i < Nbuf; ++i) ! { ! //teststring[i] = keybuf[i] & 0x0FF; ! if ( (keybuf[i] & 0x0FF) == key ) // only compare by ascii code... ! return true; ! } ! //teststring[i] = 0; ! //message.out(teststring); + return false; } Index: utils.h =================================================================== RCS file: /cvsroot/timewarp/source/twgui/utils.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** utils.h 26 Oct 2003 10:43:18 -0000 1.5 --- utils.h 12 Dec 2003 15:55:06 -0000 1.6 *************** *** 5,8 **** --- 5,11 ---- int mapkey(int scancode_key, int scancode_ctrl = 0); + int unmapkey1(int k); + int unmapkey2(int k); + *************** *** 82,114 **** - class AreaGeneral; - class ScrollBar; ! // discrete position (x,y = item number, not pixels) ! struct scrollpos_str { ! AreaGeneral *left, *right, *up, *down; ! ScrollBar *scrollhor, *scrollvert; ! scrollpos_str(); ! int x, y; // which Icon is visible top left. ! int Nx, Ny; // number of Icons that are present. ! int xselect, yselect; ! int Nxshow, Nyshow; ! void set(int xscroll, int yscroll, int Nxscroll, int Nyscroll, int Nx_show, int Ny_show); ! void set_pos(int xnew, int ynew); ! void set_percent_pos_x(double alpha); ! void set_percent_pos_y(double alpha); ! void add(int dx, int dy); ! void check_pos(); ! void bind(AreaGeneral *left, AreaGeneral *right, AreaGeneral *up, AreaGeneral *down, ! ScrollBar *scrollhor, ScrollBar *scrollvert); ! void calculate(); ! void set_sel(int xsel, int ysel); ! void check_sel(); ! }; --- 85,116 ---- ! ! ! static const int buffmax = 128; ! ! class TKeyHandler { ! private: ! int Nbackbuf; ! int keybackbuf[buffmax]; ! public: ! int keynew[KEY_MAX]; ! int keyold[KEY_MAX]; ! int keyhit[KEY_MAX]; ! int keyreleased[KEY_MAX]; ! int Nbuf; ! int keybuf[buffmax]; ! TKeyHandler(); ! void update(); ! void add(int key); ! void clear(); ! void clearbuf(); + bool pressed(char key); + }; --- area.cpp DELETED --- --- area.h DELETED --- --- gametest.cpp DELETED --- --- gametest.h DELETED --- |
Update of /cvsroot/timewarp/source/gamex In directory sc8-pr-cvs1:/tmp/cvs-serv13152 Modified Files: gamedialogue.cpp gamedialogue.h gamegeneral.cpp gameplanetview.cpp gameplanetview.h projectx.cpp Log Message: twgui update Index: gamedialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gamedialogue.cpp 23 Nov 2003 16:21:05 -0000 1.2 --- gamedialogue.cpp 12 Dec 2003 15:53:18 -0000 1.3 *************** *** 121,127 **** - AreaReserve *R; ! R = new AreaReserve("gamex/interface/aliendialog", 10, 10, view->frame->surface); --- 121,126 ---- ! R = new TWindow("gamex/interface/aliendialog", 10, 10, view->frame->surface); *************** *** 135,139 **** showline_Nlines = Nlines(dialo->T); //A = new TextEditBox(R, "A", -1, -1, usefont, showline(dialo.A, showline_num), 0); ! A = new TextInfoArea(R, "A/", -1, -1, usefont); // all text should fit on 1 window - no scroll needed !! //A->set_textcolor(tcol); --- 134,138 ---- showline_Nlines = Nlines(dialo->T); //A = new TextEditBox(R, "A", -1, -1, usefont, showline(dialo.A, showline_num), 0); ! A = new TextInfoArea(R, "A/", usefont, 0, 0); // all text should fit on 1 window - no scroll needed !! //A->set_textcolor(tcol); *************** *** 142,150 **** ! B = new TextList(R, "B/", -1, -1, usefont); ! winman = new WindowManager; ! winman->add(R); initBlist(dialo); --- 141,150 ---- ! B = new TextList(R, "B/", usefont); ! //winman = new WindowManager; ! //winman->add(R); ! R->tree_doneinit(); initBlist(dialo); *************** *** 236,240 **** FULL_REDRAW = true; ! winman->calculate(); --- 236,240 ---- FULL_REDRAW = true; ! R->tree_calculate(); *************** *** 291,295 **** { int i; ! i = B->scroll.yselect; if (i >= 0 && i < Nactivebranches) // shouldn't be necessary ?! { --- 291,295 ---- { int i; ! i = B->gety();//scroll.yselect; if (i >= 0 && i < Nactivebranches) // shouldn't be necessary ?! { *************** *** 327,332 **** //show_mouse(frame->surface); ! winman->setscreen(view->frame->surface); ! winman->animate(); show_mouse(view->frame->surface); scare_mouse(); --- 327,332 ---- //show_mouse(frame->surface); ! R->tree_setscreen(view->frame->surface); ! R->tree_animate(); show_mouse(view->frame->surface); scare_mouse(); Index: gamedialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamedialogue.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gamedialogue.h 18 Nov 2003 17:18:47 -0000 1.1.1.1 --- gamedialogue.h 12 Dec 2003 15:53:18 -0000 1.2 *************** *** 31,42 **** ! WindowManager *winman; - //TextEditBox *A; TextInfoArea *A; TextList *B; - - // char Qtext[Nqtext]; - // char Atext[Natext]; char racefile[128]; --- 31,38 ---- ! TWindow *R; TextInfoArea *A; TextList *B; char racefile[128]; Index: gamegeneral.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gamegeneral.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** gamegeneral.cpp 25 Nov 2003 00:13:08 -0000 1.2 --- gamegeneral.cpp 12 Dec 2003 15:53:18 -0000 1.3 *************** *** 321,334 **** minzoom = 0.5; - // this is 1:1 pixels in the reference screen. - maxzoom = framesize.x / refscreenw; - // the drawing area (needed to calculate zoom) ! // shouldn't this be, frame->surface !!?? ! framesize = Vector2(frame->window->w, frame->window->h); zoomlevel = framesize.x / maparea.x; // in this way, a single maparea fits exactly into a single window (at least // in the x-direction). // correction applied to the y-size of the maparea: --- 321,336 ---- minzoom = 0.5; // the drawing area (needed to calculate zoom) ! if (frame->surface) ! framesize = Vector2(frame->surface->w, frame->surface->h); ! else ! framesize = Vector2(frame->window->w, frame->window->h); zoomlevel = framesize.x / maparea.x; // in this way, a single maparea fits exactly into a single window (at least // in the x-direction). + + // this is 1:1 pixels in the reference screen. + maxzoom = framesize.x / refscreenw; // correction applied to the y-size of the maparea: Index: gameplanetview.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetview.cpp,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gameplanetview.cpp 18 Nov 2003 17:18:49 -0000 1.1.1.1 --- gameplanetview.cpp 12 Dec 2003 15:53:18 -0000 1.2 *************** *** 27,30 **** --- 27,66 ---- + Frame2::Frame2(int max_items) + : + Frame(max_items) + { + } + + Frame2::~Frame2() + { + } + + + void Frame2::setsurface(Surface *newsurface) + { + surface = newsurface; + } + + void Frame2::erase() + { + Frame::erase(); + } + + void Frame2::draw() + { + Frame::draw(); + } + + void Frame2::prepare() + { + return; // do nothing, the real "prepare" comes from the setsurface. + } + + + + + + void GamePlanetview::init() *************** *** 36,51 **** 0, 0, 0, 0, ! 0, 0.75, ! 0, 1.0 ); double H = 2000; ! size = Vector2(H, H); prepare(); // mapwrap = false; ! wininfo.init( Vector2(200,200), 800.0, view->frame ); wininfo.zoomlimit(size.x); ! wininfo.scaletowidth(size.x); // zoom out to this width. --- 72,106 ---- 0, 0, 0, 0, ! 0.0, 1.0, ! 0.0, 1.0 ); + + T = new TWindow("gamex/interface/planetview", 0, 0, screen); + T->tree_doneinit(); + + tmpbmp = create_sub_bitmap(T->backgr, 30, 30, 700, 400); + + // use this for game-drawing to part of the menu + tempframe = new Frame2(1024); + tempframe->setsurface(tmpbmp); + // needed to fool the frame routine about the mother window (otherwise it'll create + // new bitmaps with the mother window size??!!) + tempframe->window->w = tempframe->surface->w; + tempframe->window->h = tempframe->surface->h; + tempframe->window->x = 0; + tempframe->window->y = 0; + // tempframe->window->surface = tempframe->surface; + + + double ratio = tmpbmp->h / double(tmpbmp->w); double H = 2000; ! size = Vector2(H, H*ratio); prepare(); // mapwrap = false; ! wininfo.init( Vector2(200,200), 800.0, tempframe);//view->frame ); wininfo.zoomlimit(size.x); ! wininfo.scaletowidth(2*size.x); // zoom out to this width. *************** *** 172,176 **** player = new ThePlaya(playerspr, &playerinfo); add(player); ! // player->pos = Vector2(200,200); // switch_team(player->ally_flag, team_player); --- 227,233 ---- player = new ThePlaya(playerspr, &playerinfo); add(player); ! ! player->pos = Vector2(0,0); ! player->angle = 0.25 * PI; // switch_team(player->ally_flag, team_player); *************** *** 190,193 **** --- 247,251 ---- sb->init(100, view->frame); add(sb); + } *************** *** 211,214 **** --- 269,275 ---- playerinfo.sync(player); + if (tmpbmp) + destroy_bitmap(tmpbmp); + GameBare::quit(); } *************** *** 229,232 **** --- 290,295 ---- return; + T->tree_calculate(); + GameBare::calculate(); *************** *** 319,323 **** FULL_REDRAW = 1; ! GameBare::animate(frame); } --- 382,401 ---- FULL_REDRAW = 1; ! // draws to the raw screen (?) ! FULL_REDRAW = true; ! ! tempframe->full_redraw = true; ! tempframe->erase(); ! tempframe->prepare(); ! ! // this draws to the menu (frame2) ! GameBare::animate(tempframe); ! ! // the menu draws to the game frame ! T->tree_setscreen(frame->surface); ! T->tree_animate(); ! ! // (and the game frame then draws to video memory?) ! } Index: gameplanetview.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/gameplanetview.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** gameplanetview.h 18 Nov 2003 17:18:50 -0000 1.1.1.1 --- gameplanetview.h 12 Dec 2003 15:53:18 -0000 1.2 *************** *** 7,10 **** --- 7,12 ---- #include "gamegeneral.h" + #include "../twgui/twwindow.h" + const int ID_FLEETICON = 0x08235497; *************** *** 18,23 **** --- 20,42 ---- + + class Frame2 : public Frame { + public: + Frame2(int max_items); + virtual ~Frame2(); + + virtual void erase(); + virtual void draw(); + virtual void prepare(); + void setsurface(Surface *newsurface); + }; + + class GamePlanetview : public GameBare { + TWindow *T; + Frame2 *tempframe; // this sets the drawing surface to a subarea of T ... + BITMAP *tmpbmp; + WindowInfo wininfo; Index: projectx.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/projectx.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** projectx.cpp 21 Nov 2003 08:29:01 -0000 1.2 --- projectx.cpp 12 Dec 2003 15:53:18 -0000 1.3 *************** *** 77,81 **** // add( new GameStarmap() ); ! // add( new GamePlanetview() ); // add( new GamePlanetscan() ); // add( new GameMelee() ); --- 77,81 ---- // add( new GameStarmap() ); ! add( new GamePlanetview() ); // add( new GamePlanetscan() ); // add( new GameMelee() ); |
From: <geo...@us...> - 2003-12-12 15:53:21
|
Update of /cvsroot/timewarp/source/gamex/edit In directory sc8-pr-cvs1:/tmp/cvs-serv13152/edit Modified Files: edit_dialogue.cpp edit_dialogue.h Log Message: twgui update Index: edit_dialogue.cpp =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/edit_dialogue.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** edit_dialogue.cpp 23 Nov 2003 16:21:04 -0000 1.2 --- edit_dialogue.cpp 12 Dec 2003 15:53:18 -0000 1.3 *************** *** 213,219 **** - AreaReserve *R; ! R = new AreaReserve("gamex/interface/dialogeditor", 10, 10, view->frame->surface); --- 213,218 ---- ! R = new TWindow("gamex/interface/dialogeditor", 10, 10, view->frame->surface); *************** *** 224,257 **** //strcpy(Qtext, "a\n b\n c\n d\n e\n f\n g\n h\n i"); ! T = new TextEditBox(R, "text/", -1, -1, usefont, dialo->T, 256); T->set_textcolor(tcol); ! B = new TextList(R, "branches/", -1, -1, usefont); ! refresh = new Button(R, "refresh/", -1, -1, 0); ! Bplus = new Button(R, "addbranch", -1, -1, 0); ! // Bmin = new Button(R, "Bmin", -1, -1, 0); ! bprev = new Button(R, "prevbranch/", -1, -1, 0); ! // bnext = new Button(R, "next", -1, -1, 0); ! dialostatus = new SwitchButton(R, "state/", -1, -1, 0); // add a text-button for the race pic, and a popup for the race list selection ?! ! raceselect = new TextButton(R, "race/", -1, -1, usefont); raceselect->set_text(dialo->racepic, makecol(255,255,0)); ! popupraceselect = new PopupList(raceselect, "gamex/interface/dialogeditor/raceselect", -20, -20, usefont, 0); popupraceselect->tbl->set_optionlist(racepiclist, Nracepiclist, makecol(255,255,128)); popupraceselect->hide(); ! winman = new WindowManager; ! winman->add(R); ! winman->add(popupraceselect); initeditor(dialo); --- 223,260 ---- //strcpy(Qtext, "a\n b\n c\n d\n e\n f\n g\n h\n i"); ! T = new TextEditBox(R, "text/", usefont, dialo->T, 256); T->set_textcolor(tcol); ! B = new TextList(R, "branches/", usefont); ! refresh = new Button(R, "refresh_", 0); ! Bplus = new Button(R, "addbranch_", 0); ! // Bmin = new Button(R, "Bmin", 0); ! bprev = new Button(R, "prevbranch_", 0); ! // bnext = new Button(R, "next", 0); ! dialostatus = new SwitchButton(R, "state_", 0); // add a text-button for the race pic, and a popup for the race list selection ?! ! raceselect = new TextButton(R, "race_", usefont); raceselect->set_text(dialo->racepic, makecol(255,255,0)); + raceselect->passive = false; ! popupraceselect = new PopupList(raceselect, "gamex/interface/dialogeditor/raceselect", ! "text/", -20, -20, usefont, 0); popupraceselect->tbl->set_optionlist(racepiclist, Nracepiclist, makecol(255,255,128)); popupraceselect->hide(); ! // winman = new WindowManager; ! // winman->add(R); ! R->add(popupraceselect); ! ! R->tree_doneinit(); initeditor(dialo); *************** *** 327,331 **** FULL_REDRAW = true; ! winman->calculate(); --- 330,334 ---- FULL_REDRAW = true; ! R->tree_calculate(); *************** *** 399,403 **** { int i; ! i = B->scroll.yselect; if (i >= 0 && i < dialo->Nbranches) // shouldn't be necessary ?! { --- 402,406 ---- { int i; ! i = B->gety();//scroll.yselect; if (i >= 0 && i < dialo->Nbranches) // shouldn't be necessary ?! { *************** *** 446,451 **** //show_mouse(frame->surface); ! winman->setscreen(view->frame->surface); ! winman->animate(); show_mouse(view->frame->surface); scare_mouse(); --- 449,454 ---- //show_mouse(frame->surface); ! R->tree_setscreen(view->frame->surface); ! R->tree_animate(); show_mouse(view->frame->surface); scare_mouse(); Index: edit_dialogue.h =================================================================== RCS file: /cvsroot/timewarp/source/gamex/edit/edit_dialogue.h,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -C2 -d -r1.1.1.1 -r1.2 *** edit_dialogue.h 18 Nov 2003 17:18:51 -0000 1.1.1.1 --- edit_dialogue.h 12 Dec 2003 15:53:18 -0000 1.2 *************** *** 9,12 **** --- 9,13 ---- #include "../../twgui/twgui.h" + #include "../../twgui/twmenuexamples.h" const int Ntext = 2048; *************** *** 80,84 **** ! WindowManager *winman; TextEditBox *T; --- 81,86 ---- ! // WindowManager *winman; ! TWindow *R; TextEditBox *T; |
From: <geo...@us...> - 2003-12-12 15:50:34
|
Update of /cvsroot/timewarp/interfaces/selectmission/popupinfo/scroll/scrollbar_vert In directory sc8-pr-cvs1:/tmp/cvs-serv12672/popupinfo/scroll/scrollbar_vert Removed Files: backgr.bmp button.bmp Log Message: re-organizing interface files --- backgr.bmp DELETED --- --- button.bmp DELETED --- |
From: <geo...@us...> - 2003-12-12 15:50:34
|
Update of /cvsroot/timewarp/interfaces/selectmission/briefing/title In directory sc8-pr-cvs1:/tmp/cvs-serv12672/briefing/title Removed Files: backgr.bmp Log Message: re-organizing interface files --- backgr.bmp DELETED --- |