Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define TITLE_SIZE 15
- MCV(bool) ready( cheat_cvar_s* val_a,cheat_cvar_s* val_x,cheat_cvar_s* val_y,cheat_cvar_s* val_w,cheat_cvar_s* val_h )
- {
- return ( val_a!=NULL&&val_x!=NULL&&val_y!=NULL&&val_w!=NULL&&val_h!=NULL&&val_a->GetBool() )
- ? true
- : false;
- }
- MCV(void) draw_rect( int x, int y, int w, int h, dword cololol )
- {
- if ( m_pExport )
- {
- m_pExport->FillRGBA(x,y-1,w+1,1,cololol); // top
- m_pExport->FillRGBA(x-1,y-1,1,h+1,cololol); // bottom
- m_pExport->FillRGBA(x,y+h,w,1,cololol); // left
- m_pExport->FillRGBA(x+w,y,1,h+1,cololol); // right
- }
- }
- MCV(void) draw_move( __int32& x_off,__int32 &y_off, bool &moving, cheat_cvar_s* val_a,cheat_cvar_s* val_x,cheat_cvar_s* val_y,cheat_cvar_s* val_w,cheat_cvar_s* val_h )
- {
- if ( !ready(val_a,val_x,val_y,val_w,val_h) )
- {
- return;
- }
- if ( m_pExport->_mouse__over(val_x->GetInt(), val_y->GetInt() - TITLE_SIZE, val_w->GetInt(), TITLE_SIZE ) )
- {
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_ARROW_RIGHT_LEFT_UP_DOWN;
- if ( m_pExport->M1A_Pressed )
- {
- x_off = m_pExport->m_X - val_x->GetInt();
- y_off = m_pExport->m_Y - val_y->GetInt();
- moving = true;
- }
- }
- if ( moving == true )
- {
- int xxx = m_pExport->m_X - x_off;
- int yyy = m_pExport->m_Y - y_off;
- val_x->SetValue((xxx < 0) ? 0 : (xxx<m_pExport->ScreenW) ? xxx : (m_pExport->ScreenW - val_w->GetInt()));
- val_y->SetValue((yyy < 0) ? 0 : (yyy<m_pExport->ScreenH) ? yyy : (m_pExport->ScreenH - val_h->GetInt()));
- if ( !m_pExport->M1A_Pressed && moving == true )
- {
- moving = false;
- }
- }
- }
- MCV(void) draw_size( __int32& w_off,__int32 &h_off, bool &__www, bool &__hhh, bool &__wwhh, cheat_cvar_s* val_a,cheat_cvar_s* val_x,cheat_cvar_s* val_y,cheat_cvar_s* val_w,cheat_cvar_s* val_h )
- {
- if ( !ready(val_a,val_x,val_y,val_w,val_h) )
- {
- return;
- }
- // Drag W
- if ( m_pExport->_mouse__over(val_x->GetInt()+val_w->GetInt()-1,val_y->GetInt(),4,val_h->GetInt()-10))
- {
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_ARROW_RIGHT_LEFT;
- if ( m_pExport->M1A_Pressed )
- {
- w_off = m_pExport->m_X - val_w->GetInt();
- __www = true;
- }
- }
- if ( __www == true )
- {
- int www = m_pExport->m_X - w_off;
- val_w->SetValue( www <= val_w->GetMinValue() ? val_w->GetMinValue() : www );
- if ( !m_pExport->M1A_Pressed && __www == true)
- {
- __www = false;
- }
- }
- // Drag H
- if ( m_pExport->_mouse__over(val_x->GetInt(),val_y->GetInt()+val_h->GetInt()-1,val_w->GetInt()-10,4))
- {
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_ARROW_DOWN;
- if ( m_pExport->M1A_Pressed )
- {
- h_off = m_pExport->m_Y - val_h->GetInt();
- __hhh = true;
- }
- }
- if ( __hhh == true )
- {
- int hhh = m_pExport->m_Y - h_off;
- val_h->SetValue( hhh <= val_h->GetMinValue() ? val_h->GetMinValue() : hhh );
- if ( !m_pExport->M1A_Pressed && __hhh == true)
- {
- __hhh = false;
- }
- }
- // Drag W/H
- if ( m_pExport->_mouse__over(val_x->GetInt()+val_w->GetInt()-10,val_y->GetInt()+val_h->GetInt()-10,11,11))
- {
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_LEFT;
- if ( m_pExport->M1A_Pressed )
- {
- w_off = m_pExport->m_X - val_w->GetInt();
- h_off = m_pExport->m_Y - val_h->GetInt();
- __wwhh = true;
- }
- }
- if ( __wwhh == true )
- {
- int www = m_pExport->m_X - w_off;
- int hhh = m_pExport->m_Y - h_off;
- val_w->SetValue( www <= val_w->GetMinValue() ? val_w->GetMinValue() : www );
- val_h->SetValue( hhh <= val_h->GetMinValue() ? val_h->GetMinValue() : hhh );
- if ( !m_pExport->M1A_Pressed && __wwhh == true )
- {
- __wwhh = false;
- }
- }
- }
- MCV(void) draw_form( cheat_cvar_s* val_a,cheat_cvar_s* val_x,cheat_cvar_s* val_y,cheat_cvar_s* val_w,cheat_cvar_s* val_h, dword dwBorderColor, dword dwTitleColor, dword dwBackColor, dword dwTextColor, cpchar pszTitle )
- {
- if ( !ready(val_a,val_x,val_y,val_w,val_h) )
- {
- return;
- }
- int title_x = val_x->GetInt();
- int title_y = val_y->GetInt() - (TITLE_SIZE+2);
- int title_w = val_w->GetInt();
- int title_h = TITLE_SIZE;
- //////////////////////////////////////////////////////////////////////////
- // TitleBar Border Draw
- // draw_rect(
- // title_x-1,
- // title_y-1,
- // title_w+2,
- // title_h+2,
- // dwBorderColor );
- draw_rect(
- title_x,
- title_y,
- title_w,
- title_h,
- dwBorderColor );
- // TitleBar BackGround Draw
- m_pExport->FillRGBA(
- title_x,
- title_y,
- title_w,
- title_h,
- dwTitleColor );
- //////////////////////////////////////////////////////////////////////////
- // TitleBar title
- if ( pszTitle && pszTitle[0] )
- {
- m_pExport->draw_string(false,title_x+5,title_y+1,dwTextColor,"%s",pszTitle);
- }
- //////////////////////////////////////////////////////////////////////////
- // Border Draw
- // draw_rect(
- // val_x->GetInt()-1,
- // val_y->GetInt()-1,
- // val_w->GetInt()+2,
- // val_h->GetInt()+2,
- // dwBorderColor );
- draw_rect(
- val_x->GetInt(),
- val_y->GetInt(),
- val_w->GetInt(),
- val_h->GetInt(),
- dwBorderColor );
- // BackGround Draw
- m_pExport->FillRGBA(
- val_x->GetInt(),
- val_y->GetInt(),
- val_w->GetInt(),
- val_h->GetInt(),
- dwBackColor );
- //////////////////////////////////////////////////////////////////////////
- // close button
- uint32
- _closeX=val_x->GetInt() + (val_w->GetInt() - 15),
- _closeY=val_y->GetInt() - TITLE_SIZE;
- dword dwCloseColors = dwTextColor;
- if ( m_pExport->_mouse__over(_closeX,_closeY,10,10) )
- {
- // if hoovering, red-it
- dwCloseColors = DWORD_RGBA(255,0,0,255);
- // show dem user, cliks
- m_pExport->imouse_type = base_hack::_MOUSE_HAND;
- if ( m_pExport->M1A_Pressed )
- {
- // close the window
- val_a->SetValue( 0 );
- }
- }
- // button like border
- draw_rect(_closeX,_closeY,10,10,dwBorderColor);
- // x letter, color swap at hovering
- m_pExport->draw_string(false,_closeX + 2,_closeY - 2,dwCloseColors,"X");
- }
- MCV(void) _draw_mouse( void )
- {
- if ( !m_pExport->bMouseActive )
- {
- return;
- }
- uint32 x = m_pExport->m_X;
- uint32 y = m_pExport->m_Y;
- dword mouse_cc = m_pExport->GetColorByIdx( 3 )->dwGetColor_rgba(); // white
- dword border_o = m_pExport->GetColorByIdx( 4 )->dwGetColor_rgba(); // black
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_CURSOR )
- {
- m_pExport->FillRGBA( x-1,y-1,1,12 ,border_o);
- m_pExport->FillRGBA( x,y-1,1,1 ,border_o);
- m_pExport->FillRGBA( x,y,1,10 ,mouse_cc);
- m_pExport->FillRGBA( x, y+10,1,1 ,border_o);
- m_pExport->FillRGBA( x+1,y,1,1 ,border_o);
- m_pExport->FillRGBA( x+1,y+1,1,8 ,mouse_cc);
- m_pExport->FillRGBA( x+1,y+9,1,1 ,border_o);
- m_pExport->FillRGBA( x+2,y+1,1,1 ,border_o);
- m_pExport->FillRGBA( x+2,y+2,1,6 ,mouse_cc);
- m_pExport->FillRGBA( x+2,y+8,1,1 ,border_o);
- m_pExport->FillRGBA( x+3,y+2,1,1 ,border_o);
- m_pExport->FillRGBA( x+3,y+3,1,6 ,mouse_cc);
- m_pExport->FillRGBA( x+3,y+9,1,2 ,border_o);
- m_pExport->FillRGBA( x+4,y+3,1,1 ,border_o);
- m_pExport->FillRGBA( x+4,y+4,1,7 ,mouse_cc);
- m_pExport->FillRGBA( x+4,y+11,1,2 ,border_o);
- m_pExport->FillRGBA( x+5,y+4,1,1 ,border_o);
- m_pExport->FillRGBA( x+5,y+5,1,2 ,mouse_cc);
- m_pExport->FillRGBA( x+5,y+7,1,2 ,border_o);
- m_pExport->FillRGBA( x+5,y+9,1,4 ,mouse_cc);
- m_pExport->FillRGBA( x+5,y+13,1 ,1,border_o);
- m_pExport->FillRGBA( x+6,y+5,1 ,1,border_o);
- m_pExport->FillRGBA( x+6,y+6,1,1 ,mouse_cc);
- m_pExport->FillRGBA( x+6,y+7,1,1 ,border_o);
- m_pExport->FillRGBA( x+6,y+9,1,2 ,border_o);
- m_pExport->FillRGBA( x+6,y+11,1,2 ,mouse_cc);
- m_pExport->FillRGBA( x+6,y+13,1,1 ,border_o);
- m_pExport->FillRGBA( x+7, y+6,1,2 ,border_o);
- m_pExport->FillRGBA( x+7,y+11,1,2 ,border_o);
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_ARROW_UP )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_ARROW_DOWN )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_ARROW_RIGHT_LEFT )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_ARROW_RIGHT_LEFT_UP_DOWN )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_EDIT )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_HAND )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_RIGHT )
- {
- // diy
- }
- if ( m_pExport->imouse_type == base_hack::gui_cursor_type::_MOUSE_LEFT )
- {
- // diy
- }
- }
- struct _button
- {
- char text[128];
- // void _C cb( void );
- pvoid _callback;
- MCV(void) init( pchar title )
- {
- _callback = NULL;
- tools::_sprintf(text,"%s",title);
- }
- MCV(void) draw( uint32 x, uint32 y, uint32 w, uint32 h, dword dwBorder, dword dwBackground, dword dwText, dword dwSelected )
- {
- // cliks
- if ( _callback != NULL )
- {
- if ( m_pExport->_mouse__over(x,y,w,h) )
- {
- //selection coloring
- //selection rectangle arround the line
- //in case the guy isnt sure he is on good line
- dwBackground = dwSelected;
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_HAND;
- //send command
- static bool once = false;
- if ( !once && m_pExport->M1A_Pressed )
- {
- once = true;
- try
- {
- ((void (_C*)())(_callback))();
- }
- catch (...)
- {
- tools::speak( "_button (%s@"FMT_ADDRESS") -C-R-A-S-H-E-D-" __FUNCTION__, text, _callback );
- }
- }
- else
- {
- if ( once && !m_pExport->M1A_Pressed )
- {
- once = false;
- }
- }
- }
- }
- // TitleBar Border Draw
- draw_rect(x-1, y-1, w+2, h+2, dwBorder );
- // TitleBar BackGround Draw
- m_pExport->FillRGBA( x, y, w, h, dwBackground );
- // draw title
- m_pExport->draw_string( false, x+2,y+2,dwText, text );
- }
- };
- struct _input_box
- {
- struct _inlines
- {
- char line[1024];
- };
- // how many stored lines & actual line (input)
- int Scroll_i,Count_i;
- // current input
- _inlines textInput;
- // stored line list (input)
- _inlines * MUTPTR previous; // _inlines[256];
- MCV(void) init( void )
- {
- previous = new _inlines[256];
- erase_content();
- }
- MCV(void) draw_input( uint32 x, uint32 y, uint32 w, uint32 h, dword dwInput, dword dwText )
- {
- if ( m_pExport->_mouse__over( x, y, w, h ))
- {
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_EDIT;
- dwInput = DWORD_RGBA(RED(dwInput),0,BLUE(dwInput),255);
- }
- // Input BackGround Draw
- m_pExport->FillRGBA( x, y, w, h, dwInput );
- // input text
- m_pExport->draw_string( false,x, y, dwText, textInput.line );
- }
- // hello world
- MCV(void) erase_content(void)
- {
- Scroll_i = Count_i = 0;
- tools::fillmem(previous,0,sizeof(_inlines) * 256);
- }
- MCV(void) HandleKeyBoard( int uMsg, WPARAM wParam, LPARAM )
- {
- // dont overflow
- if ( Count_i >= 255 ) {
- erase_content();
- }
- switch( uMsg )
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- switch(wParam)
- {
- case VK_UP:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- Scroll_i = _clamp<int>(Scroll_i - 1,0,Count_i-1);
- textInput = previous[Scroll_i];
- break;
- }
- case VK_DOWN:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- Scroll_i = _clamp<int>(Scroll_i + 1,0,Count_i-1);
- textInput = previous[Scroll_i];
- break;
- }
- case VK_HOME:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- Scroll_i = _clamp<int>(Count_i - 1,0,Count_i-1);
- textInput = previous[Scroll_i];
- break;
- }
- case VK_END:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- Scroll_i = 0;
- textInput = previous[Scroll_i];
- break;
- }
- case VK_NEXT:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- // PG UP
- Scroll_i = _clamp<int>(Scroll_i - 10,0,Count_i-1);
- textInput = previous[Scroll_i];
- break;
- }
- case VK_PRIOR:
- {
- if ( Count_i <= 0 )
- {
- tools::_sprintf(textInput.line,"");
- break;
- }
- // PG DOWN
- Scroll_i = _clamp<int>(Scroll_i + 10,0,Count_i-1);
- textInput = previous[Scroll_i];
- break;
- }
- case VK_SPACE:
- {
- char tmp[2048];
- tools::_sprintf(tmp,"%s \0",textInput.line);
- tools::_sprintf(textInput.line,"%s\0",tmp);
- break;
- }
- case VK_BACK:
- {
- if ( !textInput.line[0] )
- {
- break;
- }
- uint32 len = tools::_strlen( textInput.line );
- if ( !len )
- {
- break;
- }
- textInput.line[len - 1] = 0;
- break;
- }
- case VK_RETURN:
- {
- if ( !textInput.line[0] )
- {
- break;
- }
- uint32 len = tools::_strlen( textInput.line );
- if ( !len )
- {
- break;
- }
- // put to list in case wanna re-use
- previous[Count_i++] = textInput;
- // move
- Scroll_i = _clamp<int>(Scroll_i - 1,0,Count_i-1);
- // call stub
- m_pExport->ParseLine( textInput.line );
- // reset
- tools::fillmem(&textInput,0,sizeof(textInput));
- break;
- }
- default:
- {
- char m_vecKp[0x2];
- tools::fillmem(&m_vecKp,0,sizeof(m_vecKp));
- byte m_vecKs[256];
- tools::fillmem(&m_vecKs,0,sizeof(m_vecKs));
- if ( GetKeyboardState( m_vecKs ) )
- {
- if ( ToAsciiEx( wParam, 0, m_vecKs, (LPWORD)m_vecKp, 0, 0 ) >= 1 )
- {
- char tmp[2048];
- tools::_sprintf(tmp,"%s%s\0",textInput.line,m_vecKp);
- tools::_sprintf(textInput.line,"%s\0",tmp);
- break;
- }
- }
- }
- }
- break;
- }
- }
- }
- };
- struct _output_box
- {
- struct _outlines
- {
- char _line[PAGESIZE];
- };
- // how many stored lines & actual line (output)
- int Scroll_o,Count_o;
- // stored line list (output)
- _outlines * MUTPTR vPrintLines;// _outlines[4096];
- // used for cliking on line,
- // void _C callback( uint32 index );
- pvoid line_function_ptr;
- MCV(void) init( void )
- {
- vPrintLines = new _outlines[4096];
- line_function_ptr = NULL;
- Scroll_o = Count_o = 0;
- }
- MCV(void) draw_output( uint32 x, uint32 y, uint32 w, uint32 h, dword dwOutput, dword dwSelected )
- {
- // Output BackGround Draw
- m_pExport->FillRGBA(x,y,w,h,dwOutput );
- int iactual_scroll = (Count_o/* - 1*/) - Scroll_o;
- int _line_x = x + 1;
- int _line_y = y + (h - ((m_pExport->m_nHUDHeight*2) + 4));
- // avoid spam
- static bool executed = false;
- while ( --iactual_scroll >= 0 )
- {
- if( _line_y <= y + 5 )
- {
- break;
- }
- //selection coloring and clik handle
- if ( line_function_ptr != NULL )
- {
- if ( m_pExport->_mouse__over(_line_x,_line_y,w,m_pExport->m_nHUDHeight) )
- {
- //selection coloring
- //selection rectangle arround the line
- //in case the guy isnt sure he is on good line
- m_pExport->imouse_type = base_hack::gui_cursor_type::_MOUSE_HAND;
- m_pExport->FillRGBA(_line_x,_line_y,w, m_pExport->m_nHUDHeight, dwSelected );
- //send command
- static bool once = false;
- if ( !once && m_pExport->M1A_Pressed )
- {
- once = true;
- try
- {
- ((void (_C*)(uint32))(line_function_ptr))( iactual_scroll );
- }
- catch (...)
- {
- tools::speak( "_output_box (%i@"FMT_ADDRESS") -C-R-A-S-H-E-D-" __FUNCTION__, iactual_scroll,line_function_ptr );
- }
- }
- else
- {
- if ( once && !m_pExport->M1A_Pressed )
- {
- once = false;
- }
- }
- }
- }
- // text yay
- m_pExport->draw_string_fmt( w - 4, _line_x, _line_y, vPrintLines[iactual_scroll]._line );
- _line_y -= m_pExport->m_nHUDHeight;
- };
- }
- // hello world
- MCV(void) erase_content(void)
- {
- Scroll_o = Count_o = 0;
- tools::fillmem(vPrintLines,0,sizeof(_outlines) * 4096);
- }
- MCV(void) Printf(pchar szText, ... )
- {
- if ( !vPrintLines )
- {
- return;
- }
- if ( Count_o >= 4095 ) {
- erase_content();
- }
- _outlines m_szBufA = {
- "input is off limits too small or big."
- };
- uint32 len = _vsprintf(m_szBufA._line,szText,(va_list)&szText + _INTSIZEOF(szText));
- if ( len < 1
- || len >= (PAGESIZE-1) )
- {
- vPrintLines[Count_o++] = m_szBufA;
- return;
- }
- m_szBufA._line[ len ] = 0;
- pchar nexttab = tools::_strstr(m_szBufA._line,"\t");
- if ( nexttab )
- {
- char tmp0[PAGESIZE];
- char tmp1[PAGESIZE];
- nexttab[0] = 0;
- tools::_sprintf(tmp0,"%s",m_szBufA._line);
- tools::_sprintf(tmp1,"%s",&nexttab[1]);
- Printf("%s %s",tmp0,tmp1);
- return;
- }
- pchar nextlin3 = tools::_strstr(m_szBufA._line,"\n");
- if ( nextlin3 )
- {
- char tmp0[PAGESIZE];
- char tmp1[PAGESIZE];
- nextlin3[0] = 0;
- tools::_sprintf(tmp0,"%s",m_szBufA._line);
- tools::_sprintf(tmp1,"%s",&nextlin3[1]);
- // space for incase it's just a next line,
- Printf("%s",tmp0); // first one
- Printf("%s",tmp1); // next one
- return;
- }
- pchar nextline = tools::_strstr(m_szBufA._line,"\r\n");
- if ( nextline )
- {
- char tmp0[PAGESIZE];
- char tmp1[PAGESIZE];
- nextline[0] = 0;
- nextline[1] = 0;
- tools::_sprintf(tmp0,"%s",m_szBufA._line);
- tools::_sprintf(tmp1,"%s",&nextline[2]);
- // space for incase it's just a next line,
- Printf("%s ",tmp0); // first one
- Printf("%s",tmp1); // next one
- return;
- }
- //add to list or fresh list
- vPrintLines[Count_o++] = m_szBufA;
- return;
- }
- MCV(void) Printf(pwchar szText, ... )
- {
- wchar_t m_szBufW[PAGESIZE];
- m_szBufW[vswprintf(m_szBufW,szText,(va_list)(wchar_t*)&szText + _INTSIZEOF(szText))] = 0;
- static char m_szBufA[PAGESIZE * 2];
- if ( !CharToOemW(m_szBufW,m_szBufA) )
- {
- return;
- }
- Printf(m_szBufA);
- }
- MCV(void) HandleScrolling( int uMsg, WPARAM wParam, LPARAM )
- {
- switch( uMsg )
- {
- case WM_KEYDOWN:
- case WM_SYSKEYDOWN:
- {
- switch(wParam)
- {
- case VK_END:
- {
- Scroll_o = 0;
- break;
- }
- case VK_HOME:
- {
- Scroll_o = _clamp<int>(Count_o-1,0,Count_o-1);
- break;
- }
- case VK_UP:
- {
- // Scrool UP ==> mouse
- Scroll_o = _clamp<int>(Scroll_o - 1,0,Count_o-1);
- break;
- }
- case VK_DOWN:
- {
- // Scrool DOWN ==> mouse
- Scroll_o = _clamp<int>(Scroll_o + 1,0,Count_o-1);
- break;
- }
- case VK_NEXT:
- {
- // PG UP
- Scroll_o = _clamp<int>(Scroll_o - 10,0,Count_o-1);
- break;
- }
- case VK_PRIOR:
- {
- // PG DOWN
- Scroll_o = _clamp<int>(Scroll_o + 10,0,Count_o-1);
- break;
- }
- default:
- {
- break;
- }
- }
- break;
- }
- case WM_MOUSEWHEEL:
- {
- if ( GET_WHEEL_DELTA_WPARAM( wParam ) > 0 )
- {
- // Scrool UP ==> mouse wheel
- Scroll_o = _clamp<int>(Scroll_o + 3,0,Count_o-1);
- }
- else
- {
- // Scrool DOWN ==> mouse wheel
- Scroll_o = _clamp<int>(Scroll_o - 3,0,Count_o-1);
- }
- break;
- }
- }
- }
- };
- struct _slider_vert
- {
- bool drag_SV,is_value_changed;
- uint32 current_value,min_value,max_value;
- dword degrade_start,degrade_finish;
- MCV(void) init( uint32 _val, uint32 _min, uint32 _max )
- {
- drag_SV = false;
- is_value_changed = false;
- current_value = _val;
- degrade_start = min_value = _min;
- degrade_finish = max_value = _max;
- }
- MCV(void) draw( uint32 _x, uint32 _y, dword dwBorder, dword dwBack )
- {
- //reset
- is_value_changed = false;
- int real_x = _x;
- int real_y = _y;
- int x_off = 0;
- int y_off = 0;
- // Line
- m_pExport->draw_2d_box( real_x,real_y,2,max_value , dwBorder );
- m_pExport->FillRGBA( real_x,real_y,2,max_value , dwBack );
- // Cursor
- m_pExport->draw_2d_box( real_x-3,real_y-3+current_value,8,4,dwBorder );
- m_pExport->FillRGBA( real_x-3,real_y-3+current_value,8,4,dwBack );
- drag_SV = m_pExport->_mouse1_lock(real_x-3,real_y,7,max_value);
- if ( drag_SV )
- {
- int yY = m_pExport->m_Y - real_y;
- current_value = yY;
- if ( m_pExport->_mouse1_lock(real_x-3,real_y+current_value-4,13,7) )
- {
- y_off = m_pExport->m_Y - current_value;
- is_value_changed = true;
- }
- int newY = m_pExport->m_Y - y_off;
- //bound to min/max
- current_value = newY;
- current_value = _clamp( current_value, min_value, max_value );
- }
- }
- };
- struct _slider_horiz
- {
- bool drag_SH,is_value_changed;
- uint32 current_value,min_value,max_value;
- dword degrade_start,degrade_finish;
- MCV(void) init( uint32 _val, uint32 _min, uint32 _max )
- {
- drag_SH = false;
- is_value_changed = false;
- current_value = _val;
- degrade_start = min_value = _min;
- degrade_finish = max_value = _max;
- }
- MCV(void) draw( uint32 _x, uint32 _y, dword dwBorder, dword dwBack )
- {
- //reset
- is_value_changed = false;
- int real_x = _x;
- int real_y = _y;
- int x_off = 0;
- int y_off = 0;
- //////////////////////////////////////////////////////////////////////////
- // Line
- m_pExport->draw_2d_box( real_x,real_y,max_value,2,dwBorder );
- m_pExport->FillRGBA( real_x,real_y,max_value,2,dwBack );
- //////////////////////////////////////////////////////////////////////////
- // Cursor
- m_pExport->draw_2d_box( real_x + current_value,real_y-3,4,8,dwBorder );
- m_pExport->FillRGBA( real_x + current_value,real_y-3,4,8,dwBack );
- //////////////////////////////////////////////////////////////////////////
- drag_SH = m_pExport->_mouse1_lock(real_x,real_y-3,max_value,7);
- if ( drag_SH )
- {
- current_value = m_pExport->m_X - real_x;
- if ( m_pExport->_mouse1_lock(real_x+current_value-2,real_y-6,6,13) )
- {
- x_off = m_pExport->m_X - current_value;
- is_value_changed = true;
- }
- int newX = m_pExport->m_X - x_off;
- //bound to min/max
- current_value = newX;
- current_value = _clamp(current_value,min_value,max_value);
- }
- }
- };
- struct _checkbox
- {
- // untested (no gui items use 'em)
- // todo: use 'em
- bool is_checked;
- MCV(void) init( bool initial_value )
- {
- is_checked = initial_value;
- }
- MCV(void) draw( uint32 x, uint32 y, dword dwBorder, dword dwBack, dword dwCheck, dword dwText, pchar title )
- {
- // Backround
- m_pExport->draw_2d_box(x,y,12,12,dwBorder);
- m_pExport-> FillRGBA(x,y,12,12,dwBack);
- // V
- if ( is_checked )
- {
- m_pExport->FillRGBA(x+3,y+5,1,3,dwCheck);
- m_pExport->FillRGBA(x+4,y+6,1,3,dwCheck);
- m_pExport->FillRGBA(x+5,y+7,1,3,dwCheck);
- m_pExport->FillRGBA(x+6,y+6,1,3,dwCheck);
- m_pExport->FillRGBA(x+7,y+5,1,3,dwCheck);
- m_pExport->FillRGBA(x+8,y+4,1,3,dwCheck);
- m_pExport->FillRGBA(x+9,y+3,1,3,dwCheck);
- }
- // Title
- if ( title && title[0] )
- {
- m_pExport->draw_string(false,x+16,y,dwText, "%s",title );
- }
- // clik
- static bool __once = false;
- if ( m_pExport->_mouse__over(x,y,20,20) )
- {
- if ( !__once && m_pExport->M1A_Pressed )
- {
- is_checked = !is_checked;
- __once = true;
- }
- }
- else
- {
- if ( __once && !m_pExport->M1A_Pressed )
- {
- __once = false;
- }
- }
- }
- };
- struct _static
- {
- // untested (no gui items use 'em)
- // todo: use 'em
- char text[256];
- MCV(void) init( pchar title )
- {
- if ( title && title[0] )
- {
- tools::_sprintf(text,"%s",title);
- }
- }
- MCV(void) draw( uint32 x, uint32 y, uint32 w, uint32 h, dword dwBack, dword dwText )
- {
- draw_rect(x,y,w,h,dwBack);
- m_pExport->draw_string(false,x+15,y,dwText,"%s",text);
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment