Пример #1
1
MainMenuState::MainMenuState(Vector2 screenSize, ALLEGRO_KEYBOARD_STATE* keyState, ALLEGRO_KEYBOARD_STATE* prevKeyState, ALLEGRO_MOUSE_STATE* mouseState, ALLEGRO_MOUSE_STATE* prevMouseState, ALLEGRO_FONT* font)
    : GameState(screenSize, keyState, prevKeyState, mouseState, prevMouseState)
{

    cout << "Main State initialized" << endl;
    this->font = font;

    background = al_load_bitmap("assets/img/selectGameScreen/Starfield.png");
    leftDoor = GameObject("assets/img/selectGameScreen/Leftblastdoor.png", Vector2(1, 1), 30, Vector2());
    rightDoor = GameObject("assets/img/selectGameScreen/Rightblastdoor.png", Vector2(1, 1), 30, Vector2(457, 0));

    //457 = 559 (size of left door) - 102 (overlap between doors)

    mainButton = Button("assets/img/selectGameScreen/StartButton.png", Vector2(1, 1), 100, "assets/img/selectGameScreen/StartButton.png", Vector2(1, 1), 100, "assets/img/selectGameScreen/StartButtonHover.png", Vector2(2, 1), 100, Vector2(300, 200), true);

    cout << "Main button loaded" << endl;
    opening = false;

    /***********************************************************************************************
     ****************************************** Planets ********************************************
     ***********************************************************************************************/
    Vector2 center = Vector2(getScreenSize().x / 2, getScreenSize().y / 2);
    planets.push_back(PlanetButton("Play", font, "assets/img/gameMenuCircles/Center.png", center, 0, 0, 0.001, 0.001));
    planets.push_back(PlanetButton("Instructions", font, "assets/img/gameMenuCircles/Planet1.png", center, 175, M_PI / 2, 0.0003, 0.002));
    planets.push_back(PlanetButton("Back", font, "assets/img/gameMenuCircles/Planet3.png", center, 350, M_PI, -0.0002, -0.0015));
    planets.push_back(PlanetButton("Quit", font, "assets/img/gameMenuCircles/Planet2.png", center, 410, M_PI, -0.00015, 0.003));
}
void ofAppGLFWWindow::changeMode(){
	//glfwToggleFullscreen();

	if( windowMode == OF_FULLSCREEN){

		nonFullScreenW = ofGetWidth();
		nonFullScreenH = ofGetHeight();

		//----------------------------------------------------
		ofAppGLFWWindow::setWindowShape(getScreenSize().x, getScreenSize().y);
		ofAppGLFWWindow::setWindowPosition(0,0);

		#ifdef TARGET_OSX
			SetSystemUIMode(kUIModeAllHidden,NULL);
		#endif

	}else if( windowMode == OF_WINDOW ){

		ofAppGLFWWindow::setWindowShape(nonFullScreenW, nonFullScreenH);

		//----------------------------------------------------
		// if we have recorded the screen posion, put it there
		// if not, better to let the system do it (and put it where it wants)
		if (nFrameCount > 0){
			ofAppGLFWWindow::setWindowPosition(nonFullScreenX,nonFullScreenY);
		}
		//----------------------------------------------------

		#ifdef TARGET_OSX
			SetSystemUIMode(kUIModeNormal,NULL);
		#endif
	}
}
Пример #3
0
void appl::TextViewer::moveCursorDown(uint32_t _nbLine) {
	if (m_buffer == nullptr) {
		return;
	}
	markToRedraw();
	// check if we are not at the end of Buffer
	if (m_buffer->cursor() == m_buffer->end() ) {
		return;
	}
	// find the position of the start of the line.
	appl::Buffer::Iterator lineStartPos = m_buffer->getStartLine(m_buffer->cursor());
	
	if (m_buffer->getFavoriteUpDownPos() < 0) {
		m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos, m_buffer->cursor()));
	}
	// get the next line :
	appl::Buffer::Iterator nextLineStartPos = m_buffer->countForwardNLines(lineStartPos, _nbLine);
	//APPL_INFO("Move line DOWN result : nextLineStartPos=" << nextLineStartPos);
	// get the display char position
	appl::Buffer::Iterator newPos = getPosSize(nextLineStartPos, m_buffer->getFavoriteUpDownPos());
	//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
	float posStore = m_buffer->getFavoriteUpDownPos();
	moveCursor(newPos);
	m_buffer->setFavoriteUpDownPos(posStore);
}
Пример #4
0
void appl::TextViewer::moveCursorUp(uint32_t _nbLine) {
	if (m_buffer == nullptr) {
		return;
	}
	markToRedraw();
	// find the position of the start of the line.
	appl::Buffer::Iterator lineStartPos = m_buffer->getStartLine(m_buffer->cursor());
	// check if we can go up ...
	if (lineStartPos == m_buffer->begin()) {
		return;
	}
	// Decide what column to move to, if there's a preferred column use that
	if (m_buffer->getFavoriteUpDownPos() < 0) {
		m_buffer->setFavoriteUpDownPos(getScreenSize(lineStartPos, m_buffer->cursor()));
	}
	// get the previous line
	appl::Buffer::Iterator prevLineStartPos = m_buffer->countBackwardNLines(lineStartPos-1, _nbLine);
	//APPL_INFO("Move line UP result : prevLineStartPos=" << prevLineStartPos);
	// get the display char position
	appl::Buffer::Iterator newPos = getPosSize(prevLineStartPos, m_buffer->getFavoriteUpDownPos());
	//APPL_INFO("Move to colomn : column=" << column << " newPos=" << newPos);
	float posStore = m_buffer->getFavoriteUpDownPos();
	moveCursor(newPos);
	m_buffer->setFavoriteUpDownPos(posStore);
}
Пример #5
0
// TODO : Update process time ==> a little expensive (2->4ms) in end of file
void appl::TextViewer::updateScrolling() {
	if (m_buffer == nullptr) {
		return;
	}
	vec2 realCursorPosition(0,0);
	uint32_t lineId = m_buffer->getCursorLinesId();
	m_displayText.clear();
	m_displayText.forceLineReturn();
	float lineSize = -m_displayText.getPos().y();
	for (size_t iii=0; iii<lineId; ++iii) {
		m_displayText.forceLineReturn();
	}
	realCursorPosition.setY(-m_displayText.getPos().y());
	realCursorPosition.setX(getScreenSize(m_buffer->getStartLine(m_buffer->cursor()), m_buffer->cursor()));
	APPL_VERBOSE("position=" << realCursorPosition << " scrool=" << m_originScrooled << " size" << m_size);
	if (realCursorPosition.x() < m_originScrooled.x()+lineSize*2.0f) {
		m_originScrooled.setX(realCursorPosition.x()-lineSize*2.0f);
	} else if (realCursorPosition.x() > m_originScrooled.x()+(m_size.x()-m_lastOffsetDisplay)-lineSize*2.0f-10) {
		m_originScrooled.setX(realCursorPosition.x()-(m_size.x()-m_lastOffsetDisplay)+lineSize*2.0f+10);
	}
	if (realCursorPosition.y() < m_originScrooled.y()+lineSize*2.0f) {
		m_originScrooled.setY(realCursorPosition.y()-lineSize*2.0f);
	} else if (realCursorPosition.y() > m_originScrooled.y()+m_size.y()-lineSize*2.0f) {
		m_originScrooled.setY(realCursorPosition.y()-m_size.y()+lineSize*2.0f);
	}
	m_originScrooled.setMax(vec2(0,0));
	// TODO : Limit min position too ...
}
Пример #6
0
void MainMenuState::Update(GameTime* gameTime)
{
    //Updates
    leftDoor.Update(gameTime);
    rightDoor.Update(gameTime);
    mainButton.Update(gameTime, mouseState, prevMouseState);


    //Open sequence code
    if(opening)
    {
        leftDoor.velocity = Vector2(-0.1, 0);
        rightDoor.velocity = Vector2(0.1, 0);
    }
    else if(mainButton.wasJustReleased())
        opening = true;

    //End state
    if(rightDoor.position.x > getScreenSize().x)
        stop();

    //Planets
    bool anyHovered = false;
    for(unsigned int i = 0; i < planets.size(); i++)
    {
        planets[i].UpdateHover(mouseState, prevMouseState);
        anyHovered = anyHovered || planets[i].isHovered();
    }

    for(unsigned int i = 0; i < planets.size(); i++)
        planets[i].Update(gameTime, anyHovered);

}
void
GfxFeatureMapRequestPacket::printPacket() const
{
   cout << "GfxFeatureMapRequestPacket::printPacket() for map " 
        <<  getMapID() << endl;
   cout << "Bounding box for the GfxFeatureMapRequestPacket:" << endl;
   MC2BoundingBox bbox;
   getMC2BoundingBox(&bbox);
   bbox.dump();
   uint16 x, y;
   getScreenSize(x, y);
   cout << "Screen size (x = " << x << ", y = " 
        << y << ")" << endl;
   cout << "max scaleLevel = " << getMaxScaleLevel() << endl;
   cout << "min scaleLevel = " << getMinScaleLevel() << endl;
   cout << "filt scaleLevel = " << getFiltScaleLevel() << endl;
   cout << "language = " << (int)getLanguage() << endl;
   cout << "nbrNodeIDs " << getNbrNodeIDs() << endl;
   cout << "  isStartAndEnd byte 0x" << hex 
        << int( readByte(isStartAndEnd_POS)) << dec << endl;
   cout << "IgnoreStartOffset " << BP(getIgnoreStartOffset()) << endl;
   cout << "  isStartAndEnd byte 0x" << hex 
        << int(readByte(isStartAndEnd_POS)) << dec << endl;
   cout << "IgnoreEndOffset " << BP(getIgnoreEndOffset()) << endl;
   cout << "StartOffset " << getStartOffset() << endl;
   cout << "EndOffset " << getEndOffset() << endl;
   cout << "NbrReqPackets " << int(getNbrReqPackets()) << endl;
   cout << "DrawOverviewContents " << BP(getDrawOverviewContents()) 
        << endl;
}
Пример #8
0
const char * CNClient::getClientParameters(void)
{
	if (s_sClientParameters.empty())
	{
		s_sClientParameters = "";
		// client-version
		s_sClientParameters.append("client-version=").append(getVersion());
		
		// screen
		CCSize size = getScreenSize();
		CCFloat scale = getScreenScale();
		char szScreen[32];
		memset(szScreen, 0, 32);
		snprintf(szScreen, 32, "%.0fx%.0f@%.1f", size.width, size.height, scale);
		s_sClientParameters.append("&screen=").append(szScreen);
		
		// os
		std::string sOS = std::string(getSystemName()).append("/").append(getSystemVersion());
		s_sClientParameters.append("&os=").append(sOS);
		
		// device
		std::string sDevice = std::string(getDeviceModel()).append("/").append(getHardware());
		s_sClientParameters.append("&device=").append(sDevice);
		
		// imei
		s_sClientParameters.append("&imei=").append(getDeviceIdentifier());
	}
	
	return s_sClientParameters.c_str();
}
Пример #9
0
 Rect DirectorView::getBoundingBox() {
     int height;
     int width;
     
     getScreenSize(width, height);        
     
     return Rect(-width / 2.0f, -height / 2.0f, width / 2.0f, height /2.0f);
 }
Пример #10
0
/*!
 * Computes the down scaling factor that should be applied to the window size to display
 * the image given the resolution of the screen.
 * \param width, height : Image size.
 * \return
 */
unsigned int vpDisplay::computeAutoScale(unsigned int width, unsigned int height)
{
  unsigned int screen_width, screen_height;
  getScreenSize(screen_width, screen_height);
  unsigned int wscale = std::max(1u, (unsigned int)floor(2u*width / screen_width));
  unsigned int hscale = std::max(1u, (unsigned int) floor(2u*height / screen_height));
  unsigned int scale = (unsigned int)std::max(1u, std::max(wscale, hscale));
  return scale;
}
Пример #11
0
float TDDHelper::getBestScale()
{
	
	float designValue = BEST_WIDTH;	// longer one
	Size screenSize = getScreenSize();
	float screenValue = isLandscape() ? screenSize.width : screenSize.height;
	
	return screenValue / designValue;
}
Пример #12
0
//Lua读取配置信息
int Lua_Config(lua_State *pL,const char *filename)
{
	int result=0; 
 
	//加载lua配置文件
    result=luaL_loadfile(pL,filename);
    switch(result){
    case LUA_ERRSYNTAX:
        JY_Error("load lua file %s error: syntax error!\n",filename);
        break;
    case LUA_ERRMEM:
        JY_Error("load lua file %s error: memory allocation error!\n",filename);
        break;
    case LUA_ERRFILE:
        JY_Error("load lua file %s error: can not open file!\n",filename);
        break;    
    }

	result=lua_pcall(pL, 0, LUA_MULTRET, 0);

    lua_getglobal(pL,"CONFIG");            //读取config定义的值
	g_Rotate=getfield(pL,"Rotate");
	g_ScreenBpp=  getfield(pL, "bpp");
    g_charset = getfield(pL, "charset");
	g_FullScreen= getfield(pL, "FullScreen");
	g_XScale=  getfield(pL, "XScale");
 	g_YScale=  getfield(pL, "YScale");
    g_EnableSound =getfield(pL, "EnableSound");
    IsDebug =getfield(pL, "Debug");
    g_MMapAddX =getfield(pL, "MMapAddX");
    g_MMapAddY =getfield(pL, "MMapAddY");
    g_SMapAddX =getfield(pL, "SMapAddX");
    g_SMapAddY =getfield(pL, "SMapAddY");
    g_WMapAddX =getfield(pL, "WMapAddX");
    g_WMapAddY =getfield(pL, "WMapAddY");
    g_SoundVolume =getfield(pL, "SoundVolume");
    g_MusicVolume =getfield(pL, "MusicVolume");

    g_MAXCacheNum =getfield(pL, "MAXCacheNum");
    g_LoadFullS =getfield(pL, "LoadFullS");
    g_LoadMMapType =getfield(pL, "LoadMMapType");
    g_LoadMMapScope =getfield(pL, "LoadMMapScope");
    g_PreLoadPicGrp =getfield(pL, "PreLoadPicGrp");
  
     getfieldstr(pL,"JYMain_Lua",JYMain_Lua);
    
#ifndef WIN32
    getScreenSize(&g_ScreenW, &g_ScreenH);
    setfield(pL, "Width", g_ScreenW);
    setfield(pL, "Height", g_ScreenH);
#else
    g_ScreenW=getfield(pL,"Width");
	g_ScreenH= getfield(pL, "Height");
#endif
	return 0;
}
Пример #13
0
int ofAppGLFWWindow::getWidth(){
	if(windowMode == OF_FULLSCREEN)
	{
		return getScreenSize().x;
	}
	else {
		return windowW;
	}

}
Пример #14
0
int ofAppGLFWWindow::getHeight()
{
	if(windowMode == OF_FULLSCREEN)
	{
		return getScreenSize().y;
	}
	else {
		return windowH;
	}
}
int main(int argc, char* argv[]) {
    getScreenshot(std::string(SCRSHOT_NAME));
    std::this_thread::sleep_for(std::chrono::microseconds(10000)); //give the screenshot script time to run
    int h=0;
    if (SDL_Init(SDL_INIT_VIDEO) < 0 ) {
        printf("Unable to initialize SDL");
        return 1;
    }
    if (!(screen = SDL_SetVideoMode(WIDTH, HEIGHT, DEPTH, SDL_HWSURFACE | SDL_GL_DOUBLEBUFFER | SDL_OPENGL))) {
        SDL_Quit();
        return 1;
    }
#if startFullscreen
    toggleFullscreen();
#endif
    //set up SDL's OpenGL defaults
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE,            8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE,          8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE,           8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE,          8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE,          16);
    SDL_GL_SetAttribute(SDL_GL_BUFFER_SIZE,         32);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_RED_SIZE,      8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_GREEN_SIZE,    8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_BLUE_SIZE,     8);
    SDL_GL_SetAttribute(SDL_GL_ACCUM_ALPHA_SIZE,    8);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLEBUFFERS,  1);
    SDL_GL_SetAttribute(SDL_GL_MULTISAMPLESAMPLES,  2);
    setScreenSize(getImageSize(SCRSHOT_NAME));
    WIDTH = getScreenSize().w;    HEIGHT = getScreenSize().h;
    printf("Screen size detected as: (%d,%d)\n",getScreenSize().w,getScreenSize().h);
    loadGame();
    running = true;
    startFPSCounter();
    startInputListener();
    startAutomaticFiring();
    while(running) {
        drawScreen(screen,h++);
    }
    SDL_Quit();
    return 0;
}
Пример #16
0
	int getScreenType(const Context& context) const {
		Size sz;
		getScreenSize(sz);
		if(sz.width>context.params.longWidth){
			return BIG_SIZE;
		}else if(sz.width<context.params.shortWidth){
			return SMALL_SIZE;
		}else {
			return NORMAL_SIZE;
		}
	}
Пример #17
0
void ViewOrtho(void)											/* Set Up An Ortho View */
{
	unsigned int width,height;
	glMatrixMode(GL_PROJECTION);								/* Select Projection */
	glPushMatrix();												/* Push The Matrix */
	glLoadIdentity();											/* Reset The Matrix */
	getScreenSize(&width,&height);								/* Get actual screen size */
	glOrtho( 0, width , height , 0, -1, 1 );					/* Select Ortho Mode (widthxheight) */
	glMatrixMode(GL_MODELVIEW);									/* Select Modelview Matrix */
	glPushMatrix();												/* Push The Matrix */
	glLoadIdentity();											/* Reset The Matrix */
}
Пример #18
0
void TERMWINDOWMEMBER clearline(int Row, int Attr)
	{
	uint Cols, Rows;

	getScreenSize(&Cols, &Rows);

	position(Row, 0);

	for (int P = 0; P < Cols; P++)
		{
		position(Row, P);
		WinPutChar(' ', Attr, FALSE);
		}
	}
Пример #19
0
void DrawBlur(int times, float inc)								/* Draw The Blurred Image */
{
	unsigned int width,height;
	int num;
	float spost = 0.0f;											/* Starting Texture Coordinate Offset */
	float alphainc = 0.9f / times;								/* Fade Speed For Alpha Blending */
	float alpha = 0.2f;											/* Starting Alpha Value */

	getScreenSize(&width,&height);								/* Get actual screen size */
	/* Disable AutoTexture Coordinates */
	glDisable(GL_TEXTURE_GEN_S);
	glDisable(GL_TEXTURE_GEN_T);

	glEnable(GL_TEXTURE_2D);									/* Enable 2D Texture Mapping */
	glDisable(GL_DEPTH_TEST);									/* Disable Depth Testing */
	glBlendFunc(GL_SRC_ALPHA,GL_ONE);							/* Set Blending Mode */
	glEnable(GL_BLEND);											/* Enable Blending */
	glBindTexture(GL_TEXTURE_2D,BlurTexture);					/* Bind To The Blur Texture */
	ViewOrtho();												/* Switch To An Ortho View */

	alphainc = alpha / times;									/* alphainc=0.2f / Times To Render Blur */

	glBegin(GL_QUADS);											/* Begin Drawing Quads */
	for (num = 0;num < times;num++)								/* Number Of Times To Render Blur */
	{
		glColor4f(1.0f, 1.0f, 1.0f, alpha);						/* Set The Alpha Value (Starts At 0.2) */
		glTexCoord2f(0+spost,1-spost);							/* Texture Coordinate	( 0, 1 ) */
		glVertex2f(0,0);										/* First Vertex		(   0,   0 ) */

		glTexCoord2f(0+spost,0+spost);							/* Texture Coordinate	( 0, 0 ) */
		glVertex2f(0,height);									/* Second Vertex	(   0, height ) */

		glTexCoord2f(1-spost,0+spost);							/* Texture Coordinate	( 1, 0 ) */
		glVertex2f(width,height);								/* Third Vertex		( width, height ) */

		glTexCoord2f(1-spost,1-spost);							/* Texture Coordinate	( 1, 1 ) */
		glVertex2f(width,0);									/* Fourth Vertex	( width,   0 ) */

		spost += inc;											/* Gradually Increase spost (Zooming Closer To Texture Center) */
		alpha = alpha - alphainc;								/* Gradually Decrease alpha (Gradually Fading Image Out) */
	}
	glEnd();													/* Done Drawing Quads */

	ViewPerspective();											/* Switch To A Perspective View */

	glEnable(GL_DEPTH_TEST);									/* Enable Depth Testing */
	glDisable(GL_TEXTURE_2D);									/* Disable 2D Texture Mapping */
	glDisable(GL_BLEND);										/* Disable Blending */
	glBindTexture(GL_TEXTURE_2D,0);								/* Unbind The Blur Texture */
}
Пример #20
0
BOOL APIENTRY
DllMain(HINSTANCE hinstDLL, DWORD ul_reason_for_call, LPVOID lpReserved)
{
	switch (ul_reason_for_call)
	{
		case DLL_PROCESS_ATTACH:
			// remember our instance handle
			g_instance = hinstDLL;

			g_mutex = CreateMutex(NULL, FALSE, "Local\\SeamlessDLL");
			if (!g_mutex)
				return FALSE;

			WaitForSingleObject(g_mutex, INFINITE);
			++g_instance_count;
			ReleaseMutex(g_mutex);

			g_wm_seamless_focus_request = RegisterWindowMessage(FOCUS_REQUEST_MSG_NAME);
			g_wm_seamless_focus_release = RegisterWindowMessage(FOCUS_RELEASE_MSG_NAME);

			g_internal_window = get_internal_window();

			vchannel_open();
			getScreenSize();

			break;

		case DLL_THREAD_ATTACH:
			break;

		case DLL_THREAD_DETACH:
			break;

		case DLL_PROCESS_DETACH:
			vchannel_write("DESTROYGRP", "0x%08lx, 0x%08lx", GetCurrentProcessId(), 0);

			WaitForSingleObject(g_mutex, INFINITE);
			--g_instance_count;
			ReleaseMutex(g_mutex);

			vchannel_close();

			CloseHandle(g_mutex);

			break;
	}

	return TRUE;
}
Пример #21
0
void windowManager::init()
{
	std::cout << "Starting GLFW context, OpenGL 3.3" << std::endl;
	// Init GLFW
	if (!glfwInit()) {
		std::cerr << "GLFW failed to init" << std::endl;
		exit(0);
	}
#ifdef COMPATABILITY
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 2);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 1);
#else
	// Set all the required options for GLFW
	glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3);
	glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3);
	glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE);
	glfwWindowHint(GLFW_RESIZABLE, GL_FALSE);
	glfwWindowHint(GLFW_SAMPLES, 4);
#endif

	getScreenSize();

	// Create a GLFWwindow object that we can use for GLFW's functions
	currentWindow = glfwCreateWindow(width, height, "viewer", NULL, NULL);
	glfwMakeContextCurrent(currentWindow);
#ifdef COMPATABILITY
#else
	glfwSetInputMode(currentWindow, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
#endif

	// Set this to true so GLEW knows to use a modern approach to retrieving function pointers and extensions
	glewExperimental = GL_TRUE;
	// Initialize GLEW to setup the OpenGL Function pointers
	if (glewInit() != GLEW_OK) {
		std::cerr << "GLEW failed to init" << std::endl;
		exit(0);
	}

	// Define the viewport dimensions
	glViewport(0, 0, width, height);

	glEnable(GL_DEPTH_TEST);
	glfwWindowHint(GLFW_SAMPLES, 4);
	glEnable(GL_STENCIL_TEST);
	glEnable(GL_CULL_FACE);
}
Пример #22
0
void RenderToTexture()											/* Renders To A Texture */
{
	unsigned int width,height;
	glViewport(0,0,128,128);									/* Set Our Viewport (Match Texture Size) */

	ProcessHelix();												/* Render The Helix */

	glBindTexture(GL_TEXTURE_2D,BlurTexture);					/* Bind To The Blur Texture */

	/* Copy Our ViewPort To The Blur Texture (From 0,0 To 128,128... No Border) */
	glCopyTexImage2D(GL_TEXTURE_2D, 0, GL_LUMINANCE, 0, 0, 128, 128, 0);

	glClearColor(0.0f, 0.0f, 0.5f, 0.5);						/* Set The Clear Color To Medium Blue */
	glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);			/* Clear The Screen And Depth Buffer */
	getScreenSize(&width,&height);								/* Get actual window size */
	glViewport(0 , 0,width,height);								/* Set Viewport (0,0 to widthxheight) */
}
Пример #23
0
void XDO::mouseMoveRelative(int xDiff, int yDiff) {
  auto size = getScreenSize();
  auto loc = getMouseLocation();

  loc.first += xDiff;
  loc.second += yDiff;

  if(loc.first < 0)
    loc.first = 0;
  else if(loc.first > (signed int)size.first)
    loc.first = size.first - 1;

  if(loc.second < 0)
    loc.second = 0;
  else if(loc.second > (signed int)size.second)
    loc.second = size.second - 1;

  xdo_move_mouse(xdo_, loc.first, loc.second,0);
}
Пример #24
0
Point TDDHelper::getAlignPoint(float x, float y, TDDAlign halign, TDDAlign valign)
{
	Size size = getScreenSize();
	
	// Horizon
	if(halign == eTDDLeft) {
		x = size.width - x;
	} else if (halign == eTDDCenter) {
		x = size.width / 2 + x;
	}
	
	log("getAlignPoint: h=%f w=%f", size.height, size.width);
	
	// Vertical
	if(valign == eTDDTop) {
		y = size.height - y;
	} else if (valign == eTDDMiddle) {
		y = size.height / 2 + y;
	}
	
	 log("getAlignPoint: x=%f y=%f", x, y);
	
	return Point(x, y);
}
Пример #25
0
int main(int argc, char* argv[])
{
    uint16_t size[2];
    uint16_t* width = &size[0];
    uint16_t* height = &size[1];
    int i;
    pthread_t ntid;

    clearScreen();
    getScreenSize(width, height);

//    printf("%d X %d\n", *width, *height);

    pthread_mutex_init(&mut,NULL); 
    for (i = 1; i < *width; i++) {
        if (i % 2 == 0) {
            uint16_t* arg = malloc(sizeof(uint16_t) * 2);
            arg[0] = *height;
            arg[1] = i;
            pthread_create(&ntid, NULL, threadFunc, arg);
        } 
    }
    while (1);
}
Пример #26
0
bool ApplicationDesktop::init()
{
    if(SDL_Init(0) < 0){
        // ToDo: Error handling
    }

    // ToDo: Maybe this stuff will be moved back to renderer
    //       in this case ther would be a renderer for desktop and android

    if (SDL_InitSubSystem(SDL_INIT_VIDEO) < 0){ /* Initialize SDL's Video subsystem */
        LOG(ERROR) << "SDL Video subsystem could not been initialized.";
        return false;
    }

    //Request opengl 4.2 context.
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
    SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 2);
 
    //Turn on double buffering with a 24bit Z buffer.
    SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);

    // R8G8B8A8
    SDL_GL_SetAttribute(SDL_GL_RED_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_GREEN_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_BLUE_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_ALPHA_SIZE, 8);
    SDL_GL_SetAttribute(SDL_GL_DEPTH_SIZE, 24);


    // Create the window
    mainwindow = SDL_CreateWindow("OpenGLTest", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
        getScreenSize().x, getScreenSize().y, SDL_WINDOW_OPENGL | SDL_WINDOW_SHOWN);
    if (!mainwindow){ /* Die if creation failed */
        LOG(ERROR) << "Main window could not been created" << std::endl;
        return false;
    }

   // create the OpenGL context
    maincontext = SDL_GL_CreateContext(mainwindow);

    // Swap in sync with the refresh rate
    SDL_GL_SetSwapInterval(1);

    glewExperimental = true; // Needed for core profile
    if (glewInit() != GLEW_OK) {
        LOG(ERROR) << "Glew initialization failed.";
        return false;
    }

    const GLubyte* versionStr = glGetString(GL_VERSION);

    LOG(INFO) << "OpenGL Version = " << versionStr;

    if( !getRenderer().init() ){
        return false;
    }

    createObjects();

    return true;
}
Пример #27
0
void
SoCylinder::computeRing(SoAction *action, int &numSides, int &numSections,
			SbVec2f *&ringCoords) const
//
////////////////////////////////////////////////////////////////////////
{
    float	complexity = SoComplexityElement::get(action->getState());
    float	theta, dTheta;
    int		side;

    // In object space, just base number of divisions on complexity
    if (SoComplexityTypeElement::get(action->getState()) ==
	SoComplexityTypeElement::OBJECT_SPACE) {

	// If complexity is between 0 and .5 (inclusive), use 1 section
	// and between 3 and 16 sides:
	if (complexity <= 0.5) {
	    numSections = 1;
	    numSides    = (int) (complexity * 26.0 + 3.0);
	}

	// If complexity is between .5 and 1, use between 1 and 8 sections
	// and between 16 and 64 sides:
	else {
	    numSections = (int) (14.0 * complexity - 6.0);
	    numSides    = (int) (complexity * 96.0 - 32.0);
	}
    }

    // In screen space, set the number of sides/sections based on the
    // complexity and the size of the cylinder when projected onto the screen.
    else {
	SbVec2s		rectSize;
	short		maxSize;
	float		radius, halfHeight;

	getSize(radius, halfHeight);
	SbVec3f		p(radius, halfHeight, radius);

	getScreenSize(action->getState(), SbBox3f(-p, p), rectSize);

	maxSize = (rectSize[0] > rectSize[1] ? rectSize[0] : rectSize[1]);

	numSections = 1 + (int) (0.2  * complexity * maxSize);
	numSides    = 3 + (int) (0.25 * complexity * maxSize);
    }

    // Make sure the current storage for ring coordinates is big enough
    if (numSides > maxCoords) {

	if (maxCoords > 0)
	    delete [] coordsArray;

	maxCoords = numSides;

	coordsArray = new SbVec2f[maxCoords];
    }

    ringCoords = coordsArray;

    // Compute x and z coordinates around ring
    theta  = 0.0;
    dTheta = 2.0 * M_PI / numSides;
    for (side = 0; side < numSides; side++) {
	ringCoords[side].setValue(sin(theta), -cos(theta));
	theta += dTheta;
    }
}
Пример #28
0
void setscreen(void)
	{
#ifndef WINCIT
	int mode;
	union REGS REG;
	static uchar heightmode = 0;
	static uchar scanlines = 0;
	char mono = 0;
	char far *CrtHite = (char far *) 0x00400085L;

	if (!cfg.restore_mode)
		{
		heightmode = 0;
		scanlines = 0;
		}

	if (gmode() == 7)
		{
		mono = TRUE;
		}

	if (!heightmode)
		{
		if (*CrtHite == 8)
			{
			heightmode = 0x012;
			}
		else if (*CrtHite == 14)
			{
			heightmode = 0x011;
			}
		else if (*CrtHite == 16)
			{
			heightmode = 0x014;
			}
		}

	if (scanlines)
		{
		REG.h.ah = 0x12;			// Video function:
		REG.h.bl = 0x30;			// Set scan lines
		REG.h.al = scanlines;		// Num scan lines
		int86(0x10, &REG, &REG);
		}

	if (heightmode && conMode != -1)	// make sure heightmode is set
		{
		// conMode 1000 --> EGA 43 line, or VGA 50 line

		REG.h.ah = 0x00;
		REG.h.al = (uchar) ((conMode >= 1000) ? 3 : conMode);
		int86(0x10, &REG, &REG);

		// Set to character set 18, (EGA 43 line, or VGA 50 line)
		if (conMode == 1000)
			{
			REG.h.ah = 0x11;
			REG.h.al = 18;
			REG.h.bl = 0x00;
			int86(0x10, &REG, &REG);
			}
		else
			{
			REG.h.ah = 0x11;
			REG.h.al = heightmode;
			REG.h.bl = 0x00;
			int86(0x10, &REG, &REG);
			}
		}

	if (!scanlines)
		{
		getScreenSize(&conCols, &conRows);

		if (!mono)
			{
			if (conRows == 24)
				{
				if (*CrtHite == 14) scanlines = 1;	// Old char set
				if (*CrtHite == 16) scanlines = 2;	// Vga char set
				}

			if (conRows == 42) scanlines = 1;
			if (conRows == 49) scanlines = 2;
			}
		else
			{
			if (conRows == 24) scanlines = 1;
			if (conRows == 27) scanlines = 2;		// herc only
			if (conRows == 42) scanlines = 1;
			}
		}

	mode = gmode();
	conMode = (mode == 3 && conMode >= 1000) ? conMode : mode;

	if (mode == 7)
		{
		physScreen = (char far *) 0xB0000000L;		// mono
		logiScreen = saveBuffer ? saveBuffer : physScreen;
		}
	else
		{
		physScreen = (char far *) 0xB8000000L;		// cga
		logiScreen = saveBuffer ? saveBuffer : physScreen;
		setborder(cfg.battr);
		}

	dgLogiScreen = logiScreen;

	getScreenSize(&conCols, &conRows);

	scrollpos = conRows - StatusLine.Height();

	if (cfg.bios)
		{
		charattr = bioschar;
		stringattr = biosstring;
		}
	else
		{
		charattr = directchar;
		stringattr = directstring;
		}

	OC.ansiattr = cfg.attr;
#endif
	}
Пример #29
0
void ofAppGLFWWindow::setupOpenGL(int w, int h, int screenMode){

	requestedWidth = w;
	requestedHeight = h;
	

	if(!glfwInit( )){
		ofLog(OF_LOG_ERROR,"cannot init GLFW");
		return;
	}

	printf("WINDOW MODE IS %i", screenMode);

	windowMode = screenMode;

	glfwOpenWindowHint( GLFW_FSAA_SAMPLES, samples );
	// targets					default
	// GLFW_REFRESH_RATE			0
	// GLFW_ACCUM_RED_BITS;			0
	// GLFW_ACCUM_GREEN_BITS;		0
	// GLFW_ACCUM_BLUE_BITS;		0
	// GLFW_ACCUM_ALPHA_BITS;		0
	// GLFW_AUX_BUFFERS;			0
	// GLFW_STEREO;					0
	// GLFW_WINDOW_NO_RESIZE;		0
	// GLFW_FSAA_SAMPLES;			0

	int result;
	if (windowMode == OF_WINDOW){
		result = glfwOpenWindow(
		          w, h,          // Width and height of window
		          8, 8, 8,           // Number of red, green, and blue bits for color buffer
		          8,                 // Number of bits for alpha buffer
		          32,                // Number of bits for depth buffer (Z-buffer)
		          0,                 // Number of bits for stencil buffer
		          GLFW_WINDOW        // We want a desktop window (could be GLFW_FULLSCREEN)
		      );
	}else if(windowMode == OF_FULLSCREEN){
		result = glfwOpenWindow(
				  getScreenSize().x, getScreenSize().y,          // Width and height of window
				  8, 8, 8,           // Number of red, green, and blue bits for color buffer
				  8,                 // Number of bits for alpha buffer
				  32,                // Number of bits for depth buffer (Z-buffer)
				  0,                 // Number of bits for stencil buffer
				  GLFW_FULLSCREEN        // We want a desktop window (could be GLFW_FULLSCREEN)
			  );
		showCursor();
	}else if(windowMode == OF_GAME_MODE){
		result = glfwOpenWindow(
				  w, h,          // Width and height of window
				  8, 8, 8,           // Number of red, green, and blue bits for color buffer
				  8,                 // Number of bits for alpha buffer
				  32,                // Number of bits for depth buffer (Z-buffer)
				  0,                 // Number of bits for stencil buffer
				  GLFW_FULLSCREEN        // We want a desktop window (could be GLFW_FULLSCREEN)
			  );
		showCursor();
	}
	else
	{
		printf("**** invalid windowMode\n");
	}
	
	if ( result != GL_TRUE )
	{
		printf("**** failed to open glfw window\n");
	}
	else
		printf("*--- opened glfw window\n");

	setVerticalSync(false);
	// Set window title
	glfwSetWindowTitle( " " );

	glfwEnable( GLFW_KEY_REPEAT );

	// ofBackground(200,200,200);		// default bg color
	// ofSetColor(0xFFFFFF); 			// default draw color
	// used to be black, but
	// black + texture = black
	// so maybe grey bg
	// and "white" fg color
	// as default works the best...

	requestedHeight = requestedHeight < 1 ? 1 : requestedHeight;
	glfwGetWindowSize( &requestedWidth, &requestedHeight );
	
	

	nonFullScreenW = ofGetWidth();
	nonFullScreenH = ofGetHeight();
	
	

	glfwGetWindowSize( &windowW, &windowH );
		
    setWindowPosition(50, 50);
	
}
Пример #30
0
//try to launch RDM
int startRDM() {
    DEBUGMSG(1, (L"Entering startRDM()\n"));
    int cnt=0; //repeat counter
    BOOL isOK = FALSE;
    int iRet=0;

    do {
        cnt++;
        //if tsc is already running, kill it

        //first ensure TSSHELLWND is not minimized or connect will hang (why?)
#if _WIN32_WCE == 0x420
        HWND hwndTSC = FindWindow(L"UIMainClass", NULL);//FindWindow(NULL, L"Terminal Services Client");
        if(hwndTSC==NULL)
            hwndTSC = FindWindow(NULL, L"Terminal Services Client");
        //at start we see the 'connect' dialog
        //in a connected session the class and title changes!
#else
        HWND hwndTSC = FindWindow(L"TSSHELLWND",NULL);
#endif
        DEBUGMSG(1, (L"TSC is running as window: 0x%08x\n",hwndTSC));

        if(hwndTSC!=NULL)
            ShowWindow(hwndTSC, SW_SHOWNORMAL);
#if _WIN32_WCE == 0x420
        if(IsProcessRunning(L"mstsc40.exe")) {		//on pocketpc we have mstsc40.exe
            if( KillExeWindow(L"mstsc40.exe") ) {
#else
        if(IsProcessRunning(L"wpctsc.exe")) {
            if( KillExeWindow(L"wpctsc.exe") ) {
#endif
                //killedit OK
                Sleep(1000);
            }
            else {
                //was unable to kill
                iRet = -1; //unable to kill wpctsc
                continue;
            }
        }

        //write defaults to REG and default.rdp
        writeRDP();
        writeMRU(); //ensure at least one entry is in MRU

        DWORD dProcIDTSC=0; //to save proc ID of TSC main window
        //start a new instance of tsc
        PROCESS_INFORMATION pi;
#if _WIN32_WCE == 0x420
        if (CreateProcess(L"\\windows\\mstsc40.exe", L"", NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)!=0)
#else
        if (CreateProcess(L"\\windows\\wpctsc.exe", L"", NULL, NULL, FALSE, 0, NULL, NULL, NULL, &pi)!=0)
#endif
        {
            //OK
            Sleep(1000); //give some time to setup
            CloseHandle(pi.hThread);
            CloseHandle(pi.hProcess);
        }
        else
        {
            //start failed
            iRet = -2; //unable to start wpctsc
            continue;
        }

        //find the "Remote Desktop Mobile" dialog window
#if _WIN32_WCE == 0x420
        DWORD pidTSC = FindPID(L"mstsc40.exe");
#else
        DWORD pidTSC = FindPID(L"wpctsc.exe");
#endif
        HWND hTscDialog = getTscDialog(pidTSC);  //FindWindow(L"Dialog", NULL);

        if(hTscDialog!=NULL) {
            //check if this is the right window
#if _WIN32_WCE == 0x420
            if(FindPID(L"mstsc40.exe") != 0) {
                if(FindPID(hTscDialog)!= FindPID(L"mstsc40.exe")) {
#else
            if(FindPID(L"wpctsc.exe") != 0) {
                if(FindPID(hTscDialog)!= FindPID(L"wpctsc.exe")) {
#endif
                    iRet = -4; //error finding TSC dialog
                    continue;
                }
                else {
#ifdef DEBUG
                    DEBUGMSG(1, (L" ### ScanTSCwindow ### \r\n"));
                    scanTscWindow(hTscDialog); //scan TSC window and list child windows and CtrlIDs
                    DEBUGMSG(1, (L" --- ScanTSCwindow --- \r\n"));
#endif
                    isOK=TRUE;
                    iRet=0;
                }
            }
        }
        else {
            iRet = -3; //could not find tsc dialog
            continue;
        }
    }
    while (!isOK && cnt<3);
    DEBUGMSG(1, (L"Leaving startRDM() with code: %i\n", iRet));
    return iRet;
}

/*
TSC dialog elements:
	class		text		ctrlID
	"Dialog"  ""	0x0
	"static"  "Status:"	0x40e
	"static"  "Not connected"	0x410		//status

	"combobox"  "192.168.0.2"	0x403		//Computer COMBO BOX!
	"Edit"  "192.168.0.2"	0x3e9			//Computer
	"sbedit"  "rdesktop"	0x3ef			//Username
	"sbedit"  "Intermec+2004"	0x3f0		//Password
	"sbedit"  ""	0x3f1					//Domain
	"Button"  "Save password"	0x3f2		//scave pw option

	"static"  "Computer:"	0x3f7
	"static"  "User name:"	0x3f8
	"static"  "Password:"******"static"  "Domain:"	0x3fa
	"SIPPREF"  "SIP1"	0x41c
*/

/*
	For PPC2003

	 ### ScanTSCwindow ###
	"Dialog"  "Terminal Services Client"	0x0
	"static"  "Server:"	0xffff
	"Edit"  "192.168.128.5"	0x28e
	"static"  "Recent servers:"	0xffff
	"listbox"  ""	0x294
	"Button"  "Connect"	0x290
	"Button"  "Limit size of server desktop to fit on this screen"	0x421
*/
//######################### Main Function ##############################


int startTSC()
{
    TCHAR* szHWID = new TCHAR[MAX_PATH];
    GetUUID(szHWID);

    LRESULT lRes=0;
#ifdef DEBUG1
    writeReg(); //write default settings to reg
#endif
    readReg();

    //get the screen size
    getScreenSize();

    int iRet = startRDM();
    if (iRet != 0)
        return iRet;

    HWND hTscDialog = FindWindow(L"Dialog", NULL);

    //fill in the values

    //find window handle to each control and send new values
    //use know CtrlIDs to send DlgItem-messages
    TCHAR strText[MAX_PATH];

    //EnableWindow(hTscDialog, FALSE);

    //int idDlgItem = GetDlgCtrlID(hDialogItem);
    // use this or SendMessage with handle of control
    //WM_SETTEXT wParam = 0; lParam = (LPARAM)(LPCTSTR) lpsz;
    wsprintf(strText, L"start filling fields");
    SendDlgItemMessage(hTscDialog, 0x3f1, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) strText);
    Sleep(500);
    UpdateWindow(hTscDialog);
#if _WIN32_WCE == 0x420
    //fill in the server
    setDlgText(hTscDialog, myDlgItems[0].szValue, myDlgItems[0].dwCtrlID);
    //use fit to screen?
    if(g_bUseFitToScreen) {
        if(wcscmp(myDlgItems[1].szValue, L"1")==0) {
            lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[1].dwCtrlID), BM_SETCHECK, BST_CHECKED, 0);
            DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[1].szLabel, lRes));
        }
    }
    else {
        //uncheck "Limit size of server desktop to fit on this screen
        lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[1].dwCtrlID), BM_SETCHECK, BST_UNCHECKED, 0);
        DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[1].szLabel, lRes));
    }
#else
    for (int i=0; i < COUNT_DLG_ITEMS; i++) {

        if(i!=4) { //special handling or the checkbox
            setDlgText(hTscDialog, myDlgItems[i].szValue, myDlgItems[i].dwCtrlID);

            //lRes = SendDlgItemMessage(hTscDialog, myDlgItems[i].dwCtrlID, WM_SETTEXT, 0, (LPARAM)(LPCTSTR) myDlgItems[i].szValue);
            //DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes));
        }
        else
        {
            //change the Save Password checkbox
            if(wcscmp(myDlgItems[i].szValue, L"1")==0) {
                lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), BM_SETCHECK, BST_CHECKED, 0);
                DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes));
            }
            else {
                lRes = SendMessage(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), BM_SETCHECK, BST_UNCHECKED, 0);
                DEBUGMSG(1, (L"Changing: '%s', lRes=0x%0x\n",myDlgItems[i].szLabel, lRes));
            }
        }
        UpdateWindow(hTscDialog);
        EnableWindow(GetDlgItem(hTscDialog, myDlgItems[i].dwCtrlID), FALSE);
        Sleep(500);
    }
#endif
    //SetForegroundWindow(hTscDialog);

    Sleep(300);

    //working solution one to start the Connect
    //hacked by ceSpy: send RDM WM_USER+1001 with wParam=0 and lParam=0, works if one manually connect was OK
    //SendMessage(FindWindow(L"TSSHELLWND", NULL), WM_USER+1001, 0, 0);
    //test with WM_KEY...DOES not work
    //SendMessage(GetDesktopWindow(), WM_KEYDOWN, VK_F1, 0);
    //Sleep(10);
    //SendMessage(GetDesktopWindow(), WM_KEYUP, VK_F1, 0);

#if _WIN32_WCE == 0x420
    //we can use the connect button to connect
    HWND hwndButton = GetDlgItem(hTscDialog, myDlgItems[2].dwCtrlID);
    SendMessage(hwndButton, BM_CLICK, 0, 0);
#else
    if(bUseMouseClick) {
        //Solution two with mouse_event, click at 13,306. The 13 comes from the assumption that hight of
        //menu bar is 26 pixel and I want to click in the mid
        //this solution does work as keyb_event does work
        //	normalized coordinates:
        //	(0,0) = upper left corner
        //	(0xFFFF,0xFFFF) = lower right corner
        DWORD dX = (0xFFFF / iScreenWidth) * (80); // changed from 13 to width=240, 1/3=80
        DWORD dY = (0xFFFF / iScreenHeight) * (iScreenHeight - 13);
        DEBUGMSG(1, (L"mouse click at: %u, %u\n", dX * 0xFFFFFFFF / 240, dY * 0xFFFFFFFF / 320));
        //SetForegroundWindow(hTscDialog); //dont mess with windows z-order

        //this will make a cursor visible
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, dX, dY, 0, 0);
        Sleep(5);
        mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, dX, dY, 0, 0);
        Sleep(30);
        /*
        //this is what happens, if you tap the screen
        mouse_event(MOUSEEVENTF_TOUCH | MOUSEEVENTF_LEFTDOWN, dX, dY, 0, 0);
        mouse_event(MOUSEEVENTF_TOUCH | MOUSEEVENTF_LEFTUP, dX, dY, 0, 0);
        //Sleep(3000);
        */
    }
    else {

        //Solution three, best solution, ensure you use the scancode value too! AFAIK the scancode for F1 is always 0x70

        keybd_event(VK_F1, 0x70, 0, 0);
        Sleep(30);
        keybd_event(VK_F1, 0x70, KEYEVENTF_KEYUP, 0);

    }//bUseMouseClick
#endif
    /*
    		//test with WM_LBUTTONDOWN, did not work
    		HWND hClickWnd = FindWindow(L"TSSHELLWND", NULL);
    		lRes = PostMessage(hClickWnd, WM_LBUTTONDOWN, MK_LBUTTON, MAKELPARAM(60,307));
    		DEBUGMSG(1, (L"SendMessage(WM_LBUTTONDOWN, MK_LBUTTON) Result=0x%0x, GetLastError=0x%0x\n", lRes, GetLastError()));
    		Sleep(30);
    		lRes = PostMessage(hClickWnd, WM_LBUTTONUP, MK_LBUTTON, MAKELPARAM(60,307));
    		DEBUGMSG(1, (L"SendMessage(WM_LBUTTONUP, MK_LBUTTON) Result=0x%0x, GetLastError=0x%0x\n", lRes, GetLastError()));
    */


    //SendMessage(FindWindow(L"TSSHELLWND", NULL), WM_SETTEXT, 0, (LPARAM)(LPCTSTR) L"PLEASE WAIT");

    //SetForegroundWindow(FindWindow(L"TSSHELLWND", NULL));

    //ShowWindow(FindWindow(L"TSSHELLWND", NULL), SW_SHOWNORMAL);

    //need this?
    //UpdateWindow(hTscDialog);

    //now wait for the Dialog to disapear and start rdm_keep_busy so the session will not timeout

    if(wcslen(sAppOnExit)>0) {
        TCHAR* strExeFile;
        int ch = '\\';
        strExeFile = wcsrchr(sAppOnExit, ch);
        if(strExeFile!=NULL)
            strExeFile++; //add one position as the found backslash is part of the pointer
        else
            strExeFile = sAppOnExit; //if not found, just let it point to the original string

        if(!IsProcessRunning(strExeFile)) {
            SHELLEXECUTEINFO sei = {0};
            sei.cbSize = sizeof(sei);
            sei.nShow = SW_SHOWNORMAL;
            sei.lpFile = sAppOnExit;
            sei.lpParameters = sExeArgs;// L"noRdpStart";
            if (!ShellExecuteEx(&sei)) {
                DEBUGMSG(1, (L"Starting '%s' FAILED\n", sAppOnExit));
            }
            else {
                DEBUGMSG(1, (L"Starting '%s' OK\n", sAppOnExit));
            }
        }
    }
    return 0;
}