Пример #1
0
void InitZephyrModules()
{
  // A. Timer
  Core::Timer *mTimer = new Timer();
  mTimer->Initialize();
  mTimer->Reset();

  // B. Filesystem
  Core::FileSystem *fsMngr = new Core::Win32FileSystem();
  fsMngr->Initialize();

  // C. Input manager
  Input::SCTInputManager *inputMngr	= new Input::SCTInputManagerWin32(mHinst, mHwnd);
	inputMngr->Initialize();
  
	inputMngr->CreateKeyboardDevice();
	std::cout<<"$> Keyboard Device has been initialized\n";
  
	inputMngr->CreateMouseDevice();
  std::cout<<"$> Mouse Device has been initialized\n";

  // D. Shader manager
  ShaderManager *mShaderManager = new CgGLShaderManager();
  mShaderManager->SetDebugMode(true); // Always?
  mShaderManager->Initialize();
}
Пример #2
0
int main(int argc,char** argv)
{
	AST::Module* module;
	const char* outputFilename;
	if(argc == 4 && !strcmp(argv[1],"-text"))
	{
		WebAssemblyText::File file;
		if(loadTextModule(argv[2],file)) { module = file.modules[0]; }
		else { return -1; }
		outputFilename = argv[3];
	}
	else if(argc == 5 && !strcmp(argv[1],"-binary"))
	{
		module = loadBinaryModule(argv[2],argv[3]);
		outputFilename = argv[4];
	}
	else
	{
		std::cerr <<  "Usage: Print -binary in.wasm in.js.mem out.js" << std::endl;
		std::cerr <<  "       Print -text in.wast out.js" << std::endl;
		return -1;
	}
	
	if(!module) { return -1; }

	Core::Timer printTimer;
	std::ofstream outputStream(outputFilename);
	if(!outputStream.is_open())
	{
		std::cerr << "Failed to open " << outputFilename << std::endl;
		return -1;
	}
	ASMJS::print(outputStream,module);
	outputStream.close();
	std::cout << "Printed ASM.JS code in " << printTimer.getMilliseconds() << "ms" << std::endl;

	return 0;
}
Пример #3
0
void validate(const Module& module)
{
    Core::Timer timer;
    ModuleValidationContext context(module);
    Log::printf(Log::Category::metrics,"Validated WebAssembly module in %.2fms\n",timer.getMilliseconds());
}