void CGrabbiter::getTouchedBy(CSpriteObject& theObject)
{
    if(getActionNumber(A_GRABBITER_NAPPING))
    {
	return;
    }
    
    
    if( CPlayerBase *player = dynamic_cast<CPlayerBase*>(&theObject) )
    {
        const int diffX = getXMidPos()-player->getXMidPos();
        player->moveXDir(-diffX/4);

        if(player->m_Inventory.Item.m_special.ep6.sandwich > 0)
        {
            player->m_Inventory.Item.m_special.ep6.sandwich--;

            // Show grabbiter message
            showMsg( g_pBehaviorEngine->getString("KEEN_GRABBITER_SLEEPY") );

            setAction(A_GRABBITER_NAPPING);
            playSound(SOUND_GRABBITER_SLEEP);
        }
        else
        {
            // Sound play
            g_pSound->playSound(SOUND_GRABBITER_HUNGRY, PLAY_PAUSEALL);

            // Show grabbiter message
            showMsg( g_pBehaviorEngine->getString("KEEN_GRABBITER_HUNGRY") );
        }
    }
}
Exemplo n.º 2
0
void D3Cam::on_startSysBtn_clicked()
{
	createVRCam();
	if (vrCam->init())
	{
		showMsg(QStringLiteral("相机初始化成功!"));
		
		ui.btnSaveImg->setEnabled(true);
		systemInited = true;
	}
	else
	{
		showMsg(QStringLiteral("相机初始化失败!"));
		delete vrCam;
		vrCam = NULL;
		return;
	}
	
	captureThread = new CaptureThread(vrCam->getVRCamDevice(), imgBuffer);
	processThread = new ProcessThread(imgBuffer);
	connect(processThread, &ProcessThread::newFrame, this, &D3Cam::updateFrame);

	captureThread->start();
	processThread->start();
	
	//gui
	ui.stopSysBtn->setEnabled(true);
	ui.startSysBtn->setEnabled(false);
	//ui.settingBtn->setEnabled(true);
}
Exemplo n.º 3
0
void DictionaryApp::onRemoveWord()
{
  if (txtWord.text().length() > 0) {
    dictionary.removeWord(txtWord.text().toStdString());
    updateWordList();
    showMsg("Word Removed");
  } else
    showMsg("Not a valid word");
}
Exemplo n.º 4
0
void test2 ( twin &X, twin &L, twin &R, long cnt )
{
	Byte	ch = 0	;

	for ( ; cnt > 0 ; cnt-- ) {
#if !defined(NO_IN_KEY)
		if ( in_key() != NOKEY ) break ;
#endif
		showMsg(X," T E S T - 1 ",ch++) ;
		showMsg(L,"  T E S T -- 2  ",ch++) ;
		showMsg(R,"   ¤¤¤å´ú¸Õ --- 3   ",ch++) ;
	}
}
Exemplo n.º 5
0
void DictionaryApp::onIsWordValid()
{
  std::string s = txtWord.text().toStdString();

  if (s.length() == 0)
    showMsg("Not a word");
  else {
    if (dictionary.isWordValid(s)) {
      showMsg("Word is valid");
    } else {
      showMsg("Word is not valid");
    }
  }
}
Exemplo n.º 6
0
void DictionaryApp::onAddWord()
{
  if (txtWord.text().length() > 0) {
      try {
	dictionary.addWord(txtWord.text().toStdString());
      } catch (std::runtime_error* re) {
	showMsg(re->what());
	return;
      }
    showMsg("Word Added");
    updateDictionarySize();
    updateWordList();
  } else
    showMsg("Not a valid word");
}
Exemplo n.º 7
0
void __stdcall showError(const char *msg)
{
    DWORD eNum;
    TCHAR sysMsg[256];
    TCHAR* p;
    char str[1000];

    eNum = GetLastError( );
    FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM |
        FORMAT_MESSAGE_IGNORE_INSERTS,
        NULL, eNum,
        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
        sysMsg, 256, NULL );

    // Trim the end of the line and terminate it with a null
    p = sysMsg;
    while( ( *p > 31 ) || ( *p == 9 ) )
        ++p;
    do { *p-- = 0; } while( ( p >= sysMsg ) &&
        ( ( *p == '.' ) || ( *p < 33 ) ) );

    // Display the message
    wsprintf(str, "%s failed with error %d (%s)",
        msg, eNum, sysMsg );
    showMsg(str);
}
Exemplo n.º 8
0
void main(){
	char buffer2[66];	
	char buffer3[]="massage number X\n";
	char buffer[]={2,0,3,4,5,6,7,8,9,0,11,33,34,35,36,37,38,39,40,41,42,43,44,45,46};
	//
	unsigned short i=48,j=0, m_len=0, flag=0, len=0, X=0;
	int payload = 64, header_size =2; 
	printf("starting.....\n");
	//init_file(src);
	init_modem();
	sleep(1);
	//send_garbage(30);
	//sleep(1);
	len = sizeof(buffer);
	
	while(1){
		//delay(10); 
		sleep(3);
		buffer[len - 3] = i;
		printf("sending massage of length %d, msg is:", len);
		showMsg(buffer, len);
		printf("\n");
		
		sendToModem(buffer, len);
		i++;
		if(i==58) i=48;
		//X = usleep(1000);
		printf("pass usleep\n");
	}//while(1)

}//main
Exemplo n.º 9
0
/**
Inits the vertex declarations, builds the vertex buffers, loads the fonts, creates the sprite, checks caps.
*/
Graphics::Graphics()
{
	// Makes all vertexes ready to use.
	InitAllVertexDeclarations();

	mVB_texture = NULL;
	mVB_Rect	= NULL;

	// Maximum is 16 vertices.
	if(FAILED(gd3dDevice->CreateVertexBuffer(sizeof(TextureVertex) *16, D3DUSAGE_DYNAMIC, 0, D3DPOOL_DEFAULT, &mVB_texture, NULL)))
		MessageBox(0, "Error creating TextureVertex buffer", 0, 0);

	if(FAILED(gd3dDevice->CreateVertexBuffer(sizeof(RectVertex) *16, D3DUSAGE_DYNAMIC, 0, D3DPOOL_DEFAULT, &mVB_Rect, NULL)))
		MessageBox(0, "Error creating RectVertex buffer", 0, 0);

	// Load the font.
	loadDxFont();

	// Create the sprite handler.
	HRESULT result = D3DXCreateSprite(gd3dDevice, &mSpriteHandler);
	if(result != D3D_OK)
		showMsg("Error creating sprite handler");

	buildFastBuffer();

	mCustomFont = new Font();

	checkDeviceCaps();
}
Exemplo n.º 10
0
void D3Cam::on_stopSysBtn_clicked()
{
	if (releaseVRcam())
	{
		showMsg(QStringLiteral("断开成功!"));
		ui.stopSysBtn->setEnabled(false);
		ui.startSysBtn->setEnabled(true);
		
		ui.btnSaveImg->setEnabled(true);
		systemInited = false;
	}
	else
	{
		showMsg(QStringLiteral("断开失败!"));
	}
}
Exemplo n.º 11
0
void SinglePlayerView::onDataError( int code, const QString& description )
{
	showMsg( description );
	emit gameOver();
	QTimer::singleShot( 10, this, SLOT( hideLoading() ) );
	qDebug() << "Loading error" << code << ":" << description;
}
Exemplo n.º 12
0
static void showExc(VALUE exc)
{
	VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
	VALUE bt0 = rb_ary_entry(bt, 0);
	VALUE name = rb_class_path(rb_obj_class(exc));

	VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")",
	                      bt0, exc, name);
	/* omit "useless" last entry (from ruby:1:in `eval') */
	for (long i = 1, btlen = RARRAY_LEN(bt) - 1; i < btlen; ++i)
		rb_str_catf(ds, "\n\tfrom %" PRIsVALUE, rb_ary_entry(bt, i));
	Debug() << StringValueCStr(ds);

	ID id_index = rb_intern("index");
	/* an "offset" argument is not needed for the first time */
	VALUE argv[2] = { rb_str_new_cstr(":") };
	long filelen = NUM2LONG(rb_funcall2(bt0, id_index, 1, argv));
	argv[1] = LONG2NUM(filelen + 1);
	VALUE tmp = rb_funcall2(bt0, id_index, ARRAY_SIZE(argv), argv);
	long linelen = NUM2LONG(tmp) - filelen - 1;
	VALUE file = rb_str_subseq(bt0, 0, filelen);
	VALUE line = rb_str_subseq(bt0, filelen + 1, linelen);
	VALUE ms = rb_sprintf("Script '%" PRIsVALUE "' line %" PRIsVALUE
	                      ": %" PRIsVALUE " occured.\n\n%" PRIsVALUE,
	                      file, line, name, exc);
	showMsg(StringValueCStr(ms));
}
Exemplo n.º 13
0
void main(){
	int fd; 
	char buffer2[66];	
	char buffer3[]="massage number X\n";
	char buffer[]={1,0,0,0,0,6,7,8,9,0,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,10,10};

	unsigned short i=48,j=0, m_len=0, flag=0, len=0, len2=0;
	int payload = 64, header_size =2; 
	printf("starting.....(termios)\n");
	init_file(src);
	fd = init_modem();

	len = sizeof(buffer);
	
	while(1){
		sleep(5);
		buffer[len - 3] = i;
		printf("sending massage of length %d, msg is:", len);
		showMsg(buffer, len);
		printf("\n");
		
		sendToModem(fd, buffer, len);
		i++;
		if(i==58) i=48;
	}//while(1)

}//main
Exemplo n.º 14
0
LRESULT Default_Notify_Callback(UINT nMessage, WPARAM wParam, LPARAM lParam)
{
	UASSERT(nMessage == UWM_SHELLNOTIFY);

	UASSERT(wParam == UTrayIconImpl::ID_DEFAULT);

	if (lParam==WM_RBUTTONDOWN)
	{
		showMsg("Right Button Down!");
	}
	else if (lParam==WM_LBUTTONDBLCLK)
	{
		showMsg("Left Button Down!");
    }

	return 0;
}
Exemplo n.º 15
0
static void showExc(VALUE exc, const BacktraceData &btData)
{
	VALUE bt = rb_funcall2(exc, rb_intern("backtrace"), 0, NULL);
	VALUE msg = rb_funcall2(exc, rb_intern("message"), 0, NULL);
	VALUE bt0 = rb_ary_entry(bt, 0);
	VALUE name = rb_class_path(rb_obj_class(exc));

	VALUE ds = rb_sprintf("%" PRIsVALUE ": %" PRIsVALUE " (%" PRIsVALUE ")",
	                      bt0, exc, name);
	/* omit "useless" last entry (from ruby:1:in `eval') */
	for (long i = 1, btlen = RARRAY_LEN(bt) - 1; i < btlen; ++i)
		rb_str_catf(ds, "\n\tfrom %" PRIsVALUE, rb_ary_entry(bt, i));
	Debug() << StringValueCStr(ds);

	char *s = RSTRING_PTR(bt0);

	char line[16];
	std::string file(512, '\0');

	char *p = s + strlen(s);
	char *e;

	while (p != s)
		if (*--p == ':')
			break;

	e = p;

	while (p != s)
		if (*--p == ':')
			break;

	/* s         p  e
	 * SectionXXX:YY: in 'blabla' */

	*e = '\0';
	strncpy(line, *p ? p+1 : p, sizeof(line));
	line[sizeof(line)-1] = '\0';
	*e = ':';
	e = p;

	/* s         e
	 * SectionXXX:YY: in 'blabla' */

	*e = '\0';
	strncpy(&file[0], s, file.size());
	*e = ':';

	/* Shrink to fit */
	file.resize(strlen(file.c_str()));
	file = btData.scriptNames.value(file, file);

	std::string ms(640, '\0');
	snprintf(&ms[0], ms.size(), "Script '%s' line %s: %s occured.\n\n%s",
	         file.c_str(), line, RSTRING_PTR(name), RSTRING_PTR(msg));

	showMsg(ms);
}
Exemplo n.º 16
0
void DictionaryApp::onEncodeDecode()
{

  if (txtWord.text().length() > 0) {
    word_key_t wordkey = txtWord.text().toUInt();

  } else
    showMsg("Not a valid word");
}
Exemplo n.º 17
0
void main(){
	unsigned char buffer[100];
	unsigned char temp_buffer[100];
	char msg[100];
	int m_len;
	unsigned long error_counter=0;
	init_file(src);
	init_modem();
	printf("starting receiver\n");
	
	//Test Code
	/*int j=0,jj=1;
	for(j;j!=10,jj==1;j++){
			if(j==80) printf("Fail");
			if(jj=1) printf("Success");
	
	}
	exit(0);*/
	//End of Test code
	
	
	while(1){
		m_len = 0;
		if( (m_len = get_modem_frame(buffer)) > 0){
			if(m_len < 3 ) {
				showMsg(buffer, m_len);
				error_counter++;
			}//if(m_len<3)
			if(m_len>3){
				//printf("m_len is:%d\n", m_len);
				showMsg(buffer, m_len);
				//printf("error till now:%ld\n", error_counter);
			}//if(m_len>3)
		
		
		}//if(get_frame>0)
		if(m_len<0) {
			
			printf("m_len is:%d, bad!!", m_len);
		}
	}//while(1)

}//main
Exemplo n.º 18
0
DWORD __stdcall getUserName(TCHAR *uname, DWORD dwSize)
{
    DWORD  bufCharCount = dwSize;

    if( 0 == ::GetUserName( uname, &bufCharCount ) )
    {
        showMsg(TEXT("Cannot GetUserName!"));
        return -1;
    }

    return bufCharCount;
}
Exemplo n.º 19
0
static void rpcCall(String* function, Dict* args, struct Context* ctx, struct Allocator* alloc)
{
    struct AdminClient_Result* res = AdminClient_rpcCall(function, args, ctx->client, alloc);
    if (res->err) {
        Log_critical2(ctx->logger,
                      "Failed to make function call [%s], error: [%s]",
                      AdminClient_errorString(res->err),
                      function->bytes);
        showMsg(res, ctx);
        exit(-1);
    }
    String* error = Dict_getString(res->responseDict, String_CONST("error"));
    if (error && !String_equals(error, String_CONST("none"))) {
        Log_critical2(ctx->logger,
                      "Router responses with error: [%s]\nCalling function: [%s]",
                      error->bytes,
                      function->bytes);
        showMsg(res, ctx);
        exit(-1);
    }
}
Exemplo n.º 20
0
static void runCustomScript(const std::string &filename)
{
	std::string scriptData;

	if (!readFileSDL(filename.c_str(), scriptData))
	{
		showMsg(std::string("Unable to open '") + filename + "'");
		return;
	}

	evalString(newStringUTF8(scriptData.c_str(), scriptData.size()),
	           newStringUTF8(filename.c_str(), filename.size()), NULL);
}
void OCView_MainWin::UpdateData(void)
{
  showMsg();
  showRPM();
  showT1();
  showT2();
  showCurrentLapTime();
  showLastLapTime();
  showBestLapTime();
  showLap();
  showEtap();
  showG();
}
Exemplo n.º 22
0
//thread function with connections check loop
static unsigned __stdcall checkthread(void *dummy)
{

#ifdef _DEBUG
	_OutputDebugString(_T("check thread started"));
#endif
	while(1)
	{
		struct CONNECTION* conn=NULL,*connOld=first,*cur=NULL;
#ifdef _DEBUG
		_OutputDebugString(_T("checking connections table..."));
#endif
		if (WAIT_OBJECT_0 == WaitForSingleObject(killCheckThreadEvent,100))
		{
			hConnectionCheckThread=NULL;
			return 0;
		}

		conn=GetConnectionsTable();
		cur=conn;
		while(cur!=NULL) {	
			if (searchConnection(first,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state)==NULL && (settingStatusMask & (1 << (cur->state-1)))) {				

#ifdef _DEBUG
				TCHAR msg[1024];
				mir_sntprintf(msg,_countof(msg),_T("%s:%d\n%s:%d"),cur->strIntIp,cur->intIntPort,cur->strExtIp,cur->intExtPort);
				_OutputDebugString(_T("New connection: %s"),msg);
#endif
				pid2name(cur->Pid, cur->PName, SIZEOF(cur->PName));
				if ( WAIT_OBJECT_0 == WaitForSingleObject( hExceptionsMutex, 100 ))
				{
					if (checkFilter(connExceptions,cur))
					{
						showMsg(cur->PName,cur->Pid,cur->strIntIp,cur->strExtIp,cur->intIntPort,cur->intExtPort,cur->state);
						SkinPlaySound(PLUGINNAME_NEWSOUND);
					}
					ReleaseMutex(hExceptionsMutex);
				}
			}
			cur=cur->next;
		}

		first=conn;
		deleteConnectionsTable(connOld);
		Sleep(settingInterval);
	}
	hConnectionCheckThread=NULL;
	return 1;
}
void LoginSettingWidget::onOkButtonClicked()
{
    QString ip_addr = dest_addr_edit->text();
    QString port = dest_port_edit->text();

    if(ip_addr.isEmpty() || port.isEmpty()) {
        emit showMsg(Util::EmptyTargetAddrOrPortMsg);
    } else {
        AppSettings settings;
        settings.beginGroup(QString(APP_PARAM_GROUP_TARGET));
        settings.setValue(QString(APP_PARAM_ADDR), ip_addr);
        settings.setValue(QString(APP_PARAM_PORT), port);
        settings.endGroup();
        emit showLogin();
    }
}
Exemplo n.º 24
0
static void printP(int argc, VALUE *argv,
                   const char *convMethod, const char *sep)
{
	VALUE dispString = rb_str_buf_new(128);
	ID conv = rb_intern(convMethod);

	for (int i = 0; i < argc; ++i)
	{
		VALUE str = rb_funcall2(argv[i], conv, 0, NULL);
		rb_str_buf_append(dispString, str);

		if (i < argc)
			rb_str_buf_cat2(dispString, sep);
	}

	showMsg(RSTRING_PTR(dispString));
}
Exemplo n.º 25
0
	u32 Gdl_playSong(u8*rar,u32 rarSize,const char * songPath)
	{	unsigned long size;
		char * file = 0;

		MemoryFile	datarar;
		datarar.data	= rar ;
		datarar.offset	= 0 ;
		datarar.size	= rarSize;

		if(urarlib_get(&file,&size,(char*)songPath,&datarar,0))
			return Gdl_playSong((u8*)file,size);
		#ifdef showMeError
			sprintf(dbg,"cannot uncompress %s from memory rar 0x%x",songPath,rar);
			showMsg(dbg,"error");
		#endif
		return 0;
	}
Exemplo n.º 26
0
/**
Tries create a texture with D3DXCreateTextureFromFileEx(). Prompts a MessageBox if it fails.
@param filename The source file.
@param colorKey The color that represent transparency.
@return The created texture.
*/
IDirect3DTexture9* Graphics::loadTexture(string filename, DWORD colorKey)
{
	IDirect3DTexture9 *texture;		// Texture to return.
	D3DXIMAGE_INFO SrcInfo;			// Optional.

	// Load texture from file image.
	if (FAILED(D3DXCreateTextureFromFileEx(gd3dDevice, filename.c_str(), D3DX_DEFAULT_NONPOW2, D3DX_DEFAULT_NONPOW2, 1, 0, 
        D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, D3DX_FILTER_NONE, D3DX_DEFAULT, 
        colorKey, &SrcInfo, NULL, &texture)))
	{
		char buffer[256];
		sprintf(buffer, "Error loading texture: %s", filename);
		showMsg(buffer);
		return NULL;
	}

	return texture;
}
Exemplo n.º 27
0
u32 Gdl_playSong(const char * songPath)
{	if(!songPath) return 0;
	u32 size;
	#ifdef useUnrarlib
		char*path = (char*)songPath;
		while(*path && *path != '.') path++;
		if(*path)
		{	if(path[1] && (path[1] == 'r' || path[1] == 'R'))
			 if(path[2] && (path[2] == 'a' || path[2] == 'A'))
			  if(path[3] && (path[3] == 'r' || path[3] == 'R')) // .rar found in path
				{	// it's an external rar, now see if we want a specific file..
					char * rpath = (char*)malloc(512);
					memcpy(rpath,songPath,(path-songPath)+4);
					
					if(path[4] == '|')
					{	// extract file path
						char * fpath = &path[5];
						char * file = 0;
						unsigned long size;
						
						//sprintf(z,"rar %s\nfile %s",rpath,fpath);
						//showMsg(z,"zzz");
						if(urarlib_get(&file,&size,fpath,rpath,0))
						{	free(rpath);
							return Gdl_playSong((u8*)file,size);
						}
						#ifdef showMeError
							char * z = rpath+256;
							sprintf(z,"cannot uncompress %s from %s",fpath,rpath);
							showMsg(z,"error");
						#endif
						free(rpath); return 0;
					}
						// not any file specified, see into the rar for a single file..

						free(rpath); return 0;
				}
		}

	#endif
	u8* song = loadFile(songPath,&size);
	if(song) return Gdl_playSong(song,size);
	 else return 0;
}
Exemplo n.º 28
0
PUBLIC void cstart()
{
    showMsg();//set gs first, or you will get error when you show msg
    disp_str("\ncstart-start");
    disp_str("\n");

    set_gdt(0, 0x0000, 0x0000, 0x0000, 0x0000);
    set_gdt(1, 0x0FFF, 0x0000, 0x9A00, 0x00C0);        // code
    set_gdt(2, 0x0FFF, 0x0000, 0x9200, 0x00C0);        // data segment
    set_gdt(3, 0xFFFF, 0x8000, 0x920B|0x6000, 0x00C0); // GS, SET DPL = 3

    disp_int(0x67AB);

    init_gptr();
    init_iptr();
    init_prot();

    disp_str("\ncse");
}
Exemplo n.º 29
0
//HANDLE createSingleInstance(LPCTSTR sName)
void createSingleInstance(LPCTSTR sName)
{
    //HANDLE hMutex = NULL;
    UMutex mutex;
    //hMutex = ::CreateMutex(NULL, TRUE, sName);
    mutex.create(TRUE, NULL, sName);
    //switch (::GetLastError())
    switch (mutex.getErrorCode())
    {
    case ERROR_SUCCESS:
        showMsg(_T("OK!"));
        break;
    case ERROR_ALREADY_EXISTS:
        showError(_T("Already running!"));
        break;
    default:
        break;
    }
    //return hMutex;
}
Exemplo n.º 30
0
int search_string_cmp(char *title, char *search, int len)  // assuming search consists of lowercase only
{
	int rc = 0;
	char c = 0;

#if 0  // some debug message
#ifdef WIKIPCF
	char temp[512];
	memcpy(temp, search, len);
	temp[len] = '\0';
	showMsg(3, "[%s][%s]\n", title, temp);
#endif
#endif

	while (!rc && len > 0)
	{
		c = *title;
		if (c && !is_supported_search_char(c))
		{
			title++;
		}
		else
		{
			if ('A' <= c && c <= 'Z')
				c += 32;
			if (c == *search)
			{
				title++;
				search++;
				len--;
			}
			else if (c > *search)
				rc = 1;
			else
				rc = -1;
		}
	}
	return rc;
}