| | |
Graphical Menu Design
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
I say that how we can combining graphic and c++ to design this menus .
For example, look at this codes :
What it say ?
For example, look at this codes :
C++ Syntax (Toggle Plain Text)
/* * volume screen coordinate constants */ #define VOL_ICON_DIMX 32 #define VOL_ICON_DIMY 32 static const unsigned int VolumeIcon [] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff00ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0xffffffff, 0xffffffff, 0xffffff00, 0x0000ffff, 0x00ffffff, 0xffffffff, 0xffff0000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xff000000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0x00000000, 0x0000ff00, 0xff00ffff, 0xffffff00, 0x00000000, 0x0000ff00, 0xffff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ffff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0x00ffff00, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0xffffff00, 0x00000000, 0x0000ff00, 0xffff00ff, 0xffffffff, 0x00000000, 0x0000ff00, 0xff00ffff, 0xffffffff, 0xff000000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xffff0000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xffffff00, 0x0000ffff, 0x00ffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff00ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static unsigned char pel_mask[4096];
What it say ?
It declares an int-array and loads it with values. The array is const static which means that the values in the array cannot be changed.
The second line of code declares a static unsigned char array with a size of 4096 elements. But it doesn't have any values yet. This is not a problem, because the second array isn't const, so the values may be loaded later.
The second line of code declares a static unsigned char array with a size of 4096 elements. But it doesn't have any values yet. This is not a problem, because the second array isn't const, so the values may be loaded later.
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
I think you don't understand my intention . How can I convert a graphical shape to data such as preceded example :
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, .................
How can I use graphic in c++ ? Don't say that I can use libraries . Because I want to compile the code for a micro of a multimedia device .
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, .................
How can I use graphic in c++ ? Don't say that I can use libraries . Because I want to compile the code for a micro of a multimedia device .
Last edited by Behi Jon; Sep 8th, 2009 at 5:00 am.
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
I think you don't understand my intention . How can I convert a graphical shape to data such as preceded example :
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, .................
How can I use graphic in c++ ? Don't say that I can use libraries . Because I want to compile the code for a micro of a multimedia device .
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, .................
How can I use graphic in c++ ? Don't say that I can use libraries . Because I want to compile the code for a micro of a multimedia device .
Last edited by Behi Jon; Sep 8th, 2009 at 5:00 am.
•
•
•
•
I think you don't understand my intention . How can I convert a graphical shape to data such as preceded example :
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff,
0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, .................
•
•
•
•
How can I use graphic in c++ ? Don't say that I can use libraries .
•
•
Join Date: Nov 2008
Posts: 24
Reputation:
Solved Threads: 0
Please see this codes :
C++ Syntax (Toggle Plain Text)
/* * VOL.C ver 0.1 * * (c) Copyright SGS-Thomson Microelectronics Limited 1996. * * Source file name : VOL.C * Authors T.H.Thillai Rajan (tht.rajan@st.com) * * Original Work: none * * ======================= * IMPROVEMENTS THOUGHT OF * ======================= * * ===================== * MODIFICATION HISTORY: * ===================== * * Date Initials Modification * ---- -------- ------------ * 07.04.97 THT CREATED */ /*{{{ Include files*/ #include "appldef.h" /*}}}*/ /*{{{ module dependant includes*/ #include "usif_ext.h" /*}}}*/ /* * volume screen coordinate constants */ #define VOL_ICON_DIMX 32 #define VOL_ICON_DIMY 32 static const unsigned int VolumeIcon [] = { 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff00ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0xffffffff, 0xffffffff, 0xffffff00, 0x0000ffff, 0x00ffffff, 0xffffffff, 0xffff0000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xff000000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0x00000000, 0x0000ff00, 0xff00ffff, 0xffffff00, 0x00000000, 0x0000ff00, 0xffff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ffff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0xff00ff00, 0x00000000, 0x00000000, 0x0000ffff, 0x00ffff00, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0x00000000, 0x00000000, 0x0000ffff, 0x00ff00ff, 0xffffff00, 0x00000000, 0x0000ff00, 0xffff00ff, 0xffffffff, 0x00000000, 0x0000ff00, 0xff00ffff, 0xffffffff, 0xff000000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xffff0000, 0x0000ffff, 0xff00ffff, 0xffffffff, 0xffffff00, 0x0000ffff, 0x00ffffff, 0xffffffff, 0xffffffff, 0x0000ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xff00ffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff, 0xffffffff }; static unsigned char pel_mask[4096]; #define VOL_BOX_ROW_START 70 #define VOL_BOX_COL_START 344 #define VOL_BOX_WIDTH 222 #define VOL_BOX_HEIGHT 36 #define VOL_BOX_ROW_END ( VOL_BOX_ROW_START + VOL_BOX_HEIGHT ) #define VOL_BOX_COL_END ( VOL_BOX_COL_START + VOL_BOX_WIDTH ) #define VOL_ICON_ROW ( VOL_BOX_ROW_START + 2 ) #define VOL_ICON_COL ( VOL_BOX_COL_START + 4 ) #define VOL_SLIDE_BOX_ROW_START ( VOL_BOX_ROW_START + 2 ) #define VOL_SLIDE_BOX_COL_START ( VOL_BOX_COL_START + 40 ) #define VOL_SLIDE_BOX_WIDTH 176//342 #define VOL_SLIDE_BOX_HEIGHT 32 #define VOL_SLIDE_BOX_ROW_END ( VOL_SLIDE_BOX_ROW_START + VOL_SLIDE_BOX_HEIGHT ) #define VOL_SLIDE_BOX_COL_END ( VOL_SLIDE_BOX_COL_START + VOL_SLIDE_BOX_WIDTH ) /* * CODE : DisplayVolume * TYPE : sub-routine * PROTOTYPE : * int DisplayVolume ( char cInvokedBy ); * * STACK : callers stack * INPUT : * a. cInvokedBy char * identifies the type of the key which has invoked this function * * OUTPUT : * a. iKeyValue int * <= 0 Timed Out while waiting for active keys ( VOL+/ VOL-/ MUTE) * > 0 the key scan code which was different from the active keys * * GLOBAL VARIABLES USED : * a. tclkWaitDuration int ( W ) * b. bScreen2bCleared BOOLEAN ( W ) * * DEVICES ACCESSED : nothing * FUNCTIONS CALLED : * * CALLERS : * a. usif_process ..\USIF\SOURCE\USIF.C * * PURPOSE: * this routine displays the current volume level in graphical form. * * ALGORITHM: * 1. Clear the screen and draw the outer rectangle box * 2. wait for the user to press any of the active keys (VOL+/VOL-/MUTE) * 3. if any keys other then active keys present then return to the caller * with the actual key value read. * 4. take appropriate action based on the active key value read. * 5. goto step 2. * * IMPROVEMENT(s) THOUGHT OF: */ /*{{{ DisplayVolume ()*/ int DisplayVolume ( char cVolumeAction ) { extern void mpeg_set_audio_volume_LR ( unsigned int left_volume, unsigned int right_volume ); int iKeyScanCode,i; BOOLEAN bPrintMessage; char cPrevVolLevel; gprim_cls ( C_TRANS ); gprim_setfcol ( C_THIGHLIGHT ); gprim_setbcol ( C_BACKGROUNDDARK ); gprim_frect ( VOL_BOX_COL_START, VOL_BOX_ROW_START, VOL_BOX_COL_END, VOL_BOX_ROW_END ); switch ( cVolumeAction ) { case INCREASE_VOLUME: cCurVolLevel += VOLUME_STEP; if ( cCurVolLevel >= MAX_VOL_LEVEL ) cCurVolLevel = MAX_VOL_LEVEL; break; case DECREASE_VOLUME: cCurVolLevel -= VOLUME_STEP; if ( cCurVolLevel < MIN_VOL_LEVEL ) cCurVolLevel = MIN_VOL_LEVEL; break; case MUTE_VOLUME: if ( bAudioMuteState == TRUE ) { bAudioMuteState = FALSE; mpeg_unmute_audio (); } else { bAudioMuteState = TRUE; mpeg_mute_audio (); } break; } bPrintMessage = TRUE; cPrevVolLevel = cCurVolLevel; gprim_setfcol ( C_TRANS ); gprim_setbcol ( C_THIGHLIGHT ); gprim_frect ( VOL_SLIDE_BOX_COL_START, VOL_SLIDE_BOX_ROW_START, VOL_SLIDE_BOX_COL_END, VOL_SLIDE_BOX_ROW_END ); while ( TRUE ) { mpeg_set_audio_volume_LR ( cCurVolLevel, cCurVolLevel ); UpdateBoxVolInfo ( cCurVolLevel, cCurVolBalance, bAudioMuteState ); if ( bPrintMessage == TRUE ) { bPrintMessage = FALSE; gprim_setfcol ( C_THIGHLIGHT ); gprim_setbcol ( C_BACKGROUNDDARK ); gprim_frect ( VOL_ICON_COL, VOL_ICON_ROW, VOL_ICON_COL+32, VOL_ICON_ROW+32 ); gprim_setbcol ( C_THIGHLIGHT ); if ( bAudioMuteState == TRUE ) { gprim_setfcol ( C_BACKMEDIUM ); ShowVolumeIcon(); gprim_line ( VOL_ICON_COL, VOL_ICON_ROW, VOL_ICON_COL + 32, VOL_ICON_ROW + 32 ); gprim_line ( VOL_ICON_COL, VOL_ICON_ROW+32, VOL_ICON_COL+32, VOL_ICON_ROW ); } else { gprim_setfcol ( C_GREEN ); ShowVolumeIcon(); } gprim_setbcol ( C_TRANS ); for(i=48; i<cCurVolLevel+1; i++) gprim_frect ( VOL_SLIDE_BOX_COL_START+5+(i- MIN_VOL_LEVEL)*10, VOL_SLIDE_BOX_ROW_START+2, VOL_SLIDE_BOX_COL_START+5+(i- MIN_VOL_LEVEL)*10+5, VOL_SLIDE_BOX_ROW_END-4 ); } wait_duration_forced_during = WAIT_AT_VOLUME_CONTROL; if ( bAudioMuteState == TRUE ) tclkWaitDuration = INDEFINITE_WAIT; else tclkWaitDuration = WAIT_FOR_3_SEC; cPrevVolLevel = cCurVolLevel; if ( bAudioMuteState == TRUE ) { gprim_setfcol ( C_BACKMEDIUM ); } else { gprim_setfcol ( C_GREEN ); } mpeg_set_audio_volume ( cCurVolLevel ); iKeyScanCode = ReadKey ( CURSOR_OFF, tclkWaitDuration ); switch ( iKeyScanCode ) { case VOLUME_NEXT_KEY: case VOL_UP_CUM_RIGHT_ARROW_KEY: if ( bAudioMuteState == TRUE ) { bAudioMuteState = FALSE; mpeg_unmute_audio (); bPrintMessage = TRUE; } cCurVolLevel += VOLUME_STEP; if ( cCurVolLevel >= MAX_VOL_LEVEL ) cCurVolLevel = MAX_VOL_LEVEL; if ( cPrevVolLevel != MAX_VOL_LEVEL ) gprim_frect ( VOL_SLIDE_BOX_COL_START+5+(cCurVolLevel- MIN_VOL_LEVEL)*10, VOL_SLIDE_BOX_ROW_START+2, VOL_SLIDE_BOX_COL_START+5+(cCurVolLevel- MIN_VOL_LEVEL)*10+5, VOL_SLIDE_BOX_ROW_START+VOL_SLIDE_BOX_HEIGHT-4 ); break; case VOLUME_PREV_KEY: case VOL_DOWN_CUM_LEFT_ARROW_KEY: if ( bAudioMuteState == TRUE ) { bAudioMuteState = FALSE; mpeg_unmute_audio (); bPrintMessage = TRUE; } cCurVolLevel -= VOLUME_STEP; if ( cCurVolLevel < MIN_VOL_LEVEL ) cCurVolLevel = MIN_VOL_LEVEL; if ( cPrevVolLevel != MIN_VOL_LEVEL ) { gprim_setfcol ( C_TRANS ); gprim_frect ( VOL_SLIDE_BOX_COL_START+5+(cPrevVolLevel- MIN_VOL_LEVEL)*10, VOL_SLIDE_BOX_ROW_START+2, VOL_SLIDE_BOX_COL_START+5+(cPrevVolLevel- MIN_VOL_LEVEL)*10+5, VOL_SLIDE_BOX_ROW_START+VOL_SLIDE_BOX_HEIGHT-4 ); } break; case MUTE_KEY: if ( bAudioMuteState == TRUE ) { bAudioMuteState = FALSE; mpeg_unmute_audio (); } else { bAudioMuteState = TRUE; mpeg_mute_audio (); } bPrintMessage = TRUE; break; default: gprim_cls ( C_TRANS ); return iKeyScanCode; } } } void ShowVolumeIcon() { int j; int dim_x, dim_y; unsigned int *pel; int IabsX=VOL_ICON_COL; int IabsY=VOL_ICON_ROW; dim_x = VOL_ICON_DIMX ; dim_y = VOL_ICON_DIMY ; pel = (unsigned int *) VolumeIcon; /* Make the Transparent Mask - Color 0 is transparent */ for (j = 0; j < (dim_x * dim_y) /8; j++ ) { /* Transparency mask */ pel_mask[j] = ((pel[j] & 0xF0000000) != 0) << 7; pel_mask[j] |= ((pel[j] & 0x0F000000) != 0) << 6; pel_mask[j] |= ((pel[j] & 0x00F00000) != 0) << 5; pel_mask[j] |= ((pel[j] & 0x000F0000) != 0) << 4; pel_mask[j] |= ((pel[j] & 0x0000F000) != 0) << 3; pel_mask[j] |= ((pel[j] & 0x00000F00) != 0) << 2; pel_mask[j] |= ((pel[j] & 0x000000F0) != 0) << 1; pel_mask[j] |= ((pel[j] & 0x0000000F) != 0); } gprim_setpel(dim_x, dim_y, true, pel, pel_mask , 0, 0); gprim_pel(IabsX, IabsY); } /*}}}*/
![]() |
Similar Threads
- AJAX menu design help (JavaScript / DHTML / AJAX)
- How do I create a cool navigation menu using Adobe Photoshop? (HTML and CSS)
- How to send js variables with a ajax request (JavaScript / DHTML / AJAX)
- E-commerce data design issue (Database Design)
- Text based adventure game (Java)
- how to use mainmenu control in c# (C#)
- OK; Strange Question here (C#)
- Java Menu Help (Java)
Other Threads in the C++ Forum
- Previous Thread: Pushing a button via winapi
- Next Thread: what was your first program?
| Thread Tools | Search this Thread |
api array arrays beginner binary bitmap c++ c/c++ calculator char class classes code compile compiler console conversion convert count data database delete desktop developer directshow dll download dynamic encryption error file forms fstream function functions game generator getline givemetehcodez google graph gui homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux loop looping loops map math matrix memory multiple news node number output parameter pointer problem program programming project proxy python random read recursion recursive return string strings struct temperature template templates test text text-file tree unix url variable vector video visualstudio win32 windows winsock word wordfrequency wxwidgets






