Exemplo n.º 1
0
int
set_field_back(FIELD *f, chtype back)
{
	f = Field(f);

	if ((back & (chtype) A_ATTRIBUTES) != back)
		return (E_BAD_ARGUMENT);

	if (Back(f) != back) {
		Back(f) = back;
		return (_sync_attrs(f));
	}
	return (E_OK);
}
TChar CJsonTokener::NextClean()
	{
	for (;;) 
		{
		TText c = Next();		
		if (c == '/') 
			{
			switch( Next() ) 
				{
				case '/':
					do 	{
						c = Next();
						} while (c != '\n' && c != '\r' && c != 0);
					break;
					
				case '*':
					for (;;) 
						{
						c = Next();
						if (c == 0)
							User::Leave( KErrNotSupported );
						if (c == '*') 
							{
							if (Next() == '/')
								break;
							Back();
							}					
						}
					break;
					
				default:
					Back();
					break;
				}
		}
		else if (c == '#') 
			{
			do {
				c = Next();
				} while (c != '\n' && c != '\r' && c != 0);
			} 
		else if (c == 0 || c > ' ')
			{
			return c;
			}
		}
	return 0;
	}
Exemplo n.º 3
0
//=============================================================================
//
// LoadStdImage()
//
// Purpose:     The LoadStdImage() Loads the image for the button.  This 
//				function (or LoadStdStyle()) must be called at a minimum.  
//				Automatically generates the other standard states.
//
// Parameters:  
//		[IN]	id
//				resource id, one of the resources already imported with the 
//				resource editor, usually begins with IDR_  
//
//		[IN]	pType
//				pointer to string describing the resource type
//				
// Returns:     BOOL
//				Non zero if successful, otherwise zero
//
//=============================================================================
BOOL StyleButton::LoadStdImage(UINT id, LPCTSTR pType)
{
	CRect rect; GetClientRect(rect);

	Stack Std(rect);
	Std.AddImage(CPoint(0,0), id, pType);
	m_StdStyle.AddStack(Std);

	Stack Press(rect);
	Press.AddImage(CPoint(1,1), id, pType);
	m_StdPStyle.AddStack(Press);

	Stack Hot(rect);
	Hot.AddImage(CPoint(0,0), id, pType, FALSE, LIGHTEN);
	m_StdHStyle.AddStack(Hot);

	Stack Gray(rect);
	Gray.AddImage(CPoint(0,0), id, pType, FALSE, GRAYSCALE);
	m_StdGStyle.AddStack(Gray);

	// create background
	Stack Back(rect);
	Back.FillSolid(CLEAR);
	m_Background.AddStack(Back);

	return TRUE;
}
Exemplo n.º 4
0
int main(){
    FILE *fileToPrint;
    fileToPrint = fopen("Solutions.out","w");

    /** Create Interface of Program */
    while(!Start){
        GameOver = false;
        system("CLS");
        Intro();

        Ask();

        int puzzle[SizeOfPuzzle][SizeOfPuzzle];
        int copy[SizeOfPuzzle][SizeOfPuzzle];
        int i, j;
        /** Here is generated the puzzle full with 0 */
        for(i = 0; i < SizeOfPuzzle; i++){
            for(j = 0; j < SizeOfPuzzle; j++){
                puzzle[i][j] = 0;
            }
        }
        while(!GameOver){
            system("CLS");

            Intro();
            AskSize(SizeOfPuzzle, puzzle);
            ChoseOptions();

            scanf("%d",&choice);

            switch(choice){
                case 1:
                    main();
                    break;
                case 2:
                    InsertNumberInPozitionChoice(puzzle, copy, SizeOfPuzzle);
                    break;
                case 3:
                    GenerateRandomPuzzle(puzzle, copy, fileToPrint, SizeOfPuzzle);
                    break;
                case 4:
                    SolvePuzzle(puzzle, fileToPrint, SizeOfPuzzle);
                    break;
                case 5:
                    Back(puzzle, copy, SizeOfPuzzle);
                    break;
                case 6:
                    GameOver = true;
                    Start = true;
                    break;
                default:
                    printf("\t\t Wrong choice try again :");
                    scanf("%d",&choice);
                    break;
            }
        }
    }

	return 0;
}
Exemplo n.º 5
0
void IR2(void *p)
{
while(1)
{
 UpdateLeftPWM(400);	//Velocity Setting
 UpdateRightPWM(400);	//Velocity Setting
if (ADC_Data[0]>160) //IR 2
  {
     Stop();
	 vTaskSuspend(xforward);
	 if( sen_dat[5]>180)
	 {
     //DelaymSec(150);
     Soft_Left2();
     DelaymSec(50);
	 }
	 else if(ADC_Data[2]<180)
	 {
	  Soft_Right();
	  DelaymSec(50);
	 }
	 else 
	 {
	  Back();
	  DelaymSec(50);
	 }

	 if(ADC_Data[0]<180)
	 {
	    vTaskResume(xforward);
	 }
  }

}
}
Exemplo n.º 6
0
void FileViewList::mousePressEvent(QMouseEvent* e) {
  switch (e->button()) {
    case Qt::XButton1:
      emit Back();
      break;
    case Qt::XButton2:
      emit Forward();
      break;
    // enqueue to playlist with middleClick
    case Qt::MidButton: {
      QListView::mousePressEvent(e);

      // we need to update the menu selection
      menu_selection_ = selectionModel()->selection();

      MimeData* data = new MimeData;
      data->setUrls(UrlListFromSelection());
      data->enqueue_now_ = true;
      emit AddToPlaylist(data);
      break;
    }
    default:
      QListView::mousePressEvent(e);
      break;
  }
}
Exemplo n.º 7
0
descriptor_allocation_t DescriptorAllocator::Allocate(u32 num) {
	Check(num < BlockSize);

	auto bucket = find_log_2(num);
	auto m = pad_pow_2(num);

	u32 heapOffset = 0;
	if (Size(FreeRanges[bucket])) {
		heapOffset = Back(FreeRanges[bucket]).heap_offset;
		PopBack(FreeRanges[bucket]);
	}
	else {
		if (SuballocatedBlock[bucket] == NULL_BLOCK) {
			SuballocatedBlock[bucket] = AllocateBlock();
		}

		heapOffset = SuballocatedBlock[bucket] * BlockSize + Blocks[SuballocatedBlock[bucket]].next_allocation_offset;
		Blocks[SuballocatedBlock[bucket]].next_allocation_offset += m;

		if (Blocks[SuballocatedBlock[bucket]].next_allocation_offset == BlockSize) {
			SuballocatedBlock[bucket] = NULL_BLOCK;
		}
	}

	descriptor_allocation_t allocation = {};
	allocation.allocator = this;
	allocation.heap_offset = heapOffset;
	allocation.size = num;

	return allocation;
}
Exemplo n.º 8
0
tSidebarPageTroll::tSidebarPageTroll(
    const QWeakPointer<tMercuryStyle>& xStyle,
    const QWeakPointer<tMercurySettings>& xSettings,
    const QWeakPointer<tMercuryDataManager>& xDataManager,
    QGraphicsItem* pParent)

    : Base(xStyle, xSettings, pParent)
    , m_xDataManager(xDataManager)
    , m_pStatus(0)
    , m_pIndicator(0)
    , m_pButton(0)
    , m_pUp(0)
    , m_pDown(0)
    , m_CurrentRPM(0)
    , m_TimeoutTicks(0)
    , m_TrollAllowed(true)
    , m_RotaryFocus(false)
{
    tSidebarPage::ItemsCollection items(this);

    tSidebarControlTitle* objTitle = new tSidebarControlTitle(xStyle.data(),
        tr("VESSEL CONTROL", "Mercury Vessel Control section heading"),
        tr("TROLL", "Mercury Troll Control page title"),
        tSidebarControlTitle::eModeBack);
    Connect(objTitle, SIGNAL(Triggered()), this, SIGNAL(Back()));

    items
        .Add(objTitle, 1.f, Qt::AlignAbsolute)
        .Add(m_pUp = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionUp),
            1.5f, Qt::AlignAbsolute)
        .Add(m_pIndicator = new tSidebarControlIndicator(
            xStyle.data(), "", "", "", tSidebarControlIndicator::eModeNormal, true),
            -1.f, Qt::AlignAbsolute)
        .Add(m_pDown = new tSidebarControlSpinButton(xStyle.data(), tSidebarControlSpinButton::eDirectionDown),
            1.5f, Qt::AlignAbsolute)
        .Add(m_pStatus = new tSidebarStaticText(xStyle.data(), ""), 0.5f, Qt::AlignAbsolute)
        .Add(m_pButton = new tSidebarControlButtonToggle(xStyle.data(), tr("Enable"), tr("Disable")),
            1.f, Qt::AlignBottom)
        .End();

    Connect(m_pUp, SIGNAL(Triggered()), this, SLOT(OnUpClicked()));
    Connect(m_pDown, SIGNAL(Triggered()), this, SLOT(OnDownClicked()));
    Connect(m_pButton, SIGNAL(Triggered()), this, SLOT(OnEnableClicked()));
    Connect(m_pIndicator, SIGNAL(Triggered()), this, SLOT(OnIndicatorTouched()));

    if( !m_xDataManager.isNull() )
    {
        tMercuryCommand* command = m_xDataManager.data()->MercuryCommand();
        if( command != 0 )
        {
            m_CurrentRPM = static_cast<int>(command->TrollRpmSetpoint());
            UpdateStatus(command->IsTrollActive());
            SetTrollAllowed(command->IsTrollAllowed());

            Connect(command, SIGNAL(TrollEngaged(int)), this, SLOT(StatusEnable()));
            Connect(command, SIGNAL(TrollDisengaged(int)), this, SLOT(StatusDisable()));
            Connect(command, SIGNAL(TrollActiveDetected()), this, SLOT(StatusEnable()));
            Connect(command, SIGNAL(TrollInactiveDetected()), this, SLOT(StatusDisable()));
            Connect(command, SIGNAL(TrollAllowedChanged(bool)), this, SLOT(SetTrollAllowed(bool)));
        }
Exemplo n.º 9
0
void SelectionWindow::Input(){
    if (skip){
        return;
    }
    UIBase::Input();
    Point pos = Point(InputManager::GetInstance().GetMouseX(),InputManager::GetInstance().GetMouseY());
    if (IsInside(pos.x,pos.y) && InputManager::GetInstance().MousePress(1) ){
        SetFocused(true);
    }
    if (!IsInside(pos.x,pos.y) &&  (InputManager::GetInstance().MouseRelease(1) || InputManager::GetInstance().MousePress(1)) ){
        SetFocused(false);
    }
    if (selectedOption != -1){
        if (InputManager::GetInstance().KeyPress(SDLK_DOWN)){
            selectedOption++;
            if (selectedOption >= optionCounter){
                selectedOption = 0;
            }
        }
        if (InputManager::GetInstance().KeyPress(SDLK_UP)){
            selectedOption--;
            if (selectedOption < 0){
                selectedOption = optionCounter-1;
            }
        }
        if (InputManager::GetInstance().KeyPress(SDLK_SPACE) || InputManager::GetInstance().KeyPress(SDLK_RETURN) || InputManager::GetInstance().KeyPress(SDLK_z) ){
            functions[option[selectedOption]](this,option[selectedOption]);
        }
        if (InputManager::GetInstance().KeyPress(SDLK_x) ){
            Back(this);
        }
    }
}
Exemplo n.º 10
0
bool nuiPath::IsClosed() const
{
  if (GetCount() < 3)
    return false;

  return Back() == Front();
}
Exemplo n.º 11
0
tweetviewer::tweetviewer()
{
    setupUi(this);
    connect(submitPushButton,SIGNAL(clicked()),this,SLOT(Search()));
    connect(backPushButton,SIGNAL(clicked()),this,SLOT(Back()));
    this->setFixedSize(this->width(),this->height());
}
Exemplo n.º 12
0
	virtual void OnIRCConnected()
	{
		if (m_bIsAway)
			Away(true); // reset away if we are reconnected
		else
			Back(); // ircd seems to remember your away if you killed the client and came back
	}
Exemplo n.º 13
0
//**************************************************
//  NAME: Back
//  DESCRIPTION: Robot goes straight backward
//  PARAMETERS: - speed->Motors speed
//              - distance->Distance
//**************************************************
void Motor::Back(byte speed, int distance)
{
  unsigned long time,timeout;
  int count;
  byte encoder;
	
	ReduceInertia();
	
  count = distance/ENCODER_DISTANCE;
  encoder = digitalRead(ENC_R);
  time=millis();
  Back(speed);
  while (count > 0)
  {
    while (encoder == digitalRead(ENC_R))
    {
      timeout=millis();
      if (timeout - time > MAX_TIMEOUT)
      {        
        return;
      }
    }
    encoder=digitalRead(ENC_R);
    count--;
    time=millis();
  }
  ReduceInertia();		
}
Exemplo n.º 14
0
void HelpPopup::DoInitDialog() {
    ToLog(LOGMSG_DEBUGTRACE,"IN:HelpPopup::DoInitDialog");

    if (HelpEngine) {
        ui->HelpBrowserWidget->HelpEngine=HelpEngine;
        ui->ContentWidget->InitHelpEngine(HelpEngine);
        ui->FollowInterfaceCB->setChecked(*WikiFollowInterface);
        ui->HelpSplitter->setStretchFactor(0,1);
        ui->HelpSplitter->setStretchFactor(1,3);

        connect(ui->HelpBrowserWidget,SIGNAL(historyChanged()),SLOT(PageChanged()));
        connect(ui->HelpBrowserWidget,SIGNAL(sourceChanged(QUrl)),SLOT(SourceChanged(QUrl)));
        connect(ui->ContentWidget,SIGNAL(clicked(QModelIndex)),this,SLOT(UpdateUrl(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(collapsed(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ContentWidget,SIGNAL(expanded(QModelIndex)),this,SLOT(CollapsedOrExpanded(QModelIndex)));
        connect(ui->ExitBT,SIGNAL(pressed()),this,SLOT(Exit()));
        connect(ui->PreviousBT,SIGNAL(pressed()),this,SLOT(Back()));
        connect(ui->NextBT,SIGNAL(pressed()),this,SLOT(Next()));
        connect(ui->CCBYSABT,SIGNAL(pressed()),this,SLOT(CCBYSABT()));
        connect(ui->HomeBT,SIGNAL(pressed()),this,SLOT(Home()));
        connect(ui->WebSiteBT,SIGNAL(pressed()),this,SLOT(WebSite()));
        connect(ui->ForumBT,SIGNAL(pressed()),this,SLOT(Forum()));
        connect(ui->FollowInterfaceCB,SIGNAL(clicked()),this,SLOT(Follow()));
        PageChanged();
    }
}
Exemplo n.º 15
0
void CEditParameter::SlotOnButtonConfirmClicked()
{
	/*清除原有参数文本*/
	m_strListParameterName.clear();

	/*获取参数文本*/
	QModelIndex rootIndex = m_treeWidget->rootIndex();
	QTreeWidgetItem* item=m_treeWidget->invisibleRootItem();

	for (int i = 1; i < item->childCount();++i)
	{
		QWidget* widget = m_treeWidget->itemWidget(item->child(i), 1);

		if (typeid(*widget)==typeid(CComboBoxWithTree_Old))
		{
			m_strListParameterName.append(static_cast<CComboBoxWithTree_Old*>(widget)->currentText());
		}
		else if (typeid(*widget) == typeid(CLineEditWithRegExpAndKeyboard))
		{
			m_strListParameterName.append(static_cast<CLineEditWithRegExpAndKeyboard*>(widget)->text());
		}
	}

	/*生成命令文本*/
	QString strMacroText;

	/*若为Movl命令*/
	if (m_strMacroName==CGrammarManagerFactory::STR_MACRO_MOVL)
	{
		strMacroText = QString(CGrammarManagerFactory::STR_MACRO_FORMAT_MOVL);
	}
	else if (m_strMacroName==CGrammarManagerFactory::STR_MACRO_MOVC)
	{
		strMacroText = QString(CGrammarManagerFactory::STR_MACRO_FORMAT_MOVC);
	}

	/*更新文本*/
	for (int i = 0; i < m_strListParameterName.size(); ++i)
	{
		strMacroText = strMacroText.arg(m_strListParameterName.at(i));
	}

	///*检查语法错误*/
	//try
	//{
	//	CInterpreterManager interpreterManager;
	//	interpreterManager.ParseSemantic(stdStrText);
	//}
	//catch (CExceptionInterpreter& e)
	//{
	//	std::string warningInfo;
	//	CInterpreterManager::GetWarningInfo(e, warningInfo);
	//	QMessageBox::warning(this, "", QString::fromStdString(warningInfo));
	//	return;
	//}

	m_macroInterface->EditMacroInterface(strMacroText);
	Back();
}
Exemplo n.º 16
0
	virtual EModRet OnUserMsg(CString& sTarget, CString& sMessage)
	{
		Ping();
		if (m_bIsAway)
			Back();

		return(CONTINUE);
	}
Exemplo n.º 17
0
/**
 * Handle a command for this view (override)
 * @param aCommand command id to be handled
 */
void CAddingPluginView::HandleCommandL( TInt aCommand )
	{
	// [[[ begin generated region: do not modify [Generated Code]
	TBool commandHandled = EFalse;
	switch ( aCommand )
		{	// code to dispatch to the AknView's menu and CBA commands is generated here
	
		case EAddingPluginViewControlPaneRightId:
			commandHandled = Back( aCommand );
			break;
		case EAddingPluginView_MenuItemCommand:
			commandHandled = Add( aCommand );
			break;
		case EAddingPluginView_MenuItem1Command:
			commandHandled = Edit( aCommand );
			break;
		case EAddingPluginView_C_MenuItemCommand:
			commandHandled = Remove( aCommand );
			break;
		case EAddingPluginView_MenuItem4Command:
			commandHandled = Reset( aCommand );
			break;
		case EAddingPluginView_MenuItem2Command:
			commandHandled = Info( aCommand );
			break;
		case EAddingPluginView_MenuItem3Command:
			commandHandled = Back( aCommand );
			break;
		default:
			break;
		}
	
		
	if ( !commandHandled ) 
		{
	
		if ( aCommand == EAddingPluginViewControlPaneRightId )
			{
			AppUi()->HandleCommandL( EEikCmdExit );
			}
	
		}
	// ]]] end generated region [Generated Code]
	
	}
Exemplo n.º 18
0
Arquivo: GMenu.cpp Projeto: FEI17N/Lgi
void GMenuItem::_Paint(GSurface *pDC, int Flags)
{
	if (_Icon >= 0)
	{
		if (Parent &&
			Parent->GetImageList())
		{
			GColour Back(LC_MED, 24);
			Parent->GetImageList()->Draw(pDC, -16, 0, _Icon, Back);
		}
	}
}
Exemplo n.º 19
0
int TestIterators(hash_table* hash_info) {
	iterator it;
	char** i;
	for ( it = SetToEnd(hash_info); !CheckBegin(it) ; it = Back(it) )  {
		i = Value(it);
	}

	for ( it = SetToBegin(hash_info); !CheckEnd(it) ; it = Next(it) )  {
		i = Value(it);
	}
	return 0;
}
Exemplo n.º 20
0
void QQInfoDlg::InitConnections()
{
	connect(ui.btnBack, SIGNAL(clicked()), ui.edtQQChat, SLOT(Back()));
	connect(ui.btnFront, SIGNAL(clicked()), ui.edtQQChat, SLOT(Front()));

	connect(ui.edtQQChat, SIGNAL(FrontShow()), this, SLOT(FrontShow()));
	connect(ui.edtQQChat, SIGNAL(BackShow()), this, SLOT(BackShow()));
	connect(ui.edtQQChat, SIGNAL(FrontHide()), this, SLOT(FrontHide()));
	connect(ui.edtQQChat, SIGNAL(BackHide()), this, SLOT(BackHide()));

	connect(ui.cmbQQAccount, SIGNAL(currentIndexChanged(int)), this, SLOT(OnCurrentAccountChanged(int)));
	connect(ui.trQQAccounts, SIGNAL(clicked(const QModelIndex&)), this, SLOT(OnTrQQAccountsClicked(const QModelIndex&)));
}
TPtrC CJsonTokener::NextTo(TText aChar)
	{
	TInt pos = iPosition, length = 0;
	for (;;) 
		{
		TText c = Next();		
		
		if (c == aChar || c == 0 || c == '\n' || c == '\r') 
			{
			if (c != 0)
				Back();
			return iJsonString.Mid(pos, length);
			}
		++length;
		}
	}
Exemplo n.º 22
0
void CEditorAppView::HandleCommandL(TInt aCommand)
	{
	switch (aCommand)
		{
		case ECommandAddTask:
			SaveTask();
			break;
		case ECommandInsertContact:
			iContainer->DoUserAddRecipientL();
			break;
		case EAknSoftkeyBack:
			Back();
			break;
		default:
			AppUi()->HandleCommandL(aCommand);
		}
	}
Exemplo n.º 23
0
void Main()
{
	TextureAsset::Register(L"noise", L"Texture/noise.png");
	//設定の読み込み
	LoadConfig();
	//タイトル
	String Title(L"高専の敷き詰め理論ⅠB");
	Point TitlePos(10, 0);
	//ウィンドウスタイルの設定
	Window::SetStyle(WindowStyle::NonFrame);
	Window::Resize(960, 540);
	//フォントの用意
	Font titlefont(30);
	Texture Back(L"Texture/BlackBord.png");
	Rect font_size = titlefont.region(Title);
	//ボタンの用意
	Button Download(download, 20, 100, L"・ダウンロード");
	Button SelectFile(selectfile, 20, 170, L"・ファイルを選択");
	Button ReAnswer(reanswer, 20, 240, L"・再度問題を解く");
	Button Upload(upload, 20, 350, L"・アップロード");
	//バグ除け
	Gout << L"準備完了\n";

	while (System::Update()){
		//ボタンのアップデート
		if (Download.end && SelectFile.end && Upload.end && ReAnswer.end){
			Download.Update();
			SelectFile.Update();
			Upload.Update();
			ReAnswer.Update();
		}

		//描画
		Back.draw();
		titlefont(Title).draw(TitlePos, Palette::White);
		TextureAsset(L"noise").map(font_size.w, font_size.h).draw(TitlePos);

		Download.Draw();
		SelectFile.Draw();
		ReAnswer.Draw();
		Upload.Draw();

		Gout.Draw();
		DD.Draw();
	}
}
Exemplo n.º 24
0
void CMainWnd::OnClick( TNotifyUI &msg )
{
	CDuiString sName = msg.pSender->GetName();
	sName.MakeLower();

	if( msg.pSender == m_pCloseBtn ) {
		PostQuitMessage(0);
		return; 
	}
	else if( msg.pSender == m_pMinBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_MINIMIZE, 0); return; }
	else if( msg.pSender == m_pMaxBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_MAXIMIZE, 0); return; }
	else if( msg.pSender == m_pRestoreBtn ) { 
		SendMessage(WM_SYSCOMMAND, SC_RESTORE, 0); return; }
	else if( msg.pSender == m_pMenuBtn ) {
	}
	else if(sName.CompareNoCase(_T("newtab")) == 0)
	{
		CreateNewTabAndGo(NULL);
	}
	else if(sName.CompareNoCase(_T("address_go")) == 0)
	{
		AddressGo();
	}
	else if(sName.CompareNoCase(_T("search_go")) == 0) {
		SearchGo();
	}
	else if(sName.CompareNoCase(_T("back_btn")) == 0) {
		Back();
	}
	else if(sName.CompareNoCase(_T("forward_btn")) == 0) {
		Forward();
	}
	else if(sName.CompareNoCase(_T("refresh_btn")) == 0) {
		Refresh();
	}
	else if(sName.CompareNoCase(_T("home_go")) == 0) {
		Home();
	}
	else if(sName.CompareNoCase(_T("qq_btn")) == 0)
	{
		CreateNewTabAndGo(_T("tencent://Message/?Uin=656067418&Menu=yes"));
	}
}
Exemplo n.º 25
0
std::set<BoardPosition> & Queen::GetValidMove(ChessBoard * board) {
	if (movements != NULL)
		delete movements;

	movements = new std::set<BoardPosition>;
	
	Forward(board);
	Forward_left(board);
	Forward_right(board);
	Right(board);
	Left(board);
	Back(board);
	Back_left(board);
	Back_right(board);

	return *movements;

}
Exemplo n.º 26
0
int TItemList::Cat(const BYTE* pData, int length)
{
	int remain = length;

	while(remain > 0)
	{
		TItem* pItem = Back();

		if(pItem == nullptr || pItem->IsFull())
			pItem = PushBack(itPool.PickFreeItem());

		int cat  = pItem->Cat(pData, remain);

		pData	+= cat;
		remain	-= cat;
	}

	return length;
}
Exemplo n.º 27
0
void	UIText::draw(RenderWindow& window,Vector2f	Position)
{
	sf::Text	renderString;
	Uint8		alpha=255;
	if(!mChangeable)
	{
		alpha=100;
	}
	Color		temp(mTextColor);
	renderString.setColor(temp);
	renderString.setCharacterSize(mSize);
	renderString.setString(mName+": ");
	renderString.setPosition(Position);
	renderString.setFont(mFont);
	window.draw(renderString);
	Vector2f newPos=Position;
	newPos.x+=renderString.getGlobalBounds().width+10;
	renderString.setPosition(newPos);
	renderString.setString(mEnter.getString());
	sf::RectangleShape Back(Vector2f(renderString.getGlobalBounds().width+2,renderString.getGlobalBounds().height+5))
		,Frame(Vector2f(renderString.getGlobalBounds().width+1,renderString.getGlobalBounds().height+4))
		,Line(Vector2f(1.f,renderString.getCharacterSize()));
	Back.setFillColor(Color(mBack.r,mBack.g,mBack.b,alpha));
	Line.setFillColor(Color(0,0,0,255));
	Back.setPosition(renderString.getPosition());
	Line.setPosition(renderString.findCharacterPos(mEnter.getCurrentPosition()));
	window.draw(Back);
	window.draw(renderString);
	Frame.setFillColor(sf::Color::Transparent);
	Frame.setOutlineThickness(1);
	Frame.setOutlineColor(Color(0,0,0,255));
	Frame.setPosition(newPos);
	window.draw(Frame);
	if(mLineSwitch.isExpired())
	{
		mLineDraw=!mLineDraw;
		mLineSwitch.reset();
	}
	if(mLineDraw&&mSelected&&mChangeable)
	{
		window.draw(Line);
	}
}
Exemplo n.º 28
0
void main()
{
    int iCaseNum,iStepNum,iStep;
    char cTurn[10];
    Direction dFace;
    Coordinate cMan;
    cin>>iCaseNum;
    while(iCaseNum--)
    {
        cin>>iStepNum;
        dFace.iFront=0;
        dFace.iTop=2;
        dFace.iLeft=4;
        cMan.iX=cMan.iY=cMan.iZ=0;
        while(iStepNum--)
        {
            cin>>cTurn>>iStep;
            switch(cTurn[0])
            {
            case 'b':
                Back(dFace);
                break;
            case 'l':
                Left(dFace);
                break;
            case 'r':
                Right(dFace);
                break;
            case 'u':
                Up(dFace);
                break;
            case 'd':
                Down(dFace);
                break;
            default:
                break;
            }
            Go(cMan,dFace,iStep);
        }
        cout<<cMan.iX<<" "<<cMan.iY<<" "<<cMan.iZ<<" "<<dFace.iFront<<endl;
    }
}
Exemplo n.º 29
0
void IR3(void *p)
{
while(1)
{
 UpdateLeftPWM(400);	//Velocity Setting
 UpdateRightPWM(400);	//Velocity Setting
 if(sen_dat[1]<210) //IR 3
   {
     Stop();
	 vTaskSuspend(xforward);
	 if( sen_dat[2]>170)
	 { 
     //DelaymSec(200);
     Right();
   	DelaymSec(50);
	Stop();
	DelaymSec(50);
	 }
	 else if (sen_dat[0]>190)
	 {
	  Left();
	  DelaymSec(50);
	 }
	 else if(sen_dat[2]>170)
	 {
	   Right();
	   DelaymSec(50);
	 }
	 else
	 {
	  Back();
	  DelaymSec(50);
	 }
    
	 if(sen_dat[1]>200)
	 {
	   vTaskResume(xforward);
	 } 
}

}
}
Exemplo n.º 30
0
//This function is UART0 Receive ISR. This functions is called whenever UART0 receives any data
void  __irq IRQ_UART0(void)
{  
 Temp = U0RBR;			
  
 if(Temp == 0x38) //ASCII value of 8
 {
  Forward();  //forward
 }
 
 if(Temp == 0x32) //ASCII value of 2
 {
  Back(); //back
 }

 if(Temp == 0x34) //ASCII value of 4
 {
  Left();  //left
 }
  
 if(Temp == 0x36) //ASCII value of 6
 {
  Right(); //right
 }

 if(Temp == 0x35) //ASCII value of 5
 {
  Stop(); //stop
 }

 if(Temp == 0x37) //ASCII value of 7
 {
  BUZZER_ON();
 }

 if(Temp == 0x39) //ASCII value of 9
 {
  BUZZER_OFF();
 } 

 VICVectAddr = 0x00;
 UART0_SendByte(Temp);	//Echo Back received character
}