Example #1
0
Splash* SplashManager::Create(float x, float y, float scale)
{
	for (std::list<Splash*>::iterator it = Splashes.begin(); it != Splashes.end(); ++it)
	{
		// Found a free explosion so re-use it
		if (!(*it)->isInUse())
		{
			(*it)->m_X = x;
			(*it)->m_Y = y;
			(*it)->m_IsVisible = true;
			(*it)->setUsed(true);
			(*it)->SetAnimDuration(SPLASH_ANIM_DURATION);
			(*it)->SetAnimRepeat(1);
			return *it;
		}
	}

	// No explosion found so allocate a new one
	Game* game = (Game*)g_pSceneManager->Find("game");
	Splash* splash = new Splash();
	game->AddChild(splash);
	splash->m_X = x;
	splash->m_Y = y;
	splash->m_Angle = 270.0f;
	splash->m_IsVisible = true;
	splash->setUsed(true);
	splash->SetAnimDuration(SPLASH_ANIM_DURATION);
	splash->SetAnimRepeat(1);
	splash->m_AnchorX = 0.5f;
	splash->m_AnchorY = 0.5f;
	splash->m_ScaleX = (scale * 3) / splash->GetImage()->GetWidth();
	splash->m_ScaleY = splash->m_ScaleX;
	return splash;
}
Example #2
0
MainWindow::MainWindow() : os::Window( os::Rect( 0, 0, 300, 250 ), "main_wnd", "Format" )
{
	os::LayoutView* pcView = new os::LayoutView( GetBounds(), "layout_view" );
	#include "mainwindowLayout.cpp"
	pcView->SetRoot( m_pcRoot );
	AddChild( pcView );

	/* Set Icon */
	os::Resources cCol( get_image_id() );
	os::ResStream *pcStream = cCol.GetResourceStream( "icon48x48.png" );
	os::BitmapImage *pcIcon = new os::BitmapImage( pcStream );
	SetIcon( pcIcon->LockBitmap() );
	delete( pcIcon );


	/* Show Splash Screen */
	Splash* pcWindow = new Splash(LoadImageFromResource("logo.png"),"Format is scanning devices",false,0.0);
	pcWindow->Go();

	/* Clear All */
	m_pcDevice_Selection->Clear();
	m_pcFilesystem_Selection->Clear();
	m_pcVolumename_Text->Clear();
	m_pcArguments_Text->Clear();

	/* Load Devices & Filesystems */
	LoadDevices();
	LoadFilesystems();

	/*  Remove Splash Screen */
	pcWindow->Quit();
}
void LKernel::loadInitialObjects(Splash& splash)
{
	splash.increment("Setting up level manager...");
	Levels::LevelManager* levelManager = addGlobalObject(new Levels::LevelManager());

	// Ogre
	splash.increment("Initialising resources and resource groups...");
	initOgreResources();
	loadOgreResourceGroups();

	// Bullet
	splash.increment("Initialising Bullet physics engine...");
	try
	{
		addGlobalObject(new PhysicsMain());
		//addGlobalObject(new CollisionShapeManager());
		//addGlobalObject(new CollisionReporter());
		//addGlobalObject(new TriggerReporter());
		//addGlobalObject(new PhysicsMaterialFactory());
	}
	catch (...)
	{
		throw std::string("Bullet loading unsuccessful! Try installing the 2010 VC++ Redistributable (x86) - google it!");
	}
}
Example #4
0
/*
 * repeatedly call runner() until all clients are 
 * started then hide splash window
 */
static void runner_cb(void* s) {
	Splash* sp = (Splash*)s;

	if(sp->next_client())
		Fl::repeat_timeout(TIMEOUT_CONTINUE, runner_cb, sp);
	else
		sp->hide();
}
Example #5
0
void Splash::startCb(void * arg)
{
  Splash * self = (Splash*)arg;
  if (self->m_menuOn)
  {
    self->start();
  }
}
Example #6
0
void Splash::showMenuCb(void * arg)
{
  Splash * self = (Splash*)arg;
  if (not self->m_menuOn)
  {
    self->start();
  }
}
Example #7
0
Splash * Splash::copy()
{
    Splash * splash = ArenaHeap::getPtr()->Splashes.New();
    splash->damage = damage;
    splash->range = range;
    splash->setPosition(x,y);

    return splash;
}
Example #8
0
void Splash::optionCb(void * arg)
{
  Splash * self = (Splash*)arg;
  if (self->m_menuOn)
  {
    self->m_hilightItem = 1;
    self->a();
  }
}
Example #9
0
int
main(int argc, char** argv)
{
    QApplication a(argc, argv);
    Splash* s = new Splash;

    s->show();
    return a.exec();
}
void NewGeneMainWindow::displaySplash(bool const opened_as_about_box)
{
	theSplash = new Splash{this, this, opened_as_about_box};

	Splash * view = theSplash;

	Qt::WindowFlags flags = view->windowFlags();
	flags |= Qt::WindowStaysOnTopHint;
	flags |= Qt::SplashScreen;
	flags &= ~Qt::WindowContextHelpButtonHint;
	view->installEventFilter(view);
	view->setWindowFlags(flags);
	view->show();
	//view->activateWindow();
}
Example #11
0
void MainWindow::Format()
{
			/* Show Splash Screen */
			Splash* pcWindow = new Splash(LoadImageFromResource("logo.png"),"Formatting...",false,0.0);
			pcWindow->Go();

			/* Get Device */
			char zDevice[24];
			int nDevice = m_pcDevice_Selection->GetSelection();
			if( nDevice == 0 )
			{
				m_pcFileRequester = new os::FileRequester( os::FileRequester::LOAD_REQ, new os::Messenger( this ), zDevice, os::FileRequester::NODE_FILE, true );
				m_pcFileRequester->Show();
				m_pcFileRequester->MakeFocus();
				printf(zDevice);
			} else {
				sprintf(zDevice, "%s", m_pcDevice_Selection->GetItem(nDevice).c_str());
			}

			/* Get Filesystem */
			int nFilesystem = m_pcFilesystem_Selection->GetSelection();
			char zFilesystem[16];
			sprintf(zFilesystem, "%s", m_pcFilesystem_Selection->GetItem(nFilesystem).c_str());

			/* Get Volumename */
			os::String cVolumename = m_pcVolumename_Text->GetValue();
			char zVolumename[32];
			sprintf(zVolumename, "%s", cVolumename.c_str());

			/* Get Arguments */
			os::String cArguments = m_pcArguments_Text->GetValue();
			char zArguments[64];
			sprintf(zArguments, "%s", cArguments.c_str());

			/* Format */
			if ( initialize_fs( zDevice, zFilesystem, zVolumename, NULL, 0 ) < 0 ) {
				char zError[256];
				sprintf( zError, "%s", strerror(errno));
				os::Alert* pcAlert = new os::Alert( "Format", zError, m_pcIcon->LockBitmap(),0, "_Ok",NULL);
				pcAlert->Go( new os::Invoker( 0 ) );
			}

			/*  Remove Splash Screen */
			pcWindow->Quit();
}
Example #12
0
int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int)
{
	VideoMode vMode(800,600,32);
	RenderWindow win(vMode, "ASTEROIDS");
	win.SetFramerateLimit(120);
	//win.ShowMouseCursor(false);
	win.UseVerticalSync(false);

	int currentScreen = 0;
	Menu menu;

	Game game;

	Splash splash;
	

	while(currentScreen >= 0)
	{
		if (currentScreen == 0)
		{
			currentScreen = splash.Run(win, vMode);
			
		}
		if(currentScreen == 2)
		{
			currentScreen = menu.Run(win, vMode);
		}

		if(currentScreen == 1)
		{
			currentScreen = game.Run(win, vMode);
		}

	}

	return EXIT_SUCCESS;

	
}
Example #13
0
void MeteorAmmo::onEnemyHit(EnemyBase * enemy)
{
	Splash * splash = ArenaHeap::getPtr()->Splashes.New();
	splash->init();
	splash->setDamageType(PHISICAL);
	splash->setDamageValue(damage.value);
	splash->setRange(splashRange);
	splash->setPosition(getX(),getY());

	GamePlayMediator::getPtr()->getArena()->addArenaObject(splash);
	GamePlayMediator::getPtr()->getArena()->removeArenaObject(this);
}
Example #14
0
DWORD Splash::SplashGraphicsDrawEP(PVOID arg)
{
	// Get pointer (less overhead)
	Splash* s = Get();

	// Loop!
	while(true)
	{
		// Clear graphics
		s->_oGrphInf.graphics->Clear((Gdiplus::Color)0);

		// Draw PNGs
		s->DrawPNG(Get()->_pngConBar);
		s->DrawPNG(Get()->_pngMainLogo, &ClrMatrixGlow);
		s->DrawPNG(Get()->_pngNtgaLogo);

		// Draw Text
		s->_oGrphInf.graphics->SetTextRenderingHint(TextRenderingHintAntiAlias);
		s->DrawString(SGETSTRING(R_TITLE), 430, 211, &s->_otpTitle);
		s->DrawString(SGETSTRING(R_SPLASH_STUDIO), 554, 190, &s->_otpStudio);
		s->DrawString(SGETSTRING(VER), 845, 192, &s->_otpVerName);

		s->_oGrphInf.graphics->SetTextRenderingHint(TextRenderingHintClearTypeGridFit);
		s->DrawString(SGETSTRING(VER_N), 843, 188, &s->_otpVer);
		s->DrawString(SGETSTRING(R_LICENSE, L"Qix"), 434, 210, &s->_otpText);
		s->DrawString(s->_wcsStatus, 434, 250, &s->_otpText, false);
		s->DrawString(SGETSTRING(R_COPYRIGHT), 434, 320, &s->_otpText);

		// Call UpdateLayeredWindow
		UpdateLayeredWindow(s->_hwndWindow, s->_oGrphInf.hdcScreen, NULL, &s->_oGrphInf.szSize, s->_oGrphInf.hdcMem, &s->_oGrphInf.ptSrcPos, 0, &s->_oGrphInf.blend, ULW_ALPHA);

		// Sleep!
		Sleep(1000 / R_SPLASH_DRAW_FPS);
	}

	// Return 
	return 0;
}
Example #15
0
void Projectile::emitParticles(const Point3F& from, const Point3F& to, const Point3F& vel, const U32 ms)
{
   if ( mHasExploded )
      return;

   Point3F axis = -vel;

   if( axis.isZero() )
      axis.set( 0.0, 0.0, 1.0 );
   else
      axis.normalize();

   bool fromWater = pointInWater(from);
   bool toWater   = pointInWater(to);

   if (!fromWater && !toWater && bool(mParticleEmitter))                                        // not in water
      mParticleEmitter->emitParticles(from, to, axis, vel, ms);
   else if (fromWater && toWater && bool(mParticleWaterEmitter))                                // in water
      mParticleWaterEmitter->emitParticles(from, to, axis, vel, ms);
   else if (!fromWater && toWater && mDataBlock->splash)     // entering water
   {
      // cast the ray to get the surface point of the water
      RayInfo rInfo;
      if (gClientContainer.castRay(from, to, WaterObjectType, &rInfo))
      {
         MatrixF trans = getTransform();
         trans.setPosition(rInfo.point);

         Splash *splash = new Splash();
         splash->onNewDataBlock(mDataBlock->splash, false);
         splash->setTransform(trans);
         splash->setInitialState(trans.getPosition(), Point3F(0.0, 0.0, 1.0));
         if (!splash->registerObject())
         {
            delete splash;
            splash = NULL;
         }

         // create an emitter for the particles out of water and the particles in water
         if (mParticleEmitter)
            mParticleEmitter->emitParticles(from, rInfo.point, axis, vel, ms);

         if (mParticleWaterEmitter)
            mParticleWaterEmitter->emitParticles(rInfo.point, to, axis, vel, ms);
      }
   }
   else if (fromWater && !toWater && mDataBlock->splash)     // leaving water
   {
      // cast the ray in the opposite direction since that point is out of the water, otherwise
      //  we hit water immediately and wont get the appropriate surface point
      RayInfo rInfo;
      if (gClientContainer.castRay(to, from, WaterObjectType, &rInfo))
      {
         MatrixF trans = getTransform();
         trans.setPosition(rInfo.point);

         Splash *splash = new Splash();
         splash->onNewDataBlock(mDataBlock->splash,false);
         splash->setTransform(trans);
         splash->setInitialState(trans.getPosition(), Point3F(0.0, 0.0, 1.0));
         if (!splash->registerObject())
         {
            delete splash;
            splash = NULL;
         }

         // create an emitter for the particles out of water and the particles in water
         if (mParticleEmitter)
            mParticleEmitter->emitParticles(rInfo.point, to, axis, vel, ms);

         if (mParticleWaterEmitter)
            mParticleWaterEmitter->emitParticles(from, rInfo.point, axis, vel, ms);
      }
   }
}
Example #16
0
BOOL 	CWedApp::InitInstance()

{
	CString str;
	char *ptr;

	//SetDialogBkColor(0x00ff0000, 0xffffff);

	WaitCursor = AfxGetApp()->LoadStandardCursor(IDC_WAIT);
	NormalCursor = AfxGetApp()->LoadStandardCursor(IDC_ARROW);

	GetModuleFileName(AfxGetInstanceHandle(), approot, MAX_PATH);

	CTime ct = CTime::GetCurrentTime();
	CString datestr = ct.Format("%A, %B %d, %Y - %I:%M %p");

	C2N();
	P2N("\r\nStarted WED application at %s\r\n", datestr);
	//P2N("AppRoot=%s\r\n", approot);

	//CString desktop;
	//GetSpecialFolder(CSIDL_DESKTOPDIRECTORY, desktop);
	//desktop += "wed";

	//P2N("Desktop special: %s\r\n", desktop);

	// Create initial desktop xcpt folder
	//if(access(desktop, 0) == -1)
	//	{
	//	P2N("Making %s\r\n", desktop);
	//	//message("Created desktop folder.");
	//	_mkdir(desktop);
	//	}

	ptr = strrchr(approot, '\\');
	if(ptr)
		*(ptr+1) = '\0';

	//dataroot = (CString)approot + "wed\\";

	GetSpecialFolder(CSIDL_PERSONAL, dataroot);
	dataroot += "WedData\\";

	P2N("Wed user data directory: %s\r\n", dataroot);

	if(access(dataroot, 0))
		{
		if(mkdir(dataroot))
			{
			//P2N("Cannot create data root dir\r\n");
			}
		}

	//////////////////////////////////////////////////////////////////////
	// Create data dirs

	str = dataroot; str += "data";

	// Check if data dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create data dir\r\n");
			}
		}
	str = dataroot; str += "macros";
	// Check if data dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create macro dir\r\n");
			}
		}
	str = dataroot; str += "holdings";
	// Check if data dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create holders dir\r\n");
			}
		}
	str = dataroot; str += "coco";
	// Check if coco dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create coco dir\r\n");
			}
		}
	str = dataroot; str += "backup";
	// Check if state dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create state dir\r\n");
			}
		}
	str = dataroot; str += "template";
	// Check if state dir is in order
	if(access(str, 0))
		{
		if(mkdir(str))
			{
			//P2N("Cannot create template dir\r\n");
			}
		}

	//P2N("Started Application: %s %s\r\n",
	//		m_pszAppName, approot);

	getcwd(str.GetBuffer(MAX_PATH), MAX_PATH);
	str.ReleaseBuffer();

	//P2N("Initial dir: %s\r\n", str);

	if (!AfxSocketInit())
		{
		AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
		return FALSE;
		}

	// Initialize OLE 2.0 libraries
	if (!AfxOleInit())
		{
		AfxMessageBox("Failed OLE library init, OLE functions will not be available");
		}
	AfxEnableControlContainer();

#ifdef _AFXDLL
	Enable3dControls();			// Call this when using MFC in a shared DLL
#else
	Enable3dControlsStatic();	// Call this when linking to MFC statically
#endif

	// Change the registry key under which our settings are stored.
	// You should modify this string to be something appropriate
	// such as the name of your company or organization.

	SetRegistryKey(_T("RobotMonkeySoftware"));

	LoadStdProfileSettings(6);  // Load standard INI file options (including MRU)

	// Register the application's document templates.  Document templates
	//  serve as the connection between documents, frame windows and views.

	pDocTemplate = new CMultiDocTemplate(
			IDR_WEDTYPE,
				RUNTIME_CLASS(CWedDoc),
					RUNTIME_CLASS(CChildFrame), // custom MDI child frame
						RUNTIME_CLASS(CWedView));
	AddDocTemplate(pDocTemplate);

	// create main MDI Frame window
	pMainFrame = new CMainFrame;

	if (!pMainFrame->LoadFrame(IDR_MAINFRAME))
		return FALSE;

	// Global
	m_pMainWnd = pMainFrame;

	// Get resources we need:
	// 1. Fonts

	CString fontname = 	GetProfileString(strConfig, strFontName, "Courier");
	int size    =  		GetProfileInt(strConfig,  strFontSize, 10);
	int weight  =  		GetProfileInt(strConfig, strFontWeight, 0);
	int italic  =  		GetProfileInt(strConfig, strFontItalic, 0);

	if(!ff.CreateFont(size, 0, 0, 0, weight, italic, 0, 0,
				0, 0, 0, 0, FIXED_PITCH, fontname))
		{
		AfxMessageBox("Cannot set font");
		}
	if(!ff.GetLogFont(&fflf))
		{
		AfxMessageBox("Cannot get font parameters");
		}

	// 2. Printer fonts
	if(!pp.CreateFont(80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                                FF_MODERN, "system"))
		{
		MessageBox(NULL, "Cannot set font", "Wed", 0);
		}
	if(!pp.GetLogFont(&pplf))
		{
		MessageBox(NULL, "Cannot get font parameters", "Wed", 0);
		}

	// Get colors
	bgcol 	=  GetProfileInt(strConfig,  strColorBg, 	bgcol);
	fgcol 	=  GetProfileInt(strConfig,  strColorFg, 	fgcol);
	selcol 	=  GetProfileInt(strConfig,  strColorSel , 	selcol );
    cselcol =  GetProfileInt(strConfig,  strColorCSel, 	cselcol);
    cadd    =  GetProfileInt(strConfig,  strColorAdd , 	cadd   );
    cdel    =  GetProfileInt(strConfig,  strColorDel , 	cdel   );
    cchg    =  GetProfileInt(strConfig,  strColorChg , 	cchg   );
    comm    =  GetProfileInt(strConfig,  strColorComm, 	comm   );
    srcc    =  GetProfileInt(strConfig,  strColorSrc , 	srcc   );
    clng    =  GetProfileInt(strConfig,  strColorLong, 	clng   );

	// Bimaps
	caret.LoadBitmap(IDB_BITMAP1);
    backwrap  =  GetProfileInt(strConfig,  strBackWrap , 0);
    Tab2Space =  GetProfileInt(strConfig,  strTab2Space, 0);
    tabstop   =  GetProfileInt(strConfig,  strTabStop, 4);

	// Parse command line for standard shell commands, DDE, file open
	CCommandLineInfo cmdInfo;
	ParseCommandLine(cmdInfo);

	if(cmdInfo.m_strFileName != "")
		{
		comline = TRUE;
		OpenDocumentFile(cmdInfo.m_strFileName);
		}
	else
		{
   		// DON'T display a new MDI child window during startup!!!
		cmdInfo.m_nShellCommand = CCommandLineInfo::FileNothing;
		}

	// Dispatch commands specified on the command line
	if (!ProcessShellCommand(cmdInfo))
		return FALSE;

	// Key settings

	// Figure out last usage time ...
	int last = GetProfileInt(strConfig, "strLastUsage", 0);
	use = GetProfileInt(strConfig, "strUsage", 	0);
	//P2N("Usage count %d \r\n", use);

	// First time ever, display initial file
	if(!use)
		{
		OpenDocumentFile("Welcome.txt");
		comline  = TRUE;
		if(currentedit)
			{
			}
		}

	use++;
	CTime tt = CTime::GetCurrentTime();
	CTimeSpan t(tt.GetTime() - (time_t)last);

	//P2N("Time diff of last fire %d -- %d \r\n",
	//	t.GetTotalSeconds(), (int)tt.GetTime());

	YieldToWin() ;

	// Show sign banner only if more then 60 seconds passed
	//if(t.GetTotalSeconds() > 60)
		{
		spp.Create(IDD_DIALOG5, NULL);
 		spp.Show();
		}

	YieldToWin() ;

	//if(GetKeyState(VK_SHIFT))
	//	{
	//	AfxMessageBox("SHIFT HELD on startup\r\n");
	//	return(TRUE);
	//	}

	// The main window has been initialized ...
	// Show and update it.
	m_nCmdShow = GetProfileInt(strConfig, "WindowState", 1);
	pMainFrame->ShowWindow(m_nCmdShow);
	pMainFrame->UpdateWindow();

	int num = GetProfileInt(strSection, strIntItem, 0);

	// De-serialize hash map
	CMap < int, int&, CString, CString& > HashMap;
	CFile cf;
	CString fname;
	fname.Format("%s%s", dataroot, "macros\\hashes.000");
	if( cf.Open( fname, CFile::modeRead))
		{
		CArchive ar( &cf, CArchive::load);
		HashMap.Serialize(ar);
		}
	else
		{
		//P2N("Cannot open hash map file: %s\r\n", fname);
		}
	POSITION rpos;
	rpos = HashMap.GetStartPosition();
	while(rpos)
		{
		int key;
		CString val;
		HashMap.GetNextAssoc(rpos, key, val);
		//P2N("In Hashlist: %x %s\r\n", key, val);
		}

	if(!comline)
		{
		// Reopen old documents:
		CString buf2, file;
		for(int count1 = 1; count1 <= num; count1++)
			{
			CWedDoc *doc = NULL;
			buf2.Format("%d", count1);
			file = GetProfileString(strSection, strStringItem + buf2);
			//P2N("Reloading file: '%s' at %s\r\n", file, buf2);

			// Empty file, no action
			if(file == "")
				continue;

			doc = (CWedDoc*)OpenDocumentFile(file);

			if(YieldToWinEx())
				break;

			//P2N("After Reloading file: %s at %s\r\n", file, buf2);

			if(doc)
				{
				ASSERT_VALID(doc);

				// Document had an error
				if(doc->ssel.m_err)
					break;

				int lrow, lcol;

				lrow = GetProfileInt(strSection,
					strStringItem + buf2 + "row", 0);

				lcol = GetProfileInt(strSection,
					strStringItem + buf2 + "col", 0);

				// Update cursor positions ...
				POSITION pos = doc->GetFirstViewPosition();
				for(;;)
					{
					if(!pos)
						break;
					CWedView *cv = (CWedView*)doc->GetNextView(pos);
					if(cv)
						{
						ASSERT_VALID(cv);
						cv->row = lrow;  cv->col = lcol;
						cv->SyncCaret();
						YieldToWin() ;
						}
					}
				// This happens after load, set it again
				doc->UpdateAllViews(NULL);
				}
			}

	// Try figure out last current directory
	int idx;
	if( (idx = file.ReverseFind('\\')) != -1)
		{
		file = file.Left(idx + 1);
		}
	P2N("CWedApp::InitInstance Chdir: '%s'\r\n", file);
	_chdir(file);
	targdir = srcdir = file;
    }

	message ("Loading macros ...");
	LoadMacros();

	message ("Loading holdings ...");
	LoadHoldings();

	message("");

	return TRUE;
}
Example #17
0
void Game::splash(void)
{
    Splash *splash = new Splash(this->width, this->height);
    splash->show();
    delete splash;
}