Example #1
0
void shutdownDisplay(gDisplay *d) {
  deleteTextures(d);
  deleteFonts();
  // deleteBitmaps(d);
  SystemDestroyWindow(d->win_id);
  printf("window destroyed\n");
}
Example #2
0
//--------------------------------------------------------------
// destructor
mgXPSurface::~mgXPSurface()
{
  deleteTiles();

  // delete the surface bitmap
  if (m_surfaceBitmap != NULL)
  {
    DeleteObject(m_surfaceBitmap);
    m_surfaceBitmap = NULL;
  }

  // delete the surface DC
  SelectObject(m_surfaceDC, (HBITMAP) NULL);
  SelectObject(m_surfaceDC, (HFONT) NULL);
  SelectObject(m_surfaceDC, (HBRUSH) NULL);
  SelectObject(m_surfaceDC, (HPEN) NULL);
  DeleteDC(m_surfaceDC);

  // delete the alpha bitmap
  if (m_alphaBitmap != NULL)
  {
    DeleteObject(m_alphaBitmap);
    m_alphaBitmap = NULL;
  }

  // delete the alpha DC
  SelectObject(m_alphaDC, (HBITMAP) NULL);
  SelectObject(m_alphaDC, (HFONT) NULL);
  SelectObject(m_alphaDC, (HBRUSH) NULL);
  SelectObject(m_alphaDC, (HPEN) NULL);
  DeleteDC(m_alphaDC);

  // delete the cached drawing objects
  deleteFonts();
  deleteBrushes();
  deletePens();
}
Example #3
0
int main(int argc, char* argv[])
{
	srand((unsigned int)time(0));

	int xres = 1024;
	int yres = 768;

	bool usePatch = true;

	for(int i = 1; i < argc; ++i)
	{
		if(!strcmp(argv[i], "-f")) 
			fullscreen = 1;
		else if(!strcmp(argv[i], "-w")) 
			fullscreen = 0;
		else if(!strcmp(argv[i], "-1024") || !strcmp(argv[i], "-1024x768"))
		{
			xres = 1024;
			yres = 768;
		}
		else if(!strcmp(argv[i], "-1280") || !strcmp(argv[i], "-1280x1024"))
		{
			xres = 1280;
			yres = 1024;
		}
		else if(!strcmp(argv[i], "-1280x960"))
		{
			xres = 1280;
			yres = 960;
		}
		else if(!strcmp(argv[i], "-1400") || !strcmp(argv[i], "-1400x1050"))
		{
			xres = 1400;
			yres = 1050;
		}
		else if(!strcmp(argv[i], "-1280x800"))
		{
			xres = 1280;
			yres = 800;
		}
		else if(!strcmp(argv[i], "-1600") || !strcmp(argv[i], "-1600x1200"))
		{
			xres = 1600;
			yres = 1200;
		}
		else if(!strcmp(argv[i], "-1920") || !strcmp(argv[i], "-1920x1200"))
		{
			xres = 1920;
			yres = 1200;
		}
		else if(!strcmp(argv[i], "-2048") || !strcmp(argv[i], "-2048x1536"))
		{
			xres = 2048;
			yres = 1536;
		}
		
		else if(!strcmp(argv[i], "-p"))
			usePatch = true;
		else if(!strcmp(argv[i], "-np"))
			usePatch = false;
	}

	checkConfig();

	/*if(!loadPath())
	{
		getGamePath();
	}
	else
	{
		getGamePath() = loadPath();
	}*/

	getGamePath();
	CreateStrips();

	gLog("[World of Warcraft Studio - Editor] - " APP_TITLE " : " APP_VERSION "\n[World of Warcraft Studio - Editor] - Game path: %s\n[World of Warcraft Studio - Editor] - Game Version: %d\n", gamepath, loadGameVersion());
	GraphicCard(); // Send to Log info about Graphic Card

	checkConfig2();

	vector<string> archiveNames;
	fillArchiveNameVector(archiveNames);
	for(size_t i = 0; i < archiveNames.size(); ++i)
		MPQArchive *archive = new MPQArchive(archiveNames[i].c_str());

	if(gOpenArchives.empty())
	{
		gLog("[World of Warcraft Studio - Editor] - ERROR: No one archive found");
		return 1;
	}

	gAreaDB.open();

	video.init(xres, yres, fullscreen != 0);

	gLog("[World of Warcraft Studio - Editor] - Initializing Ground Effects\n");
	InitGroundEffects();
	gLog("[World of Warcraft Studio - Editor] - Initializing Fonts\n");
	InitFonts();
	gLog("[World of Warcraft Studio - Editor] - Main Initializing complete\n");

	float ftime;
	uint32 t, last_t, frames = 0, time = 0, fcount = 0, ft = 0;
	AppState* as;
	gFPS = 0;

	gLog("[World of Warcraft Studio - Editor] - Creating Menu\n");
	Menu* m = new Menu();
	as = m;

	gStates.push_back(as);

	if(glExtGetGLProcs_VertexProgram_1_0_ARB() == 0)
	{
		gLog("[World of Warcraft Studio - Editor] - Unable to load ARB Vertex Program Code\n");
		return 0;
	}
	loadWaterShader();

	bool done = false;
	t = SDL_GetTicks();
	gLog("[World of Warcraft Studio - Editor] - Entering Main Loop\n");
	while(gStates.size() > 0 && !done)
	{
		last_t = t;
		t = SDL_GetTicks();
		Uint32 dt = t - last_t;
		time += dt;
		ftime = time / 1000.0f;

		as = gStates[gStates.size()-1];

		SDL_Event event;
		while(SDL_PollEvent(&event))
		{
			if(event.type == SDL_QUIT)
				done = true;
			else if(event.type == SDL_MOUSEMOTION)
			{
				if(SDL_GetAppState()&SDL_APPMOUSEFOCUS)
					as->mousemove(&event.motion);
			}
			else if((event.type == SDL_MOUSEBUTTONDOWN || event.type == SDL_MOUSEBUTTONUP) && (SDL_GetAppState()&SDL_APPINPUTFOCUS))
			{	
				if(event.button.type == SDL_MOUSEBUTTONUP)
					as->mouseclick(&event.button);
				else if(SDL_GetAppState()&SDL_APPMOUSEFOCUS)
					as->mouseclick(&event.button);
			}
			else if(event.type == SDL_KEYDOWN || event.type == SDL_KEYUP)
			{
				if(SDL_GetAppState()&SDL_APPINPUTFOCUS)
					as->keypressed(&event.key);
			}
			else if(event.type == SDL_VIDEORESIZE)
				video.resize(event.resize.w, event.resize.h);
		}

		if(SDL_GetAppState()&SDL_APPACTIVE)
		{
			as->tick(ftime, dt / 1000.0f);
			as->display(ftime, dt / 1000.0f);
		}

		if(gPop) 
		{
			gPop = false;
			gStates.pop_back();
			delete as;
		}

		frames++;
		fcount++;
		ft += dt;
		
		if(ft >= 1000)
		{
            float fps = (float)fcount / (float)ft * 1000.0f;
			gFPS = fps;
			char buf[32];
			sprintf_s(buf, APP_TITLE " - %.2f fps", fps);
			SDL_WM_SetCaption(buf, NULL);
            ft = 0;
			fcount = 0;
		}

		video.flip();
	}
	gLog("[World of Warcraft Studio - Editor] - Exited Main Loop\n");

	deleteFonts();
	
	video.close();

	for(deque<MPQArchive*>::iterator it = archives.begin(); it != archives.end(); ++it)
        (*it)->close();
		
	archives.clear();

	gLog("\n[World of Warcraft Studio - Editor] - Exiting.\n");

	return 0;
}
Example #4
0
void shutdownDisplay(Visual *d) {
    deleteTextures(d);
    deleteFonts();
    nebu_Video_Destroy(d->win_id);
    // printf("[video] window destroyed\n");
}