/* * games/_shared/ - shared routines for games * * menu.c - mouse driven highlighting graphical menu * ____________________________________________________________ * * Developed by Ondrej Jombik * Copyright (c) 1997-2000 Condy software inc. * Copyright (c) 2001-2004 Platon SDG, http://platon.sk/ * All rights reserved. * * See README file for more information about this software. * See COPYING file for license information. * * Download the latest version from * http://platon.sk/projects/games/ */ /* $Platon: games/_shared/menu.c,v 1.5 2003/08/12 20:50:59 nepto Exp $ */ #include #include #include #include #include /* getch() */ #if PLATON_SYSTEM_MSDOS # include #endif #if PLATON_SYSTEM_WIN32 # include #endif #if PLATON_SYSTEM_SVGALIB || PLATON_SYSTEM_X11 # include #endif BYTE menu(char*s[], WORD xx, WORD yy, int fnt, int fntsize, WORD fntrng, int cnorm, int cins) { register BYTE c,cold,but=0,k,lines=0; WORD x,y; struct textsettingstype textset; gettextsettings(&textset); /* while(strcmp(s[lines],NULL))lines++; */ /* Old 1998 code... strange. */ while (s[lines] != NULL) lines++; c=cold=lines; settextstyle(fnt,0,fntsize); settextjustify(CENTER_TEXT,TOP_TEXT); setcolor(cnorm); hidemouse(); for(k=0;k=xx-textwidth(s[k])/2)&& (yy+k*fntrng=y) )c=k; } if((but)&&(c