本文整理汇总了C++中CCamera::GetCamNum方法的典型用法代码示例。如果您正苦于以下问题:C++ CCamera::GetCamNum方法的具体用法?C++ CCamera::GetCamNum怎么用?C++ CCamera::GetCamNum使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CCamera
的用法示例。
在下文中一共展示了CCamera::GetCamNum方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: DoNewCamera
static void DoNewCamera( idCameraPosition::positionType type ){
CCamera *cam = AllocCam();
if ( cam ) {
char buf[128];
sprintf( buf, "camera%i", cam->GetCamNum() );
cam->GetCam()->startNewCamera( type );
cam->GetCam()->setName( buf );
cam->GetCam()->buildCamera();
sprintf( buf, "Unsaved Camera %i", cam->GetCamNum() );
cam->SetFileName( buf, false );
SetCurrentCam( cam );
RefreshCamListCombo();
// Go to editmode Add
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( g_pEditModeAddRadioButton ), TRUE );
// Show the camera inspector
DoCameraInspector();
// Start edit mode (if not initiated by DoCameraInspector)
if ( !g_bEditOn ) {
DoStartEdit( GetCurrentCam() );
}
}
else {
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, "No free cameras available.", "Create Camera Error", MB_OK, NULL );
}
}
示例2: DoLoadCamera
void DoLoadCamera(){
char basepath[PATH_MAX];
if ( firstCam && firstCam->HasBeenSaved() ) {
CAMERA_ExtractFilePath( firstCam->GetFileName(), basepath );
}
else{
strcpy( basepath, g_FuncTable.m_pfnGetGamePath() );
}
const gchar *filename = g_FuncTable.m_pfnFileDialog( (GtkWidget *)g_pRadiantWnd, TRUE, "Open Camera File", basepath, "camera", NULL );
if ( filename ) {
CCamera *cam = AllocCam();
char fullpathtofile[PATH_MAX];
if ( cam ) {
Q_realpath( filename, fullpathtofile, PATH_MAX );
// see if this camera file was already loaded
CCamera *checkCam = firstCam->GetNext(); // not the first one as we just allocated it
while ( checkCam ) {
if ( !strcmp( fullpathtofile, checkCam->GetFileName() ) ) {
char error[PATH_MAX + 64];
FreeCam( cam );
sprintf( error, "Camera file \'%s\' is already loaded", fullpathtofile );
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
//g_free( filename );
return;
}
checkCam = checkCam->GetNext();
}
if ( loadCamera( cam->GetCamNum(), fullpathtofile ) ) {
cam->GetCam()->buildCamera();
cam->SetFileName( filename, true );
SetCurrentCam( cam );
RefreshCamListCombo();
g_FuncTable.m_pfnSysUpdateWindows( W_XY_OVERLAY | W_CAMERA );
}
else {
char error[PATH_MAX + 64];
FreeCam( cam );
sprintf( error, "An error occured during the loading of \'%s\'", fullpathtofile );
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, error, "Load error", MB_OK, NULL );
}
//g_free( filename );
}
else {
g_FuncTable.m_pfnMessageBox( (GtkWidget *)g_pRadiantWnd, "No free camera slots available", "Load error", MB_OK, NULL );
}
}
}