Пример #1
0
NS_YY_BEGIN


void MouseArea::OnCreate(const VariantMap& args)
{
	Item::OnCreate(args);

	GetMgr()->AddMsgProc(this, WM_LBUTTONDOWN);
	GetMgr()->AddMsgProc(this, WM_LBUTTONUP);
}
Пример #2
0
void ScrollView::Build()
{
	if (nullptr == m_pDelegate)
		return;

	Item* pContent = (Item*)FindChild("Content");
	if (nullptr == pContent)
		return;

	pContent->ClearChildren();


	// create new items
	ScrollViewModel* pModel = (ScrollViewModel*)GetModel();
	int nCnt = pModel->GetCount();
	for (int i = 0; i < nCnt; i++)
	{
		Item* pItem = GenerateDelegateItem();
		if (!pItem->IsInstanceOf("ScrollViewDelegate"))
		{
			GetMgr()->Destroy(pItem->GetID());
			continue;
		}

		ScrollViewDelegate* pDelegateItem = (ScrollViewDelegate*)pItem;
		pDelegateItem->SetName("ScrollViewDelegateItem");
		pDelegateItem->SetWidth(GetWidth());
		pDelegateItem->SetHeight(50);
		pDelegateItem->SetLeft(0);
		pDelegateItem->SetTop(i*50);
		pDelegateItem->SetIndex(i);

		pContent->AddChild(pItem);
	}
}
Пример #3
0
ITexture* ResMgr::InnerLoadTexture(const std::string& file)
{
    int x,y,n;
    void* pData = stbi_load(file.c_str(), &x, &y, &n, 0);

    //int width, height, channels;
    //unsigned char *pData = SOIL_load_image
    //    (
    //        texture_file_name,
    //        &width, &height, &channels,
    //        SOIL_LOAD_AUTO
    //        );
    if(NULL == pData)
        return NULL;

    IStaticTexture* pRes = (IStaticTexture*)GetMgr()->Create("StaticTexture");
    pRes->SetResMgr(this);
	pRes->SetWidth(x);
	pRes->SetHeight(y);

    // STBI_default TEX_FORMAT_default
    pRes->Generate(x,y,n,pData);
    m_textures[file] = pRes;

    stbi_image_free(pData);
    //SOIL_free_image_data(pData);
    return pRes;
}
Пример #4
0
IRes* ResMgr::CreateRes(const char* name)
{
    BaseObject* pBaseObject = GetMgr()->Create(name);
	throw_assert(pBaseObject->IsInstanceOf("IRes"), "type check:"<<name);
    IRes* pRes = (IRes*)pBaseObject;
    pRes->SetResMgr(this);
    return pRes;
}
Пример #5
0
void ScrollView::SetDelegateItem(Item* pItem)
{
	m_pDelegate = (ItemGeneratorComponent*)GetMgr()->Create("ItemGeneratorComponent");
	if (nullptr == m_pDelegate)
		return;

	//pItem->SerializeToFile("prefab\\scroll_delegate_item.xml");
	m_pDelegate->SetTemplateItem(pItem);
}
Пример #6
0
NS_YY_BEGIN


void ScrollView::OnCreate(const VariantMap& args)
{
	Item::OnCreate(args);
	m_bRebuild = true;

	Rectangle* pContent = (Rectangle*)GetMgr()->Create("Rectangle");
	AnchorFillComponent* pComponent = (AnchorFillComponent*)pContent->FindComponent("AnchorFillComponent");
	pComponent->SetAnchorFillParent(true);
	pContent->SetName("Content");
	AddChild(pContent);
}
Пример #7
0
void CameraControl::OnDestroy()
{
    GetMgr()->RemoveExcute(this);
//     GetMgr()->RemoveMsgProc(this, WM_KEYDOWN);
//     GetMgr()->RemoveMsgProc(this, WM_KEYUP);
//     GetMgr()->RemoveMsgProc(this, WM_CHAR);
//     GetMgr()->RemoveMsgProc(this, WM_MOUSEMOVE);
//     GetMgr()->RemoveMsgProc(this, WM_MOUSEWHEEL);
//     GetMgr()->RemoveMsgProc(this, WM_LBUTTONDOWN);
//     GetMgr()->RemoveMsgProc(this, WM_LBUTTONUP);
//     GetMgr()->RemoveMsgProc(this, WM_MBUTTONDOWN);
//     GetMgr()->RemoveMsgProc(this, WM_MBUTTONUP);
//     GetMgr()->RemoveMsgProc(this, WM_RBUTTONDOWN);
//     GetMgr()->RemoveMsgProc(this, WM_RBUTTONUP);
}
Пример #8
0
IShader* ResMgr::LoadShader(const std::string& vsh, const std::string& fsh)
{
    std::string key = vsh + fsh;
    std::map<std::string , IShader*>::iterator result = m_shaders.find(key);
    if(result!= m_shaders.end())
    {
        IShader* pRes = result->second;
        return pRes;
    }

    IShader* pShader = (IShader*)GetMgr()->Create("Shader");
    pShader->SetResMgr(this);
    pShader->Load(vsh.c_str(), fsh.c_str());
    m_shaders[key] = pShader;
    return pShader;
}
Пример #9
0
void CameraControl::OnCreate()
{
//     GetMgr()->AddMsgProc(this, WM_KEYDOWN);
//     GetMgr()->AddMsgProc(this, WM_KEYUP);
//     GetMgr()->AddMsgProc(this, WM_MOUSEMOVE);
//     GetMgr()->AddMsgProc(this, WM_MOUSEWHEEL);
//     GetMgr()->AddMsgProc(this, WM_LBUTTONDOWN);
//     GetMgr()->AddMsgProc(this, WM_LBUTTONUP);
//     GetMgr()->AddMsgProc(this, WM_MBUTTONDOWN);
//     GetMgr()->AddMsgProc(this, WM_MBUTTONUP);
//     GetMgr()->AddMsgProc(this, WM_RBUTTONDOWN);
//     GetMgr()->AddMsgProc(this, WM_RBUTTONUP);
    GetMgr()->AddExcute(this);


    m_move_speed = 15.0f;

    m_fDirection = 0.0f;
    m_fUpDirection = 0.0f;
    m_fShiftDirection = 0.0f;
}
Пример #10
0
bool
ClassAdCronJobParams::Initialize( void )
{
	if ( !CronJobParams::Initialize() ) {
		return false;
	}

	const char *mgr_name = GetMgr().GetName( );
	if ( mgr_name && (*mgr_name) ) {
		char	*name_uc = strdup( mgr_name );
		char	*name_ptr;
		for( name_ptr = name_uc; *name_ptr; name_ptr++ ) {
			if ( islower ( (unsigned char) *name_ptr ) ) {
				*name_ptr = toupper( *name_ptr );
			}
		}
		m_mgr_name_uc = name_uc;
		free( name_uc );
	}
	Lookup( "CONFIG_VAL_PROG", m_config_val_prog );
	return true;
} 
Пример #11
0
void MouseArea::OnDestroy()
{
	GetMgr()->RemoveMsgProc(this, WM_LBUTTONDOWN);
	GetMgr()->RemoveMsgProc(this, WM_LBUTTONUP);
}
Пример #12
0
void CameraControl::SetCamera(YY_OBJECTID camera_id)
{
    m_pCamera = (IGameObj*)GetMgr()->Get(camera_id);
}