Ejemplo n.º 1
0
Core::Core(int _xRes, int _yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex) : EventDispatcher() {

    int _hz;
    getScreenInfo(&defaultScreenWidth, &defaultScreenHeight, &_hz);

    services = CoreServices::getInstance();
    input = new CoreInput();
    services->setCore(this);
    fps = 0;
    timeLeftOver = 0.0;
    running = true;
    frames = 0;
    lastFrameTicks=0;
    lastFPSTicks=0;
    elapsed = 0;
    xRes = _xRes;
    yRes = _yRes;
    paused = false;
    pauseOnLoseFocus = false;
    if (fullScreen && !xRes && !yRes) {
        getScreenInfo(&xRes, &yRes, NULL);
    }
    mouseEnabled = true;
    mouseCaptured = false;
    lastSleepFrameTicks = 0;

    this->monitorIndex = monitorIndex;

    if(frameRate == 0)
        frameRate = 60;

    setFramerate(frameRate);
    threadedEventMutex = NULL;
}
Ejemplo n.º 2
0
void ScreenInfoManager::changeObjectStats(int /*screen_width*/, int screen_height, Ref<DynamicObject> const& vehicle)
{
	bool visible = getScreenInfo("GENERAL STATS")->getStatus();
	ScreenInfo* os = getScreenInfo("OBJECT STATS");
	if (os) {
		visible = os->getStatus();
		m_camera->removeChild(os);
	}
	osg::ref_ptr<ObjectStats> objectStats = new ObjectStats(12, 2 * screen_height / 3, vehicle);
	objectStats->setStatus(visible);
	m_camera->addChild(objectStats.get());
}
Ejemplo n.º 3
0
	Core::Core(int _xRes, int _yRes, bool fullScreen, bool vSync, int aaLevel, int anisotropyLevel, int frameRate, int monitorIndex) : EventDispatcher() {
		services = CoreServices::getInstance();
		input = new CoreInput();
		services->setCore(this);
		fps = 0;
		running = true;
		frames = 0;
		lastFrameTicks=0;
		lastFPSTicks=0;
		elapsed = 0;
		xRes = _xRes;
		yRes = _yRes;
		paused = false;
		pauseOnLoseFocus = false;
		if (fullScreen && !xRes && !yRes) {
			getScreenInfo(&xRes, &yRes, NULL);
		}
		mouseEnabled = true;
		lastSleepFrameTicks = 0;
		
		this->monitorIndex = monitorIndex;
		
		if(frameRate == 0)
			frameRate = 60;
		
		refreshInterval = 1000 / frameRate;		
		threadedEventMutex = NULL;
	}
Ejemplo n.º 4
0
/* |icon:ctrlData[0]|      |  label:ctrlData[1] |
 *                         |  label:ctrlData[2] |        |  icon-Select:ctrlData[3] |
 *------------------------------------------------------------------------------------
 */
void setLocation(int screenW,int screenH)
{
	getScreenInfo(&screenW, &screenH);
	PCTRLDATA location = ctrlData + IDX_TITLE_ICON;
	location->x = screenW/40;
	location->y = screenH/40;
	location->w = screenW/20;
	location->h = screenH*0.075;
	db_msg("x:%d,y:%d,w:%d,h:%d",location->x,location->y,location->w,location->h);
	
	location = ctrlData + IDX_TITLE_TEXT;
	location->x = screenW/5 + 60;
	location->y = ctrlData[IDX_TITLE_ICON].y*2;
	location->w = screenW/2;
	location->h = screenH/14;
	db_msg("x:%d,y:%d,w:%d,h:%d",location->x,location->y,location->w,location->h);

	location = ctrlData + IDX_SWITCH_TEXT;
	location->x = ctrlData[IDX_TITLE_TEXT].x;
	location->y = screenH*0.1875;
	location->w = screenW/2;
	location->h = screenH/14;
	db_msg("x:%d,y:%d,w:%d,h:%d",location->x,location->y,location->w,location->h);
	
	location = ctrlData + IDX_SWITCH_ICON;
	location->x = screenW*0.75;
	location->y = screenH*0.1875;
	location->w = screenW/10;
	location->h = screenH*0.075;
	db_msg("x:%d,y:%d,w:%d,h:%d",location->x,location->y,location->w,location->h);

}
Ejemplo n.º 5
0
bool ScreenInfoManager::getStatus(std::string const& name) {
	ScreenInfo *sci = getScreenInfo(name);
	if (sci) {
		return sci->getStatus();
	} else {
		return false;
	}
}
Ejemplo n.º 6
0
int ShowWifiTip(HWND hParent, tipLabelData_t* info, int full_screen)
{
	DLGTEMPLATE dlg;
	CDR_RECT rect;

	if(info == NULL) {
		db_error("invalid info\n");
		return -1;
	}
	memset(&dlg, 0, sizeof(dlg));

	rect = info->rect;
	info->full_screen = full_screen;
	//if(full_screen) 
	{
		rect.x = 0;
		rect.y = 0;
		getScreenInfo(&rect.w,&rect.h);
		db_msg(" rect(%d %d %d %d)", rect.x, rect.y, rect.w, rect.h);
	}
	ctrlData1[0].x = 0;
	ctrlData1[0].y = 0;
	ctrlData1[0].w = rect.w;
	ctrlData1[0].h = info->titleHeight;
	ctrlData1[0].caption = info->title;

	//if (info->hasicon == true)
	{

		ctrlData1[1].x = 60;
		ctrlData1[1].w = rect.w - 60;
		ctrlData1[1].h = rect.h - 10 - ctrlData1[0].h;
		ctrlData1[1].y = ctrlData1[0].h +(ctrlData1[1].h/4);
		ctrlData1[1].caption = info->text;
		ctrlData1[1].dwStyle = WS_VISIBLE | SS_LEFT;
	}	
	ResourceManager	*rm = ResourceManager::getInstance();

	dlg.dwStyle = WS_VISIBLE;
	dlg.dwExStyle = WS_EX_NONE;
	dlg.x = rect.x;
	dlg.y = rect.y;
	dlg.w = rect.w;
	dlg.h =	rect.h;
	dlg.caption = "";
	dlg.hIcon = 0;
	dlg.hMenu = 0;
	dlg.controlnr = 2;
	dlg.controls = ctrlData1;
	dlg.dwAddData = 0;

	return DialogBoxIndirectParam(&dlg, hParent, DialogProc, (LPARAM)info);
}
Ejemplo n.º 7
0
bool Ctrl::init(uint32_t fbnum) {
    // MDP/FD init
    if(!mMdp.init(fbnum)) {
        ALOGE("Ctrl failed to init fbnum=%d", fbnum);
        return false;
    }

    if(!getScreenInfo(mInfo)) {
        ALOGE("Ctrl failed to getScreenInfo");
        return false;
    }

    return true;
}
Ejemplo n.º 8
0
static int CoolIndicatorCtrlProc (HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
    HDC              hdc;
    PCOOL_INDICATOR_CTRL TbarData;
        
	//db_msg("message is %s, wParam: 0x%x, lParam: 0x%lx\n", Message2Str(message), wParam, lParam);
    switch (message) {
    case MSG_CREATE:
		{
			DWORD data; 
            DWORD dwStyle;

			//db_info("Cool Indicator ctrl proc\n");
            if ((TbarData = (COOL_INDICATOR_CTRL*) calloc (1, sizeof (COOL_INDICATOR_CTRL))) == NULL)
                return 1;

            TbarData->nCount = 0;
            TbarData->head = TbarData->tail = NULL;
            TbarData->BackBmp = NULL;
            TbarData->iSel = 0;
            TbarData->hToolTip = 0;

            //ExcludeWindowStyle (hWnd, WS_BORDER);

            dwStyle = GetWindowStyle (hWnd);
            if (dwStyle & CBS_BMP_CUSTOM) {
                data = GetWindowAdditionalData (hWnd);
                TbarData->ItemWidth = LOWORD (data);
                TbarData->ItemHeight = HIWORD (data);
				int screenW,screenH;
				getScreenInfo(&screenW,&screenH);
                TbarData->ItemHeight = 	screenH/8;
            }
            else {
                TbarData->ItemWidth = 16;
                TbarData->ItemHeight = 16;
            }

            SetWindowAdditionalData2 (hWnd, (DWORD)TbarData);
		}
		break;

	case MSG_DESTROY:
        { 
            COOL_INDICATOR_ITEMDATA* unloaddata, *tmp;
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);
            if (TbarData->hToolTip != 0) {
                DestroyCdrToolTipWin(TbarData->hToolTip);
                TbarData->hToolTip = 0;
            }

            if (TbarData->BackBmp) {
                UnloadBitmap (TbarData->BackBmp);
                free (TbarData->BackBmp);
            }

            unloaddata = TbarData->head;
            while (unloaddata) {
                tmp = unloaddata->next;
                free (unloaddata);
                unloaddata = tmp;
            }

            free (TbarData);
        }
        break;
	
	case MSG_SHOWWINDOW:
		{
			if(wParam == SW_SHOWNORMAL) {
				enable_hint = TRUE;
			} else {
				enable_hint = FALSE;
			}
		}
		break;

	case MSG_SIZECHANGING:
        {
            const RECT* rcExpect = (const RECT*)wParam;
            RECT* rcResult = (RECT*)lParam;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);

            rcResult->left = rcExpect->left;
            rcResult->top = rcExpect->top;
            rcResult->right = rcExpect->right;
            rcResult->bottom = rcExpect->top + TbarData->ItemHeight + 14;
            return 0;
        }
		break;

	case MSG_SIZECHANGED:
		{
			RECT* rcWin = (RECT*)wParam;
			RECT* rcClient = (RECT*)lParam;
			*rcClient = *rcWin;
			return 1;
		}
		break;

	case MSG_FONTCHANGED:
		{
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);

			PLOGFONT logfont = GetWindowFont(hWnd);
			//db_msg("MSG_FONTCHANGED, type :%s, familyt: %s, charset: %s\n", logfont->type, logfont->family, logfont->charset);
			if(TbarData != NULL && TbarData->hToolTip != 0) {
				SetWindowFont(TbarData->hToolTip, logfont );
			}
		}
		break;

    case MSG_NCPAINT:
        return 0;

	case MSG_PAINT:	//todo: why MSG_PAINT is received early than MSG_CREATE?
        {
            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2(hWnd);
			if (TbarData == NULL) {
				break;
			}
            hdc = BeginPaint (hWnd);

			PLOGFONT logfont = GetWindowFont(hWnd);

			SelectFont(hdc, logfont );
            DrawCoolBox (hWnd, hdc, TbarData);
            EndPaint (hWnd, hdc);
            return 0;
        }
		break;

	case CBM_ADDITEM:
        {
            COOL_INDICATOR_ITEMINFO* TbarInfo = NULL;
            COOL_INDICATOR_ITEMDATA* ptemp;
            RECT rc;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);
            TbarInfo = (COOL_INDICATOR_ITEMINFO*) lParam;

            if (!(ptemp = (COOL_INDICATOR_ITEMDATA*)calloc (1, sizeof (COOL_INDICATOR_ITEMDATA)))) {
                return -1;
            }

            GetClientRect (hWnd, &rc);

			//db_msg("add item id is %d\n", TbarInfo->id);
            ptemp->id = TbarInfo->id;
            ptemp->Disable = 0;
            ptemp->ItemType = TbarInfo->ItemType;
			ptemp->sliderColor = TbarInfo->sliderColor;

           // if (TbarInfo->ItemHint) {
            //    strncpy (ptemp->Hint, TbarInfo->ItemHint, LEN_HINT);
            //    ptemp->Hint [LEN_HINT] = '\0';
            //}
           // else
                ptemp->Hint [0] = '\0';

            if (TbarInfo->Caption) {
                strncpy (ptemp->Caption, TbarInfo->Caption, LEN_TITLE);
                ptemp->Caption [LEN_TITLE] = '\0';
            }
            else
                ptemp->Caption [0] = '\0';
             
            ptemp->Bmp = TbarInfo->Bmp;

            set_item_rect (hWnd, TbarData, ptemp); 

            ptemp->next = NULL;
            if (TbarData->nCount == 0) {
                TbarData->head = TbarData->tail = ptemp;
            }
            else if (TbarData->nCount > 0) { 
                TbarData->tail->next = ptemp;
                TbarData->tail = ptemp;
            }
            TbarData->nCount++;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;
        }
		break;

	case CBM_CLEARITEM:
		{
            COOL_INDICATOR_ITEMINFO* TbarInfo = NULL;
            COOL_INDICATOR_ITEMDATA *ptemp1, *ptemp2;

            TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);
            TbarInfo = (COOL_INDICATOR_ITEMINFO*) lParam;

			ptemp1 = TbarData->head;
            while (ptemp1) {
                ptemp2 = ptemp1->next;
				ptemp1->next = NULL;
                free (ptemp1);
                ptemp1 = ptemp2;
            }
			TbarData->head = TbarData->tail = NULL;
            TbarData->nCount = 0;
			TbarData->iSel = 0;
		}
		break;

	case CBM_SWITCH2NEXT:
		{
			TbarData = (PCOOL_INDICATOR_CTRL) GetWindowAdditionalData2 (hWnd);

			TbarData->iSel++;
			if(TbarData->iSel >= TbarData->nCount) {
				TbarData->iSel = 0;
			}
			db_info("switch to next, iSel is %d\n", TbarData->iSel);
            InvalidateRect (hWnd, NULL, TRUE);
		}
		break;

	case CBM_ENABLE:
		{
            TbarData = (PCOOL_INDICATOR_CTRL)GetWindowAdditionalData2 (hWnd);
            if (enable_item (TbarData, wParam, lParam))
                return -1;

            InvalidateRect (hWnd, NULL, TRUE);
            return 0;
		}
		break;
	default:
		break;
	}

    return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
Ejemplo n.º 9
0
 int Core::getScreenHeight() {
     int width, height, hz;
     getScreenInfo(&width, &height, &hz);
     return height;
 }
Ejemplo n.º 10
0
 int Core::getScreenWidth() {
     int width, height, hz;
     getScreenInfo(&width, &height, &hz);
     return width;
 }
Ejemplo n.º 11
0
void ScreenInfoManager::addMessage(std::string const &line) {
	MessageList *mbox = dynamic_cast<MessageList*>(getScreenInfo("MESSAGE BOX"));
	if (mbox) {
		mbox->addLine(line);
	}
}
Ejemplo n.º 12
0
void ScreenInfoManager::setStatus(std::string const& name, bool visible) {
	ScreenInfo* sci = getScreenInfo(name);
	if (sci) sci->setStatus(visible);
}