📄 main.cpp
字号:
/******************************************************************************
* This source code is part of Bad Camel Gaming
* Copyright (C) 2002 Zephie Greyvenstein
* See Readme.html for acknowledgements
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*****************************************************************************/
/******************************************************************************
* FILENAME : main.cpp
* DESCRIPTION : Entry point for the application
* AUTHOR : Zephie Greyvenstein
*****************************************************************************/
#include "main.h"
#include "oasisScriptSystem.h"
#if OASIS_PLATFORM == OASIS_PLATFORM_WIN32
#define WIN32_LEAN_AND_MEAN
#include "windows.h"
INT WINAPI WinMain( HINSTANCE hInst, HINSTANCE, LPSTR strCmdLine, INT ) {
#else
extern "C"
{
void Init_Sample();
}
int main( int argc, char *argv[ ] ) {
#endif
string config;
// Try to start the system
#if OASIS_PLATFORM == OASIS_PLATFORM_WIN32
config = "../media/plugins.windows";
#else
config = "../media/plugins.unix";
#endif
fprintf(stdout, "root initializing");
root *system = new root( config );
if ( !system ) {
fprintf( stderr, "FATAL SYSTEM ERROR ON STARTING SYSTEMS\n" );
return 1;
}
fprintf( stdout, "initializing demo system\n");
#if OASIS_PLATFORM == OASIS_PLATFORM_WIN32
system->loadDirectoryResources( "../../media/" );
system->loadZipResources( "../../../oasisMain/media/console.zip" );
#else
system->loadDirectoryResources( "../media/" );
system->loadZipResources( "../../oasisMain/media/console.zip" );
#endif
// Create a demo
demo *demoSystem = new demo( );
if ( !demoSystem ) {
fprintf( stderr, "FATAL SYSTEM ERROR ON STARTING DEMO\n" );
}
try {
// Attempt to start the demo
#ifdef HAS_LUA
if ( !demoSystem->startDemo( Oasis::scriptSystem::LLUA ) ) {
fprintf( stderr, "COULD NOT START DEMO\n" );
#else
#ifdef HAS_RUBY
if ( !demoSystem->startDemo( Oasis::scriptSystem::LRUBY ) ) {
fprintf( stderr, "COULD NOT START DEMO\n" );
#else
fprintf( stderr, "COULD NOT START DEMO\n" );
#endif
#endif
}
} catch ( Oasis::exception &error ) {
// An exception has occured
#if OASIS_PLATFORM == OASIS_PLATFORM_WIN32
MessageBox( NULL, error.getDescription( ).c_str(),
"An exception has occured!",
MB_OK | MB_ICONERROR | MB_TASKMODAL );
#else
// Term for linux
#endif
}
if ( demoSystem ) {
delete demoSystem;
}
if ( system ) {
delete system;
}
return 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -