void
CSecondaryScreen::leave()
{
	LOG((CLOG_INFO "leaving screen"));
	CLock lock(&m_mutex);
	assert(m_active == true);

	getScreen()->syncDesktop();

	// subclass hook
	onPreLeave();

	// restore toggle key state
	setToggleState(m_toggleKeys);

	// warp and hide mouse
	SInt32 x, y;
	getScreen()->getCursorCenter(x, y);
	showWindow(x, y);

	// subclass hook
	onPostLeave();

	// not active anymore
	m_active = false;

	// make sure our idea of clipboard ownership is correct
	getScreen()->checkClipboards();
}
void
CSecondaryScreen::setOptions(const COptionsList& options)
{
	// update options
	bool updateScreenSaverSync = false;
	bool oldScreenSaverSync;
	{
		CLock lock(&m_mutex);
		oldScreenSaverSync = m_screenSaverSync;
		for (UInt32 i = 0, n = options.size(); i < n; i += 2) {
			if (options[i] == kOptionScreenSaverSync) {
				updateScreenSaverSync = true;
				m_screenSaverSync     = (options[i + 1] != 0);
				LOG((CLOG_DEBUG1 "screen saver synchronization %s", m_screenSaverSync ? "on" : "off"));
			}
		}
		if (!m_remoteReady || oldScreenSaverSync == m_screenSaverSync) {
			updateScreenSaverSync = false;
		}
	}

	// update screen saver synchronization
	if (updateScreenSaverSync) {
		if (oldScreenSaverSync) {
			getScreen()->closeScreensaver();
		}
		else {
			getScreen()->openScreensaver(false);
		}
	}
}
Example #3
0
void PlayingState::addStatusMonitor(const std::shared_ptr<Object> &object)
{
    //Disabled by configuration?
    if(!egoboo_config_t::get().hud_displayStatusBars.getValue()) {
        return;
    }

    //Already added?
    if(object->getShowStatus()) {
        return;
    }

    //Get the camera that is following this object (defaults to main camera)
    auto camera = CameraSystem::get()->getCamera(object->getObjRef());

    auto status = std::make_shared<CharacterStatus>(object);

    status->setSize(BARX, BARY);
    status->setPosition(camera->getScreen().xmax - status->getWidth(), camera->getScreen().ymin);

    addComponent(status);
    _statusList.push_back(status);

    object->setShowStatus(true);
}
Example #4
0
void fsDrawMgr::createAfterRes()
{
    destroyBeforeRes();

    m_instance = fsNew(fsDrawMgr);

    newScreen(INVISIBLE_SCREEN_ID);
    newScreen(DEFAULT_3D_SCREEN_ID);
    newScreen(DEFAULT_2D_SCREEN_ID);

    fsScr* scr0d = getScreen(INVISIBLE_SCREEN_ID);
    scr0d->setActive(false);

    fsScr* scr3d = getScreen(DEFAULT_3D_SCREEN_ID);
    scr3d->setClearColor(fsCol::ZERO);

    fsScr* scr2d = getScreen(DEFAULT_2D_SCREEN_ID);
    scr2d->setClearMode(false, true);
    scr2d->setPerspective(false);

    newLightSet(DEFAULT_LIGHT_SET_ID);

    fsLowLevelAPI::resetDrawState();

    newShader(DEFAULT_NO_TEXTURE_SHADER_ID, s_default_vert_code, s_default_no_texture_frag_code, 8, 0, 0);
    newShader(DEFAULT_RGB_TEXTURE_SHADER_ID, s_default_vert_code, s_default_rgb_texture_frag_code, 8, 0, 1);
    newShader(DEFAULT_RGBA_TEXTURE_SHADER_ID, s_default_vert_code, s_default_rgba_texture_frag_code, 8, 0, 1);
    newShader(DEFAULT_ALPHA_TEXTURE_SHADER_ID, s_default_vert_code, s_default_alpha_texture_frag_code, 8, 0, 1);
}
void MiniMap::draw(const AGRect &r)
{
//  CTRACE;
  AGRect mr=r.project(getRect());
  if(mustUpdate)
    mTexture=AGTexture(mSurface);
  mustUpdate=false;
  getScreen().blit(mBG,mr);
  mr.x+=8;
  mr.y+=8;
  mr.w-=16;
  mr.h-=16;
  
  getScreen().blit(mTexture,mr);
  
  drawEntities(mr.getPosition());
/*
  // draw viewing Rect  
  float sx0=mViewRect.x;
  
  AGRect vr(;
  vr=
  
  getScreen().drawRect(AGRect(*/
}
Example #6
0
BasicEnemy::BasicEnemy(Screen& screen)
    : GameObject(screen)
    , mCooldown(COOLDOWN)
    , mCanSee(false)
{
    mVertices.resize(4);
    getScreen().getGame().getResourceManager().loadSprite(this, 0, "enemyRed1.png", 0, 0);

    mSFX.setBuffer(*getScreen().getGame().getResourceManager().getSoundBuffer("sfx_laser1.ogg"));
    mSFX.setVolume(SFX_VOLUME);

//    mVelocity = sf::Vector2f(-50, -50);

    setOrigin(46, 35);
    setRotation(0);


    boundingPolygon.push_back(sf::Vector2f(10, 10));
    boundingPolygon.push_back(sf::Vector2f(0,  26));
    boundingPolygon.push_back(sf::Vector2f(11, 57));
    boundingPolygon.push_back(sf::Vector2f(81, 57));
    boundingPolygon.push_back(sf::Vector2f(92, 26));
    boundingPolygon.push_back(sf::Vector2f(82, 10));

    mHealthBar = new StatusBar2(getScreen());
}
Example #7
0
void BasicEnemy::fire(std::list<Missile*>& missiles) {
    if (!mCanSee) return;
    if (mCooldown > 0) return;

    mCooldown = COOLDOWN;

    sf::Vector2f pos;
    Missile* missile;

    pos = getTransform().transformPoint(30, 80);
    missile = new Missile(getScreen(), this);
    missile->setPosition(pos);
    missile->setRotation(180+getRotation());
    missile->damage = DAMAGE;
    missiles.push_back(missile);

    pos = getTransform().transformPoint(70, 80);
    missile = new Missile(getScreen(), this);
    missile->setPosition(pos);
    missile->setRotation(180+getRotation());
    missile->damage = DAMAGE;
    missiles.push_back(missile);

    mSFX.play();
}
Example #8
0
void UISystem::draw()
{
    m_renderer->begin();
    drawR(m_root);
    m_renderer->setScreen(getScreen().getSize().x, getScreen().getSize().y);
    m_renderer->setViewport(0,0);
    m_renderer->end();
}
Example #9
0
void CSprite::FlipTo(CInputs::Direction direction){
	if(direction == CInputs::DirFront && isflipped()){
		_flipped = false;
		NF_HflipSprite(getScreen(), _idScreen, _flipped);
	}else{
		if(direction == CInputs::DirBack && !isflipped()){
			_flipped = true;
			NF_HflipSprite(getScreen(), _idScreen, _flipped);
		}
	}
}
Example #10
0
/**
 * Lay out the widgets (portrait mode).
 */
void TitleScreen::setupUI()
{

	// Get the handle to the main layout and the screen.
	mMainLayout = getMainLayout();
	mScreen = getScreen();
	mLabel = getTopLabel();
	mBackButton = getTopButtonLeft();
	mNextButton = getTopButtonRight();

	// Set the text for the widget in the top layout: the label and the buttons.
	setButtonText(mNextButton, " NEXT ");
	setButtonText(mBackButton, " BACK ");

	// The creation of the main layout is already done in the base class
	// constructor, called at derived object creation.
	// So, we can use  a handle for the main layout at any point.

	// Add an empty list view.
	// Each line will have a check box, and the related label with article title
	// List is populated when search is performed, and showScreen() is called.
	// The height is ScreenHeight - the size of the top layout.
	mListView = createListView(mScreenWidth, 7*mScreenHeight/8);
	maWidgetAddChild(mMainLayout, mListView);
}
void SDL_Surface_Image::FreeCache() {
	if(surf) {
		Image::FreeCache();
	} else {
		getScreen()->RemoveFromCache(caches[cur_frame]);
	}
}
Example #12
0
void MiniMap::drawEntities(const AGPoint &p0)
{
//  CTRACE;
  Pos2D maxPos=mMap->getMaxPos();
  std::list<AntEntity*> l=mMap->getAllEntities();
  std::list<AntEntity*>::iterator i=l.begin();
  for(;i!=l.end();i++)
  {
    AGColor c;
    int x,y;
    Pos2D pos=(*i)->getPos2D();
    AntMan *m=dynamic_cast<AntMan*>(*i);
    AntHero *h=dynamic_cast<AntHero*>(*i);
    if(m)
      c=AGColor(0xFF,0,0);
    else if(h)
      c=AGColor(0,0xFF,0);
    else
      c=AGColor(0x77,0x77,0x77);
      
      
    x=pos.x*mSurface.width()/maxPos.x;
    y=mSurface.height()-1-pos.y*mSurface.height()/maxPos.y;
    
    getScreen().drawRect(AGRect(p0.x+x,p0.y+y,2,2),c);
  }
}
Example #13
0
MiniMap::MiniMap(AGWidget *pParent,const AGRect &r,AntargisMap *pMap,const AGRect &pViewRect):
  AGWidget(pParent,r),mMap(pMap),mSurface(r.w-16,r.h-16),mViewRect(pViewRect)
{
  mustUpdate=true;
  update();
  mBG=AGTexture(getScreen().loadSurface("data/minimap_bg.png"));
}
void
CSecondaryScreen::remoteControl()
{
	// assume primary has all clipboards
	for (ClipboardID id = 0; id < kClipboardEnd; ++id) {
		grabClipboard(id);
	}

	// update keyboard state
	updateKeys();

	// now remote ready.  fake being active for call to leave().
	bool screenSaverSync;
	{
		CLock lock(&m_mutex);
		m_remoteReady = true;
		m_active      = true;

		// copy screen saver synchronization state
		screenSaverSync = m_screenSaverSync;
	}

	// disable the screen saver if synchronization is enabled
	if (screenSaverSync) {
		getScreen()->openScreensaver(false);
	}

	// hide the cursor
	leave();
}
void
CSecondaryScreen::enter(SInt32 x, SInt32 y, KeyModifierMask mask)
{
	CLock lock(&m_mutex);
	assert(m_active == false);

	LOG((CLOG_INFO "entering screen at %d,%d mask=%04x", x, y, mask));

	getScreen()->syncDesktop();

	// now active
	m_active = true;

	// subclass hook
	onPreEnter();

	// update our keyboard state to reflect the local state
	updateKeys();

	// remember toggle key state
	m_toggleKeys = getToggleState();

	// toggle modifiers that don't match the desired state
	setToggleState(mask);

	// warp to requested location
	warpCursor(x, y);

	// show mouse
	hideWindow();

	// subclass hook
	onPostEnter();
}
void
CSecondaryScreen::open()
{
	try {
		// subclass hook
		onPreOpen();

		// open the screen
		getScreen()->open();

		// create and prepare our window.  pretend we're active so
		// we don't try to show our window until later.
		{
			CLock lock(&m_mutex);
			assert(m_active == false);
			m_active = true;
		}
		createWindow();
		{
			CLock lock(&m_mutex);
			m_active = false;
		}

		// subclass hook
		onPostOpen();

		// reset options
		resetOptions();
	}
	catch (...) {
		close();
		throw;
	}
}
void
CSecondaryScreen::close()
{
	onPreClose();
	destroyWindow();
	getScreen()->close();
	onPostClose();
}
Example #18
0
static const SDL_Surface *
m_getTile(THIS)
{
    /* METHOD(EWall); */

    Screen s = getScreen();
    return s->getTile(s, SATN_Wall, 0);
}
void
CSecondaryScreen::localControl()
{
	getScreen()->closeScreensaver();

	// not remote ready anymore
	CLock lock(&m_mutex);
	m_remoteReady = false;
}
Example #20
0
static inline void setImageMetrics(QImage &img, QWidget *window) {
    QScreen *myScreen = getScreen(window);
    if (myScreen) {
        int dpmx = myScreen->width()*1000 / myScreen->physicalWidth();
        int dpmy = myScreen->height()*1000 / myScreen->physicalHeight();
        img.setDotsPerMeterX(dpmx);
        img.setDotsPerMeterY(dpmy);
    }
}
Example #21
0
bool QWSOnScreenSurface::isValid() const
{
    const QWidget *win = window();
    if (screen != getScreen(win))
        return false;
    if (img.isNull())
        return false;
    return QScreen::isWidgetPaintOnScreen(win);
}
Example #22
0
int Deposit::getDepositAmountFromKBD(){
	Screen screen = getScreen();
	screen.displayMsg("입금액을 입력하시오(취소하려면 -999): ");
	int balance = keypad.getInput();

	if (balance != stop)
		return balance;
	else
		return NULL;
}
Example #23
0
/*
	Metodos de la clase "CBackground"
*/
u8 CBackground::CreateBackground(bool upScreen){
	
	_upScreen = upScreen;
	
	NF_CreateTiledBg(getScreen(), _layer, _name);
	
	

	return _layer;
} // CreateTiledBg
Example #24
0
fsDrawMgr::~fsDrawMgr()
{
    getScreen(INVISIBLE_SCREEN_ID)->moveLast();

    while (const fsID* scr_id = m_scr_map.getFirstKeyN())
    {
        fsDelete(getScreen(*scr_id), fsScr);
    }

    while (const fsID* tex_id = m_tex_map.getFirstKeyN())
    {
        deleteTexture(*tex_id);
    }

    while (const fsID* shd_id = m_shd_map.getFirstKeyN())
    {
        deleteShader(*shd_id);
    }

    while (const fsID* lts_id = m_lts_map.getFirstKeyN())
    {
        deleteLightSet(*lts_id);
    }

    for (const fsRes* res = fsResMgr::getFirstResourceN(); res; res = fsResMgr::getNextResourceN(res->getID()))
    {
        if (res->getExtension() == "TTF" || res->getExtension() == "TTC" || res->getExtension() == "OTF")
        {
            fontFinalizer(res->getID(), res->getExtension(), res->getData<void>(), res->getDataSize(), res->getExInfo<void>());
        }
    }

    if (!fsLowLevelAPI::destroyFreeType())
    {
        fsThrow(ExceptionDestroyFreeTypeFailed);
    }

    fsResMgr::removeType("PNG");
    fsResMgr::removeType("TTF");
    fsResMgr::removeType("TTC");
    fsResMgr::removeType("OTF");
}
Example #25
0
void fsDrawMgr::deleteScreen(fsID scr_id)
{
    instance();

    if (scr_id == fsID::ZERO || scr_id == INVISIBLE_SCREEN_ID)
    {
        fsThrow(ExceptionInvalidArgument);
    }

    fsDelete(getScreen(scr_id), fsScr);
}
Example #26
0
// Mueve las bolas
void CSprite::MoveSpriteToPos(Vector2 *newPosition) {
	if(newPosition == _position)
		return;

	//delete _position;
	//_position = new Vector2(*newPosition);
	_position->setXY(newPosition->getX(), newPosition->getY());
	// Mueve el sprite
	NF_MoveSprite(getScreen(), _idScreen, _position->getX(), _position->getY());
	
}
Example #27
0
// Destructor clase CBackground
CBackground::~CBackground(void) {

	
	NF_DeleteTiledBg(getScreen(), _layer); // delete from screen and vram
	NF_UnloadTiledBg(_name); // delete from ram
	
	

	//delete[] _name;
	delete _position;
}
Example #28
0
// perform transaction; overrides Transaction's pure virtual function
void Withdrawal::execute()
{
	bool cashDispensed = false; // cash was not dispensed yet
	bool transactionCanceled = false; // transaction was not canceled yet
	
	// get references to bank database and screen
	BankDatabase &bankDatabase = getBankDatabase();
	Screen &screen = getScreen();
	
	// loop until cash is dispensed or the user cancels
	do
	{
		// obtain the chosen withdrawal amount from the user
		int selection = displayMenuOfAmounts();
		// check whether user chose a withdrawal amount or canceled
		if ( selection != CANCELED )
		{ 
			amount = selection; // set amount to the selected dollar amount

			// get available balance of account involved
			double availableBalance = 45 bankDatabase.getAvailableBalance( getAccountNumber() );
			
			// check whether the user has enough money in the account
			if ( amount <= availableBalance )
			{
				// check whether the cash dispenser has enough money
				if ( cashDispenser.isSufficientCashAvailable( amount ) )
				{
					// update the account involved to reflect withdrawal
					bankDatabase.debit( getAccountNumber(), amount );
					cashDispenser.dispenseCash( amount ); // dispense cash
					cashDispensed = true; // cash was dispensed
					
					// instruct user to take cash
					screen.displayMessageLine( "\nPlease take your cash from the cash dispenser." );
				} // end if
				else // cash dispenser does not have enough cash
					screen.displayMessageLine( "\nInsufficient cash available in the ATM."
											   "\n\nPlease choose a smaller amount." );
			} // end if
			else // not enough money available in user's account
			{
				screen.displayMessageLine( "\nInsufficient funds in your account."
										   "\n\nPlease choose a smaller amount." );
			} // end else
		} // end if
		else // user chose cancel menu option
		{
			screen.displayMessageLine( "\nCanceling transaction..." );
			transactionCanceled = true; // user canceled the transaction
		} // end else
	} while ( !cashDispensed && !transactionCanceled ); // end do...while
} // end function execute
Example #29
0
int clear_screen(int argc, char *argv){

	ttyScreen_t * screen = getScreen(get_current_task());

	clearScreen();
	clearScreenBuffer();
	print_header();
	printTicks();
	screen->wpos=TTY_SCREEN_SSTART;
	move_cursor(screen->wpos/2);

}
Example #30
0
void CSprite::removeFromVRam(bool palette){
	if(!isInVRam())
		return;

	NF_FreeSpriteGfx(getScreen(), getIdVRam());
	_inVram = false;
	_idVRam = -1;
	
	if(palette){
		_palette->removeFromVRam();
	}
} // removeFromVRam