📄 gsg_uieditor.cpp
字号:
// GSG_UIEditor.cpp: implementation of the GSG_UIEditor class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "gstools.h"
#include "GSG_UIEditor.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
GSG_UIEditor::GSG_UIEditor(CGsEngine* pEngine)
:CGsGame(pEngine)
{
m_key_style = "GSG_UIEditor";
CGsFunc::UI_SetEditMode(TRUE);
GetMainUI()->Create(/*"E:\\NetGame\\Client\\RUN\\Data\\UI\\sample1\\main.ini");//*/g_pWizard->GetCurrentItemPath());
m_active_ui = NULL;
m_active_ui = GetMainUI();
dlg_tools.Create(this);
}
GSG_UIEditor::~GSG_UIEditor()
{
GetMainUI()->SaveConfig();
CGsFunc::UI_SetEditMode(FALSE);
}
LRESULT GSG_UIEditor::MsgProc( UINT uMsg, WPARAM wParam, LPARAM lParam )
{
return CGsGame::MsgProc( uMsg, wParam, lParam );
}
ID GSG_UIEditor::OnMouseMove(UINT nFlags, GPOINT point)
{
return CGsGame::OnMouseMove(nFlags, point);
}
ID GSG_UIEditor::OnLButtonDown( UINT nFlags, GPOINT point )
{
ID idRet = CGsGame::OnLButtonDown( nFlags, point );
m_active_ui = m_pEngine->FindUIFromID(idRet);
if(NULL==m_active_ui)
m_active_ui = GetMainUI();
return idRet;
}
ID GSG_UIEditor::OnLButtonUp( UINT nFlags, GPOINT point )
{
return CGsGame::OnLButtonUp( nFlags, point );
}
ID GSG_UIEditor::OnLButtonDbClk( UINT nFlags, GPOINT point )
{
ID idRet = CGsGame::OnLButtonDbClk( nFlags, point );
CGsUIPanel* p_ui = m_pEngine->FindUIFromID(idRet);
if(p_ui)
{
CSheetUI sheet_ui("界面设置");
sheet_ui.SetUI(p_ui);
sheet_ui.DoModal();
}
return idRet;
}
ID GSG_UIEditor::OnRButtonDown( UINT nFlags, GPOINT point )
{
return CGsGame::OnRButtonDown( nFlags, point );
}
ID GSG_UIEditor::OnRButtonUp( UINT nFlags, GPOINT point )
{
return CGsGame::OnRButtonUp( nFlags, point );
}
ID GSG_UIEditor::OnRButtonDbClk( UINT nFlags, GPOINT point )
{
return CGsGame::OnRButtonDbClk( nFlags, point );
}
ID GSG_UIEditor::OnMouseWheel(UINT nFlags, short zDelta, GPOINT point)
{
return CGsGame::OnMouseWheel(nFlags, zDelta, point);
}
ID GSG_UIEditor::OnChar(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return CGsGame::OnChar(nChar, nRepCnt, nFlags);
}
ID GSG_UIEditor::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return CGsGame::OnKeyDown(nChar, nRepCnt, nFlags);
}
ID GSG_UIEditor::OnKeyUp(UINT nChar, UINT nRepCnt, UINT nFlags)
{
return CGsGame::OnKeyUp(nChar, nRepCnt, nFlags);
}
FLAG GSG_UIEditor::Update(DWORD dwPassTime)
{
return 0;
}
HRESULT GSG_UIEditor::Render()
{
HRESULT hr;
m_pEngine->PreparePaint();
hr = RenderUI();
return hr;
}
HRESULT GSG_UIEditor::Draw(CGsSurface *pSurface)
{
GPOINT point = m_pEngine->m_Pos;
if(m_active_ui)
{
m_active_ui->PickScreenToClient(point);
}
char strMouse[100];
sprintf(strMouse, "界面坐标X: %5d", point.x);
pSurface->DrawTextDirect(NULL, strMouse, m_pEngine->GetRenderWidth() - 120, 30, RGB(255,255,255), RGB(1,1,1));
sprintf(strMouse, "界面坐标Y: %5d", point.y);
pSurface->DrawTextDirect(NULL, strMouse, m_pEngine->GetRenderWidth() - 120, 50, RGB(255,255,255), RGB(1,1,1));
// HFONT fnt = CGsFunc::Font_QuickCreateFont(20, "微软繁细圆", -1, TRUE, TRUE, TRUE);
// pSurface->DrawTextDirect(fnt,
// "怎么柔化啊?你举些实例来看看,对比一下柔化和不柔化的区别",
// 0,200,
// RGB(255,255,255),
// RGB(0,0,0));
// DeleteObject(fnt);
return S_OK;
}
VOID GSG_UIEditor::Cleanup()
{
CGsGame::Cleanup();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -