//调用串口初始化函数和其它一些类的初始化函数 //本例子中只调用初始化窗口函数 bool SystemClass::Initialize() { int screenWidth = 0, screenHeight = 0; bool result = false; //初始化窗口 InitializeWindows(screenWidth, screenHeight); //创建Input对象处理按键输入 m_Input = new InputClass; if (!m_Input) return false; //初始化输入对象 m_Input->Initialize(); //创建图形对象,进行渲染所有物体 m_Graphics = new GraphicsClass; if (!m_Graphics) return false; result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) return false; //创建计时器并初始化 m_timer = new TimerClass; if (!m_timer) return false; result = m_timer->Initialize(); if (!result) { MessageBox(m_hwnd, L"m_timer->Initialize 初始化失败!", L"error!!", MB_OK); return false; } return true; }
bool SystemClass::Initialize() { int ScreenWidth, ScreenHeight; bool Result; ScreenHeight = 0; ScreenWidth = 0; InitializeWindows(ScreenWidth, ScreenHeight); m_Input = new InputClass; if(!m_Input) { return false; } m_Input->Initialize(); m_Graphics = new GraphicsClass; if(!m_Graphics) { return false; } Result = m_Graphics->Initialize(ScreenWidth, ScreenHeight, m_WindowHandle); if(!Result) { return false; } return true; }
//调用窗口初始化函数和其它一些类的初始化函数 bool SystemClass::Initialize() { int screenWidth = 0, screenHeight = 0; // 初始化窗口 InitializeWindows(screenWidth, screenHeight); //创建input对象处理键盘输入 m_Input = new InputClass; if(!m_Input) return false; // 初始化输入对象 m_Input->Initialize(); // 创建图形对象,这个对象将渲染应用程序中的所有物体 m_Graphics = new GraphicsClass; if(!m_Graphics) return false; // 初始化图形对象 bool result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if(!result) return false; return true; }
bool SystemClass::Initialize() { int screenWidth, screenHeight; bool result; // init the width and height of the screen to zero before sending the variables into the function screenWidth = screenHeight = 0; //init the windows api InitializeWindows(screenWidth, screenHeight); //create the input obj m_Input = new InputClass(); if (!m_Input) return false; m_Input->Initialize(); // create the gfx class m_Graphics = new GraphicsClass(); if (!m_Graphics) return false; //init the gfx obj result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) return false; return true; }
bool System::Initialize() { bool result; screenWidth = 0; screenHeight = 0; InitializeWindows(screenWidth, screenHeight); firstUpdate = true; //Input m_input = new Input(); result = m_input->Initialize(); if (!result) { return false; } //Graphics m_graphics = new Graphics(); result = m_graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) { return false; } return true; }
bool SystemClass::Initialize() { int screenWidth = 0, screenHeight = 0; bool result; InitializeWindows(screenWidth, screenHeight); m_Input = new InputClass; if(!m_Input) { return false; } m_Input->Initialize(); m_Graphics = new GraphicsClass; if(!m_Graphics) { return false; } result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if(!result) { return false; } return true; }
/* * Initialize() * brief: This function initialized the members of the class and calls the initialize functions for the windows api. */ bool SystemClass::Initialize() { int screenWidth = 0, screenHeight = 0; //The screen size variables initialized in 0. bool rightInit; //Initialize windows api. InitializeWindows(screenWidth, screenHeight); //Create the input object that will control the users inputs. m_Input = new InputClass(); if (!m_Input) { return false; } //Initialize the input object. m_Input->Initialize(); //Create the graphics object. This object will handle the rendering of the graphics for the aplication. m_Graphics = new GraphicsClass(); if (!m_Graphics) { return false; } //Initialize the graphics object. rightInit = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!rightInit) { return false; } return true; }
bool CSystem::Initialize() { int screenWidth, screenHeight; bool result; screenWidth = 0; screenHeight = 0; InitializeWindows(screenWidth, screenHeight); input = new CInput; if (!input) { CLog::Write("CSystem::Initialize() : Could not create an instance of the Input class"); return false; } input->Initialize(); graphics = new CRenderer; if (!graphics) { CLog::Write("CSystem::Initialize() : Could not create an instance of the Renderer class"); return false; } result = graphics->Initialize(screenWidth, screenHeight, window->GetHandle()); if (!result) { CLog::Write("CSystem::Initialize() : The renderer has not been initialized"); return false; } return true; }
bool CSystem::Initialize() { int screenWidth, screenHeight; bool result; // Initialize the width and height of the screen to zero before sending the variables into the function. screenWidth = 0; screenHeight = 0; // Initialize the windows api. InitializeWindows(screenWidth, screenHeight); // Create the application wrapper object. m_Application = new CApp; if(!m_Application) { return false; } // Initialize the application wrapper object. result = m_Application->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight); if(!result) { return false; } return true; }
bool SystemClass::Initialize() { int screenWidth, screenHeight; bool result; // Initialize the width and height of the screen to zero before sending the variables into the function. screenWidth = 0; screenHeight = 0; // Initialize the windows api. InitializeWindows(screenWidth, screenHeight); // Create the input object. This object will be used to handle reading the keyboard input from the user. m_Input = new InputClass; if(!m_Input) { return false; } // Initialize the input object. result = m_Input->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight); if(!result) { MessageBox(m_hwnd, L"Could not initialize the input object.", L"Error", MB_OK); return false; } // Create the graphics object. This object will handle rendering all the graphics for this application. m_Graphics = new GraphicsClass; if(!m_Graphics) { return false; } // Initialize the graphics object. result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if(!result) { return false; } // Create the timer object. m_Timer = new TimerClass; if(!m_Timer) { return false; } // Initialize the timer object. result = m_Timer->Initialize(); if(!result) { MessageBox(m_hwnd, L"Could not initialize the Timer object.", L"Error", MB_OK); return false; } return true; }
//调用初始化函数和一些其它初始化函数 //本例中只调用初始化窗口函数 bool Initialize() { int screenWidth = 0, screenHeight = 0; //初始化窗口 InitializeWindows(screenWidth, screenHeight); return true; }
System::System() : m_pApplication(nullptr) { int screenWidth(0), screenHeight(0); InitializeWindows(screenWidth, screenHeight); m_pApplication = std::make_shared<Application>(m_hinstance, m_hwnd, screenWidth, screenHeight); }
bool Engine::Initialize(){ m_screenWidth = 0; m_screenHeight = 0; try { InitializeWindows(m_screenWidth, m_screenHeight); //Use RAII for as much as possible m_Input = new InputSystem; if(!m_Input){ return false; } m_ResourceLoader = new ResourceLoader(); if(!m_ResourceLoader){ return false; } m_Graphics = new GraphicsSystem(m_hwnd, m_ResourceLoader); if(!m_Graphics){ return false; } m_EventManager = EventManager::Get(); if(!m_EventManager){ return false; } m_AudioSystem = new AudioSystem(); if(!m_AudioSystem){ return false; } m_ScriptManager = new ScriptManager(); if(!m_ScriptManager){ return false; } RegisterScriptFunctions(); m_ScriptManager->ExecuteScript("programdata/required.lua"); m_clock = clock(); DGEngineInit(); return true; } catch(std::exception exc){ MessageBoxA(m_hwnd, exc.what(), "Error", MB_OK); } return false; }
System::System(bool fullscreen, bool showCursor, int screenWidth, int screenHeight) { this->screenWidth = screenWidth; this->screenHeight = screenHeight; this->fullscreen = fullscreen; this->showCursor = showCursor; InitializeWindows(); //Create and initialize the application application = new Application(hinstance, hwnd, screenWidth, screenHeight); }
bool SystemClass::Initialize() { int screenWidth, screenHeight; bool result; //initialize width and height to 0 screenWidth = 0; screenHeight = 0; //initialize the Windows API InitializeWindows(screenWidth, screenHeight); m_Input = new InputClass; //create input object, handles keyboard input if(!m_Input) { return false; } result = m_Input->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight); //initializes input object if(!result) { MessageBox(m_hwnd, L"Could not initialize the input object", L"Error", MB_OK); return false; } m_Graphics = new GraphicsClass; //create graphics object, handles graphics rendering if(!m_Graphics) { return false; } result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd, m_hinstance); //initializes the graphics object if(!result) { return false; } m_Timer = new TimerClass; if(!m_Timer) { return false; } result = m_Timer->Initialize(); if(!result) { MessageBox(m_hwnd, L"Could not initialize the Timer object", L"Error", MB_OK); return false; } return true; }
WindowsManager::WindowsManager() { mColorPickerDlg = mnew ColorPickerDlg(); mCurveEditorDlg = mnew CurveEditorDlg(); mNameEditDlg = mnew NameEditDlg(); InitializeDock(); InitializeWindows(); SetWindowsLayout(o2EditorConfig.mProjectConfig.mLayout); mAvailableLayouts = o2EditorConfig.mGlobalConfig.mAvailableLayouts; }
bool System::Initialize(void) { g_pSystem = this; m_pSettings = new Settings(); if (!m_pSettings) return false; if (!m_pSettings->Initialize()) return false; bool result; InitializeWindows(); m_pInput = new CInput; if (!m_pInput) { return false; } m_pInput->Init(m_hInstance,m_hWnd,m_pSettings->GetScreenWidth(),m_pSettings->GetScreenHeight()); m_pGraphics = new Graphics; if (!m_pGraphics) { return false; } result = m_pGraphics->Initialize(m_pSettings,m_hWnd); if (!result) { return false; } m_pCpu = new CCpu(); if (!m_pCpu) return false; m_pCpu->Init(); m_pFps = new CFps(); if (!m_pFps) return false; m_pFps->Init(); m_pTimer = new CTimer(); if (!m_pTimer) return false; if (!m_pTimer->Init()) return false; return true; }
bool System::Initialize(){ int screenWidth = 0; int screenHeight = 0; bool result = true; // initialize the Windows API InitializeWindows(screenWidth, screenHeight); //create application wrapper m_Application = new Application; if (!m_Application) return false; // init application wrapper result = m_Application->Initialize(m_hInstance, m_hwnd, screenWidth, screenHeight); if (!result) return false; }
System::System(bool fullscreen, bool showCursor, int windowWidth, int windowHeight) { this->windowWidth = windowWidth; this->windowHeight = windowHeight; this->fullscreen = fullscreen; this->showCursor = showCursor; InitializeWindows(); //Create and initialize the application timer = new Timer(); cpuUsage = new Cpu(); game = new Game(hinstance, hwnd, this->windowWidth, this->windowHeight, fullscreen); }
//--- Initialize(): Does all necessary setup for the application. ---// bool SystemClass::Initialize() { int screenWidth = 0; int screenHeight = 0; bool result = true; //Initialize the Windows API InitializeWindows(screenWidth, screenHeight); //Create the input object. This object will be used to handle reading the keyboard input from the user. m_Input = new InputClass(); //Initialize the input object m_Input->Initialize(); //Create the graphics object. This object will handle rendering all the graphcis for this application. m_Graphics = new GraphicsClass(); //Initialize the graphics object result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) { return false; } //Create and initialize the FPS object m_Fps = new FpsClass(); m_Fps->Initialize(); //Create and initialize the CPU object m_Cpu = new CpuClass(); m_Cpu->Initialize(); //Create and initialize the Timer object m_Timer = new TimerClass(); result = m_Timer->Initialize(); if (!result) { MessageBox(m_hwnd, L"Could not initialize the Timer object.", L"Error", MB_OK); return false; } return true; }
bool System::Initialize(HINSTANCE hInstance) { int width = 0; //window width int height = 0; //window height InitializeWindows(width, height, hInstance); m_application = new Application; if (!m_application) { return false; } if (!m_application->Initialize(hInstance, m_hwnd, width, height)){ return false; } return true; }
SideBar::SideBar(vector<LivingBeing*> *livingBeings) { beings = livingBeings; cameraX = &RPG::GetInstance()->cameraPosition[0]; cameraY = &RPG::GetInstance()->cameraPosition[1]; width = RPG::GetInstance()->SideBarWidth; height = RPG::GetInstance()->ScreenHeight; background = al_load_bitmap(SideBarPath); if (!background) { al_show_native_message_box(RPG::GetInstance()->GetDisplay(), "Error", "Could not load side bar bitmap.", "Your resources folder must be corrupt, please download it again.", NULL, ALLEGRO_MESSAGEBOX_ERROR); exit(-1); } InitializeWindows(); Update(); DistributeWindowsAlongSideBar(); }
bool SystemClass::Initialize() { int screenWidth, screenHeight; bool result; m_timer.Init(); // Initialize the width and height of the screen to zero before sending the variables into the function. screenWidth = 0; screenHeight = 0; // Create the input object. This object will be used to handle reading the keyboard input from the user. m_input = new InputClass(); if (!m_input) { return false; } // Initialize the input object. m_input->Initialize(); // Initialize the windows api. InitializeWindows(screenWidth, screenHeight); // Create the graphics object. This object will handle rendering all the graphics for this application. m_renderer = new Renderer(); if (!m_renderer) { return false; } // Initialize the graphics object. result = m_renderer->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) { return false; } return true; }
//调用窗口初始化函数和其它一些类的初始化函数 bool SystemClass::Initialize() { int screenWidth = 0, screenHeight = 0; // 初始化窗口 InitializeWindows(screenWidth, screenHeight); //创建input对象处理键盘输入 m_Input = new InputClass; if(!m_Input) return false; // 初始化输入对象 m_Input->Initialize(); // 创建图形对象,这个对象将渲染应用程序中的所有物体 m_Graphics = new GraphicsClass; if(!m_Graphics) return false; // 初始化图形对象 bool result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if(!result) return false; //创建计时器对象 m_Timer = new TimerClass; if(!m_Timer) return false; result = m_Timer->Initialize(); if(!result) { MessageBox(m_hwnd, TEXT("Could not initialize the Timer object."), TEXT("Error"), MB_OK); return false; } return true; }
//调用窗口初始化函数和其它一些类的初始化函数 bool SystemClass::Initialize() { bool result; int screenWidth = 0, screenHeight = 0; // 初始化窗口 InitializeWindows(screenWidth, screenHeight); // 创建图形对象,这个对象将渲染应用程序中的所有物体 m_Graphics = new GraphicsClass; if (!m_Graphics) { return false; } // 初始化图形对象 result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if (!result) { return false; } //创建计时器对象 m_Timer = new TimerClass; if (!m_Timer) { return false; } //初始化计时器对象 result = m_Timer->Initialize(); if (!result) { MessageBox(m_hwnd, L"Could not initialize the Timer object.", L"Error", MB_OK); return false; } return true; }
bool baseSetup::Intialize() { int width; int height; bool check; InitializeWindows(width,height); _userInput = new userInput; if(!_userInput) { MessageBox(_hwnd,NULL,L"UserInput failed to start",MB_OK); return false; } _userInput->Initialize(); _graphics = new graphics; if(!_graphics) { MessageBox(_hwnd,NULL,L"Graphics failed to create",MB_OK); return false; } check = _graphics->Intialize(width,height,_hwnd); if(!check) { MessageBox(_hwnd,NULL,L"Graphics failed to intialize",MB_OK); return false; } return true; }
bool SystemClass::Initialize() { int screenWidth, screenHeight; bool result; //initalize the width and height of screen screenWidth = 0; screenHeight = 0; InitializeWindows(screenWidth, screenHeight); //create the input object . This object will be responsible for hadnling input from keyboard m_Input = new InputClass; if (!m_Input) { return false; } //intialize the input object m_Input->Initialize(); //Create the graphics object m_Graphics = new GraphicsClass; if (!m_Graphics) { return false; } result = m_Graphics->Initialize(screenWidth, screenHeight,m_hwnd); if (!result) { return false; } return true; }
bool Application::Initialize() { int screenWidth, screenHeight; // Initialize return variables screenWidth = 0; screenHeight = 0; // Initialize the windows api. InitializeWindows(screenWidth, screenHeight); /// TODO: serialize in systems so that they're created an initialized all at once. Input* input = new Input(); Graphics* gfx = new Graphics(screenWidth, screenHeight, m_hwnd); m_systems.push_back( input ); m_systems.push_back( gfx ); // Call the main init function of all systems. for( System* sys : m_systems ) sys->Initialize(); return true; }
void GenericAgentInitialize(EvalContext *ctx, GenericAgentConfig *config) { int force = false; struct stat statbuf, sb; char vbuff[CF_BUFSIZE]; char ebuff[CF_EXPANDSIZE]; #ifdef __MINGW32__ InitializeWindows(); #endif DetermineCfenginePort(); EvalContextClassPutHard(ctx, "any", "source=agent"); GenericAgentAddEditionClasses(ctx); strcpy(VPREFIX, GetConsolePrefix()); /* Define trusted directories */ { const char *workdir = GetWorkDir(); if (!workdir) { FatalError(ctx, "Error determining working directory"); } strcpy(CFWORKDIR, workdir); MapName(CFWORKDIR); } OpenLog(LOG_USER); SetSyslogFacility(LOG_USER); Log(LOG_LEVEL_VERBOSE, "Work directory is %s", CFWORKDIR); snprintf(vbuff, CF_BUFSIZE, "%s%cupdate.conf", GetInputDir(), FILE_SEPARATOR); MakeParentDirectory(vbuff, force); snprintf(vbuff, CF_BUFSIZE, "%s%cbin%ccf-agent -D from_cfexecd", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(vbuff, force); snprintf(vbuff, CF_BUFSIZE, "%s%coutputs%cspooled_reports", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(vbuff, force); snprintf(vbuff, CF_BUFSIZE, "%s%clastseen%cintermittencies", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(vbuff, force); snprintf(vbuff, CF_BUFSIZE, "%s%creports%cvarious", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(vbuff, force); snprintf(vbuff, CF_BUFSIZE, "%s", GetInputDir()); if (stat(vbuff, &sb) == -1) { FatalError(ctx, " No access to WORKSPACE/inputs dir"); } else { chmod(vbuff, sb.st_mode | 0700); } snprintf(vbuff, CF_BUFSIZE, "%s%coutputs", CFWORKDIR, FILE_SEPARATOR); if (stat(vbuff, &sb) == -1) { FatalError(ctx, " No access to WORKSPACE/outputs dir"); } else { chmod(vbuff, sb.st_mode | 0700); } snprintf(ebuff, sizeof(ebuff), "%s%cstate%ccf_procs", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(ebuff, force); if (stat(ebuff, &statbuf) == -1) { CreateEmptyFile(ebuff); } snprintf(ebuff, sizeof(ebuff), "%s%cstate%ccf_rootprocs", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); if (stat(ebuff, &statbuf) == -1) { CreateEmptyFile(ebuff); } snprintf(ebuff, sizeof(ebuff), "%s%cstate%ccf_otherprocs", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR); if (stat(ebuff, &statbuf) == -1) { CreateEmptyFile(ebuff); } snprintf(ebuff, sizeof(ebuff), "%s%cstate%cprevious_state%c", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(ebuff, force); snprintf(ebuff, sizeof(ebuff), "%s%cstate%cdiff%c", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(ebuff, force); snprintf(ebuff, sizeof(ebuff), "%s%cstate%cuntracked%c", CFWORKDIR, FILE_SEPARATOR, FILE_SEPARATOR, FILE_SEPARATOR); MakeParentDirectory(ebuff, force); OpenNetwork(); CryptoInitialize(); CheckWorkingDirectories(ctx); /* Initialize keys and networking. cf-key, doesn't need keys. In fact it must function properly even without them, so that it generates them! */ if (config->agent_type != AGENT_TYPE_KEYGEN) { LoadSecretKeys(); char *bootstrapped_policy_server = ReadPolicyServerFile(CFWORKDIR); PolicyHubUpdateKeys(bootstrapped_policy_server); free(bootstrapped_policy_server); cfnet_init(); } size_t cwd_size = PATH_MAX; while (true) { char cwd[cwd_size]; if (!getcwd(cwd, cwd_size)) { if (errno == ERANGE) { cwd_size *= 2; continue; } Log(LOG_LEVEL_WARNING, "Could not determine current directory. (getcwd: '%s')", GetErrorStr()); break; } EvalContextSetLaunchDirectory(ctx, cwd); break; } if (!MINUSF) { GenericAgentConfigSetInputFile(config, GetInputDir(), "promises.cf"); } VIFELAPSED = 1; VEXPIREAFTER = 1; setlinebuf(stdout); if (config->agent_specific.agent.bootstrap_policy_server) { snprintf(vbuff, CF_BUFSIZE, "%s%cfailsafe.cf", GetInputDir(), FILE_SEPARATOR); if (stat(vbuff, &statbuf) == -1) { GenericAgentConfigSetInputFile(config, GetInputDir(), "failsafe.cf"); } else { GenericAgentConfigSetInputFile(config, GetInputDir(), vbuff); } } }
bool SystemClass::Initialize() { // test basic lua int screenWidth, screenHeight; bool result; // Initialize the width and height of the screen to zero before sending the variables into the function. screenWidth = 0; screenHeight = 0; // Initialize the windows api. InitializeWindows(screenWidth, screenHeight); // Create the input object. This object will be used to handle reading the keyboard input from the user. m_Input = new InputClass; if(!m_Input) { return false; } // Initialize the input object. result = m_Input->Initialize(m_hinstance, m_hwnd, screenWidth, screenHeight); if(!result) { MessageBox(m_hwnd, L"Could not initialize the input object.", L"Error", MB_OK); return false; } // Create the sound object. m_Sound = AudioClass::GetInstance(); if(!m_Sound) { return false; } m_Sound->Initialize(m_hwnd); m_timer = new RSTimer(); if (!m_timer) { return false; } m_timer->SetGameSpeed(60); // Create the graphics object. This object will handle rendering all the graphics for this application. m_Graphics = new GraphicsClass; if(!m_Graphics) { return false; } // Initialize the graphics object. result = m_Graphics->Initialize(screenWidth, screenHeight, m_hwnd); if(!result) { return false; } GameLogic* gl = GameLogic::GetInstance(); gl->InitInputMgr(m_Input); return true; }