Пример #1
0
int __stdcall wWinMain(HINSTANCE hInstance,HINSTANCE hPrevInstance,LPTSTR lpCmdLine,int nCmdShow){
	int rt = -1;
	initContext();
	HandleScope store;
	runJSRes(IDR_JS_STRUCT,L"app.lib");
	Handle<Value> result = runJSFile(L"main.js",L"utf-8");
	if(!result.IsEmpty()){//只有出错的时候才会返回Empty, 否则即使没有返回值, result仍然是Undefined.
		Local<Object> gObj = getGlobal();
		Local<Function> main = GetJSVariant<Function>(gObj,L"main");
		if(main.IsEmpty()){
			//InnerMsg(L"没有发现 main 函数",MT_ERROR);
		}else if(!main->IsFunction()){
			//InnerMsg(L"main 不是函数",MT_ERROR);
		}else{
			TryCatch err;
			Handle<Value> args[1];
			args[0] = String::New((uint16_t*)lpCmdLine);
			Local<Value> r = main->Call(gObj,1,args);
			if(!err.Exception().IsEmpty()){
				ReportError(err);
			}else
				rt = r->Int32Value();
		}
	}
	releaseContext();
	return rt;
}
Пример #2
0
MenuShit::~MenuShit()
{
	releaseContext();

	delete renderInterface;
	delete systemInterface;
}
Пример #3
0
/// Create a new event loop context
StatusCode EventSelector::createContext(Context*& refpCtxt) const
{
  // Max event is zero. Return begin = end
  refpCtxt = 0;
  if ( m_firstEvent < 0 ) {
    MsgStream log(msgSvc(), name());
    log << MSG::ERROR  << "First Event = " << m_firstEvent << " not valid" << endmsg;
    log << MSG::ERROR  << "It should be > 0 " << endmsg;
    return StatusCode::FAILURE;    // if failure => iterators = end();
  }
  EvtSelectorContext* ctxt = new EvtSelectorContext(this);
  ctxt->set(0, -1, 0, 0);
  firstOfNextStream(true, *ctxt).ignore();
  refpCtxt = ctxt;
  long nskip = m_firstEvent;
  while( --nskip > 0 )    {
    StatusCode sc = next(*refpCtxt);
    if ( sc.isFailure() ) {
      MsgStream log(msgSvc(), name());
      log << MSG::ERROR << " createContext() failed to start with event number "
          << m_firstEvent << endmsg;
      releaseContext(refpCtxt);
      refpCtxt = 0;
      return StatusCode::FAILURE;
    }
  }
  return StatusCode::SUCCESS;
}
bool ViewWindow::update()
    {
    prof->beginProfiling("window.update");

    // process wm events
    ViewPlatformSupport::processWindowEvents(&winData);

    // resize window if requested
    if(winData.toBeResized)
        {
        resize(winData.width, winData.height);
        winData.toBeResized = false;
        }

    // set primary context
    takeContext();

    // clear the window and the depth buffer
    glClearColor(0.4f, 0.4f, 0.6f, 1.0f);
    glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    glLoadIdentity();

    // updates all registered and active surfaces
    std::vector<uint>::iterator it;
    for(it = surfaces.begin(); it != surfaces.end(); it++)
        {
        ViewSurface* surface = View::getInstance()->getSurfaceFromId(*it);
        if(surface != NULL)
            surface->paint();
        }

    // swaps window buffers (true for wait VSync)
    ViewPlatformSupport::swapBuffers(&winData, false);

    // set secondary context
    releaseContext();

    // fps
    if(timer->getSeconds() >= 1.0f)
        {
        fpsCounter = framesUpdated;
        framesUpdated = 0;
        timer->reset();
        }
    framesUpdated++;

    prof->endProfiling("window.update");

    if(winData.toBeClosed)
        return false;

    return true;
    }
Пример #5
0
void testQueryString() {
  void* ctx;
  parseQueryString(&ctx, "width=640&height=360&video=bigbunny.ogg");
  const char* width = getParameter(ctx, "width");
  const char* height = getParameter(ctx, "height");
  const char* video = getParameter(ctx, "video");
  if(!strcmp(width,"640")) {
      printf("Querystring width esperado:%s - recebido:%s\n", "640", width);
  }
  if(!strcmp(height,"360")) {
      printf("Querystring height esperado:%s - recebido:%s\n", "360", height);
  }
  if(!strcmp(video,"bigbunny.ogg")) {
      printf("Querystring video esperado:%s - recebido:%s\n", "bigbunny.ogg", video);
  }
  releaseContext(ctx);
}
bool ViewWindow::open()
    {
    // make window
    if(!ViewPlatformSupport::makeWindow(screen, "EOS Window", 0, 0, width, height, fullscreen, &winData))
        return false;

    //Initialize OpenGL
    if(!this->initGL())
        return false;

    // resize the initial window
    this->resize(this->width, this->height);

    // release context to other modules
    releaseContext();

    return true;
    }
Пример #7
0
void CompositeViewer::renderingTraversals( bool needMakeCurrentInThisThread )
{
    Contexts contexts;
    getContexts( contexts );

    bool doneMakeCurrentInThisThread = false;

    for( Contexts::iterator itr = contexts.begin( );
            itr != contexts.end( ); ++itr )
    {
        if(( *itr )->valid( ))
        {
            if( needMakeCurrentInThisThread )
            {
                doneMakeCurrentInThisThread = true;
                makeCurrent( *itr );
            }
            ( *itr )->runOperations( );
        }
    }

    if( doneMakeCurrentInThisThread )
        releaseContext( );
}
Пример #8
0
    Win32Context::~Win32Context()
    {
		if (mOwnsContext)
			releaseContext();
    }
Пример #9
0
void Binding::releaseCurrentContext()
{
    releaseContext(getCurrentContext());
}