本文整理汇总了C++中TApplication类的典型用法代码示例。如果您正苦于以下问题:C++ TApplication类的具体用法?C++ TApplication怎么用?C++ TApplication使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TApplication类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: OnBegin
Bool TApplication::TApplicationState_Bootup::OnBegin(TRefRef PreviousMode)
{
TApplication* pApp = GetStateMachine<TApplication>();
// TODO:
// gr: if this fails (e.g. no logo asset) skip onto next mode
Bool bSuccess = CreateIntroScreen();
if(!bSuccess)
return FALSE;
// Subscribe to the asset manager
TLMessaging::g_pEventChannelManager->SubscribeTo(this, "Asset", "OnAssetChanged");
// TODO:
// Setup language
// Setup Audio - language specific
// Load Text - language specific
// Setup global settings
// Obtain list of files to load at startup
pApp->GetPreloadFiles(m_PreloadFiles);
if(m_PreloadFiles.GetSize() > 0)
{
// Request the load of the assets
for ( s32 i=m_PreloadFiles.GetLastIndex(); i>=0; i-- )
TLAsset::LoadAsset( m_PreloadFiles[i], FALSE );
}
return TStateMode::OnBegin(PreviousMode);
}
示例2: addDelegate
void UIAccelerometer::addDelegate(UIAccelerometerDelegate* pDelegate)
{
UIAccelerometerHandler* pHandler = UIAccelerometerHandler::handlerWithDelegate(pDelegate);
if (pHandler)
{
m_pDelegates->addObject(pHandler);
if (!m_pSensor)
{
m_pSensor = TCOM_Sensors_DataType_Client::GetInstance();
if (m_pSensor)
{
m_pSensor->StartUp();
m_pSensor->SetDelay(TG3_SENSOR_DELAY_FASTEST);
TApplication* pApp = TApplication::GetCurrentApplication();
TWindow* pWnd = pApp->GetActiveWindow();
m_pSensor->SetWindowCtrlId(pWnd->GetWindowHwndId(), 0);
m_pSensor->Activate(TG3_SENSOR_TYPE_ACCELEROMETER, TRUE);
}
else
{
CCLOG("cocos2d: The Accelerometer Sensor Open failed");
}
}
}
}
示例3: main
int main(int argc, char *argv[])
{
TApplication *a = new TApplication("app", &argc, argv);
TCanvas *c1 = makegraph();
a->Run();
return 0;
}
示例4: TYPESAFE_DOWNCAST
//
/// Called by EvHelp() to activate the help file with the help context ID.
//
void
THelpFileManager::ActivateHelp(TWindow* /*window*/, int helpFileContextId, uint helpCmd)
{
if (helpCmd == HELP_INDEX || helpCmd == HELP_CONTENTS)
helpCmd = HELP_FINDER;
TApplication* app = TYPESAFE_DOWNCAST(this, TApplication);
#if !defined(NO_HTMLHELP)
if(UseHTMLHelp){
if (app)
HelpState = ToBool(HtmlHelp(app->GetMainWindow(), GetHelpFile().c_str(),
helpCmd, helpFileContextId) != 0);
else
HelpState = ToBool(HtmlHelp(0, GetHelpFile().c_str(),
helpCmd, helpFileContextId) != 0);
}
else{
#endif
if (app)
HelpState = ToBool(app->GetMainWindow()->WinHelp(GetHelpFile().c_str(),
helpCmd, helpFileContextId));
else
HelpState = ToBool(::WinHelp(0, GetHelpFile().c_str(),
helpCmd, helpFileContextId));
#if !defined(NO_HTMLHELP)
}
#endif
}
示例5: main
int main(int argc, char **argv)
{
TApplication app;
app.Run();
return 0;
}
示例6: Create
Boolean CCEGLView::Create(int nWidthInPoints, int nHeightInPoints)
{
// record the window size in points
m_tSizeInPoints.SetWidth(nWidthInPoints);
m_tSizeInPoints.SetHeight(nHeightInPoints);
// get the screen size
TApplication* pApp = TApplication::GetCurrentApplication();
Int32 nWidth = pApp->GetScreenWidth();
Int32 nHeight = pApp->GetScreenHeight();
// calculate the factor and the rect of viewport
m_fScreenScaleFactor = MIN((float)nWidth / nWidthInPoints, (float)nHeight / nHeightInPoints);
int viewPortW = (int)(m_tSizeInPoints.Width() * m_fScreenScaleFactor);
int viewPortH = (int)(m_tSizeInPoints.Height() * m_fScreenScaleFactor);
m_rcViewPort.SetX((nWidth - viewPortW) / 2);
m_rcViewPort.SetY((nHeight - viewPortH) / 2);
m_rcViewPort.SetWidth(viewPortW);
m_rcViewPort.SetHeight(viewPortH);
Boolean bRet = TWindow::Create(&TRectangle(0, 0, nWidth, nHeight));
if (bRet)
{
s_pMainWindow = this;
}
return bRet;
}
示例7: main
int main(int argc, char **argv) {
parseOptions(argc,argv);
TApplication *theApp;
if ( interactive ) theApp = new TApplication("App", &argc, argv);
else gROOT->SetBatch();
Bs2KstKst::MultiDimCutOpt *cutOpt = new Bs2KstKst::MultiDimCutOpt();
// set run type
if ( runType == "all" ) {
cutOpt->setRunAll(true);
}
else if ( runType == "2011" ) {
cutOpt->setRunAll(false);
cutOpt->setRun2011(true);
}
else if ( runType == "2012" ) {
cutOpt->setRunAll(false);
cutOpt->setRun2012(true);
}
else {
cerr << "ERROR - no such runType: " << runType << endl;
exit(1);
}
// setup files
cutOpt->setup( infname , outfname, cachefile );
// set mis id type
cutOpt->setMisIdType( misIdType );
if ( loadFromCachce ) {
cutOpt->loadWorkspace();
}
else {
cutOpt->makeInitialDatasets();
//cutOpt->loadDatasetsFromFile( "root/MultiDimCutDatasets.root" );
cutOpt->makePDFs();
cutOpt->plotShapes();
}
if ( ! makeCache ) {
cutOpt->setScanPoints1D( scanPoints1D );
cutOpt->setScanPoints2D( scanPoints2D );
if ( bdtOnly ) cutOpt->runBDTOptOnly( fomType );
else cutOpt->runSimple( fomType );
}
cutOpt->save();
if ( interactive ) {
cout << "Exit with Ctrl+c" << endl;
theApp->Run();
}
}
示例8: main
int main(int argc, char** argv)
{
//TRint* myapp = new TRint("kaliveda", &argc, argv, NULL, 0);
TApplication* myapp = new TApplication("myapp", &argc, argv);
new KVSimDirGUI;
myapp->Run();
return 0;
}
示例9: main
// This is the standard "main" of C++ starting a ROOT application
int main ( int argc , char ** argv ) {
gROOT-> Reset() ;
TApplication app ( "Root Application" , &argc , argv ) ;
StandaloneApplication ( app.Argc(), app.Argv() ) ;
app.Run () ;
exit(0);
return 0 ;
}
示例10: OnEnd
void TApplication::TApplicationState_ExitGame::OnEnd(TRefRef NextMode)
{
// Destroy (game specific) TGame object
TApplication* pApp = GetStateMachine<TApplication>();
pApp->DestroyGame();
return TStateMode::OnEnd(NextMode);
}
示例11: main
int main(int argc, char *argv[])
{
ArgumentParser parser;
parser.addArgument("-i", "--input", 1, false);
parser.parse(argc, argv);
TApplication *myapp = new TApplication("App", &argc, argv);
fit(parser.retrieve<string>("i"));
myapp->Run();
}
示例12: TYPESAFE_DOWNCAST
//
/// Responds to a menu item selection.
//
void
TRecentFiles::CmFile(uint id)
{
TApplication* app = TYPESAFE_DOWNCAST(this, TApplication);
TFrameWindow* window = app ? app->GetMainWindow() : 0;
if (window) {
// Foward menu selection command to specified target
//
window->SendMessage(MruMessage, id, 0);
}
}
示例13: getDiffResolutionPath
const char* getDiffResolutionPath(const char *pszPath)
{
CCString *pRet = new CCString(pszPath);
pRet->autorelease();
do
{
TApplication* pApp = TApplication::GetCurrentApplication();
CC_BREAK_IF(!pApp);
// get the Resolution
int nScreenWidth = pApp->GetScreenWidth();
int nScreenHeight = pApp->GetScreenHeight();
// it's default resolution, do nothing
CC_BREAK_IF(nScreenWidth == 320 && nScreenHeight == 480);
if (nScreenWidth == 480 && nScreenHeight == 800)
{
// it's WVGA
CC_BREAK_IF(pRet->m_sString.find("@WVGA") != -1);
std::string filePathWithoutExtension = pszPath;
std::string extension = "";
std::string filePath = pszPath;
int nExPos = filePath.find_last_of(".");
if (nExPos != -1)
{
filePathWithoutExtension = filePath.substr(0, nExPos);
extension = filePath.substr(nExPos);
}
// new path, add "@WVGA" before the extension
pRet->m_sString = filePathWithoutExtension + "@WVGA" + extension;
// not find the resource of new path,use the original path
if (! isResourceExist(pRet->m_sString.c_str()))
{
pRet->m_sString = filePath;
}
}
else
{
// not support resolution
CCAssert(0, "it's not supportted resolution.");
}
} while (0);
return pRet->m_sString.c_str();
}
示例14: GenerateTimingHistogram
void GenerateTimingHistogram(){
TApplication *fApp = new TApplication("Test", NULL, NULL);
//Scintillator::SetStartingId(-1);
ScintillatorPlane topPlane(2,8,-105.,false,"TopPlane");
ScintillatorPlane bottomPlane(2,8,105.,false,"BottomPlane");
int nxbins = 8;
int xlow = 0;
int xhigh = 8;
int nybins = 8;
int ylow = 0;
int yhigh = 8;
Channel *trig = 0;
Channel *ch1 = 0;
Channel *ch2 = 0;
TCanvas *c2 = new TCanvas("c2", "Timing-Info", 200, 10, 700, 500);
c2->Divide(1, 1);
c2->cd(1);
Tree t("3476.root", "BSC_DATA_TREE");
int numOfEvents = t.GetNumOfEvents();
// TH1F *hTrig = new TH1F("hTrig","TEST",100,20000,21000);
TH2F *h2d = new TH2F("h2d", "Timing", nxbins, xlow, xhigh, nybins, ylow, yhigh);
std::vector<Tracking::Scintillator*> scintPlane1 = topPlane.GetScintillatorPlane();
std::vector<Tracking::Scintillator*> scintPlane2 = bottomPlane.GetScintillatorPlane();
for (int evNo = 0; evNo < numOfEvents; evNo++) {
for (int i = 0; i < scintPlane1.size(); i++) {
ch1 = t.GetEntry(scintPlane1[i]->GetName(), evNo);
if (ch1->size()) {
for (int j = 0; j < scintPlane2.size(); j++) {
ch2 = t.GetEntry(scintPlane2[j]->GetName(), evNo);
if(ch2->size())
h2d->Fill(i, j);
}
}
}
}
//h2d->Draw();
h2d->Draw("LEGO2");
fApp->Run();
h2d->Print();
// TFile f("hTrig.root","recreate"); //Open file, then write histo to it.
TFile::Open("hTrig.root", "RECREATE");
h2d->Write();
c2->Modified();
c2->Update();
}
示例15: GetApplicationObject
void TMustEnterValidator::Error(TWindow *owner)
{
string msgTmpl;
TApplication* app = GetApplicationObject();
msgTmpl = app->LoadString(IDS_VALMUSTENTER).c_str();
char* msg = new char[msgTmpl.length() + 10 + 10 + 1];
sprintf(msg, msgTmpl.c_str());
if (owner)
owner->MessageBox(msg, app->GetName(), MB_ICONEXCLAMATION|MB_OK);
else
::MessageBox(0, msg, app->GetName(), MB_ICONEXCLAMATION|MB_OK|MB_TASKMODAL);
delete [] msg;
}