Jump to content
Welcome, Guest
Existing user? Sign In

Sign In



Sign Up
The MatriX
  • Welcome To Ghbsys
  • CS GO Streaming Version is released. Have fun streaming while cheating!
  • Have a Payment Issue? Send us a Support ticket.
  • Make a thread if you need support or join our discord for live support.
  • Have Suggestions? Make a thread and you'll earn Ghbsys Points for implemented suggestions.
  • Join our discord to stay well connected! Don't forget to integrate your discord to the site
  • Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum

    Welcome to [GHB] - GAmEhAcKbAsTaRdS Forum, like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be apart of [GHB] - GAmEhAcKbAsTaRdS Forum by signing in or creating an account.
    • Start new topics and reply to others
    • Subscribe to topics and forums to get email updates
    • Get your own profile page and make new friends
    • Send personal messages to other members.

    Hans211 menu question


    namek303
     Share

    Recommended Posts

    I am having a issue with hans211 d3d based menu. with it shadows are actually rendered from the game menu itself.

    Also if i turn on the ingame bloom affect the seccond screen shot shows what happens. Any idea why?

     

    before.jpg

     

    after.jpg

     

     

    Here is the 2 parts of the source code that handle it

     

    First is d3dmenu.cpp

    //	Project : Basic D3D Menu v1.2
    //	Author	: Hans211
    //	Date	: 4 April 2008
    //
    //	Credits : Game-Deception for their info and support
    //	
    //	Tools used:
    //		Microsoft Visual Studio c++ 6.0
    //		DirectX9 SDK Update (summer 2004)
    //		D3Dfont.cpp
    //
    //	Features: 
    //		Use Insert key to show/hide menu
    //		Use up and down arrow keys to manouvre through the menuitems
    //		Use left and right arrow keys to toggle menuitems
    //		Items can have multiple custom states like: "Off" "On"  or "Head" "Neck" "Spine"
    //		Support for textonly items
    //		Support for folder style items
    //
    //  Changes:
    //	1.2	Thx to DXT-Wieter20 for pointing this out
    //			Check for left and right key first and then if value is within range
    //
    #include "d3dmenu.h"
    
    char		Mtitle[81]="";	  // Some room for a title
    int 		Mpos=0;			  // current highlighted menuitem	
    int 		Mmax=0;			  // number of menu items
    int			Mxofs =160;	  // offset for option text
    int			Mysize=14;	  // heigh of a menuline
    int			Mvisible=1;
    
    // predifine some basic options
    char		*Moptfolder[] = { "+"  , "-" };	
    char		*Moptonoff[]  = { "Off", "On"};
    bool menulock = false;
    
     RECT rect;
     RECT rect2;
     RECT rect3;
    struct {
     int  typ;		  // type of menuline, folder, item
     char *txt;	  // text to show
     char **opt;	  // array of options
     int  *var;	  // variable containing current status
     int  maxvalue;  // maximumvalue,  normally 1  gives  0=off  1=on
    } MENU[MENUMAXITEMS];
    
    
    void MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ)
    {
     MENU[Mmax].typ=typ;
     MENU[Mmax].txt=txt;
     MENU[Mmax].opt=opt;
     MENU[Mmax].var=var;
     MENU[Mmax].maxvalue=maxvalue;
     Mmax++;
    }
    
    void MenuShow(int x, int y,	ID3DXFont *pFont)
    {
    
     int i, val;
     DWORD color;
    SetRect( &rect, x+Mxofs/2, y, x+Mxofs /2 , y );
     if (!Mvisible) return;
    
     if (Mtitle[0]) {
    
      pFont->DrawText(NULL,Mtitle,-1,&rect,DT_NOCLIP | DT_CENTER, MCOLOR_TITLE);
    
      y+=Mysize;
     }
     for (i=0; i<Mmax; i++) {
       val=(MENU[i].var)?(*MENU[i].var):0;
       // determine color
       if (i==Mpos)
    	   color=MCOLOR_CURRENT;
       else if (MENU[i].typ==MENUFOLDER)
    	   color=MCOLOR_FOLDER;
       else if (MENU[i].typ==MENUTEXT)
    	   color=MCOLOR_TEXT;
       else
    	   color=(val)?MCOLOR_ACTIVE:MCOLOR_INACTIVE;
     SetRect( &rect3, x, y, x , y );
     SetRect( &rect2, x+Mxofs, y, x+Mxofs , y );
       pFont->DrawText(NULL,MENU[i].txt,-1,&rect3, DT_NOCLIP,color);
       if (MENU[i].opt) {
    	   if (MENU[i].typ==MENUTEXT)
    	   	   pFont->DrawText(NULL,(char *)MENU[i].opt,-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
    
    	   else
    		   pFont->DrawText(NULL,(char *)MENU[i].opt[val],-1,&rect2, DT_NOCLIP | DT_RIGHT, color);
       }
       y+=Mysize;
     }
    }
    
    void MenuNav(void)
    {
     if (GetAsyncKeyState(VK_INSERT)&1) Mvisible=(!Mvisible);
     if (!Mvisible) return;
    
    
     if ((GetAsyncKeyState(VK_END)&1)){
    
      if(menulock == false){ 	
    	  menulock = true;}else{
    		  menulock = false; }
     }
    
     if ((GetAsyncKeyState(VK_UP)&1) && (menulock == false)) {
    	do {
    		Mpos--;
    		if (Mpos<0)  Mpos=Mmax-1;
    	} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
     } else if ((GetAsyncKeyState(VK_DOWN)&1) && (menulock == false)) {
    	do {
    		Mpos++;
    		if (Mpos==Mmax) Mpos=0;
    	} while (MENU[Mpos].typ==MENUTEXT);		// skip textitems
     } else if (MENU[Mpos].var) {
    	int dir=0;
    	// bugfix: thx to Dxt-Wieter20
    	if ((GetAsyncKeyState(VK_LEFT )&1) && (*MENU[Mpos].var > 0) && (menulock == false)) dir=-1;
    	if ((GetAsyncKeyState(VK_RIGHT)&1) && (*MENU[Mpos].var < (MENU[Mpos].maxvalue-1)) && (menulock == false)) dir=1;
    	if (dir) {
    		*MENU[Mpos].var += dir;
    		if (MENU[Mpos].typ==MENUFOLDER) Mmax=0;  // change on menufolder, force a rebuild
    	}
     }
    
    
    }

     

     

     

     

     

    Seccond part is d3dmenu.h

     

    //	Project : Basic D3D Menu v1.1
    //	Author	: Hans211
    //	Date	: 4 April 2008
    
    #ifndef _D3DMENU_H
    #define _D3DMENU_H
    
    #define WIN32_LEAN_AND_MEAN
    #include <windows.h>
    #include <d3d9.h>
    #include <d3dx9.h>
    #ifndef D3DFONT_RIGHT
    #define D3DFONT_RIGHT		0x0008
    #endif
    
    #define 	MENUMAXITEMS	100
    
    #define 	MENUFOLDER		1
    #define 	MENUTEXT		2
    #define 	MENUITEM		3
    
    // Colors are here in ARGB in hex Alpha Red Green Blue  so : 0xff00ff00  is green :)
    #define	 MCOLOR_TITLE	0xffcc0000
    #define	 MCOLOR_CURRENT	0xff00ff00
    #define	 MCOLOR_FOLDER	0xffffff00
    #define	 MCOLOR_TEXT		0xffe0e0e0
    #define	 MCOLOR_INACTIVE	0xffa0a0a0
    #define	 MCOLOR_ACTIVE	0xffffffff
    
    extern int 		Mpos;				// current highlighted menuitem	
    extern int 		Mmax;				// number of menu items
    extern int		Mxofs;				// offset for option text
    extern int		Mysize;				// heigh of a menuline
    extern char		Mtitle[81];			// some menu title
    extern int		Mvisible;
    
    extern char		*Moptfolder[];		// "+"  , "-"
    extern char		*Moptonoff[];		// "Off", "On"
    
    void MenuAddItem(char *txt, char **opt, int *var, int maxvalue, int typ);
    void MenuShow(int x, int y,	ID3DXFont* pFont);
    void MenuNav(void);
    
    #endif

     

     

    I'm scratching my head on why it shows up in shadow and reflections in water and also if i enable bloom. ANY help is this issue is welcome and thanks

    Edited by namek303
    Link to comment
    Share on other sites

    Guest
    This topic is now closed to further replies.
     Share

    • Recently Browsing   0 members

      • No registered users viewing this page.
    ×
    ×
    • Create New...