Esempio n. 1
0
void frmMain::execSelChange(wxTreeItemId item, bool currentNode)
{
    if (currentNode)
    {
        properties->ClearAll();
        properties->AddColumn(_("Properties"), properties->GetSize().GetWidth() - 10);
        properties->InsertItem(0, _("No properties are available for the current selection"), PGICON_PROPERTY);

        sqlPane->Clear();
    }

    // Get the item data, and feed it to the relevant handler,
    // cast as required.
    currentObject = browser->GetObject(item);

    // If we didn't get an object, then we may have a right click, or 
    // invalid click, so ignore.
    if (!currentObject)
    {
        menuFactories->CheckMenu(currentObject, menuBar, toolBar);
    }
    else
    {
        if (currentNode)
        {
            properties->Freeze();
            setDisplay(currentObject, properties, sqlPane);
            properties->Thaw();
            ShowObjStatistics(currentObject);
        }
        else
            setDisplay(currentObject, 0, 0);
    }
}
Esempio n. 2
0
int main() {
  trace_puts(">>> VfdClock main() init");
  initGpio();
  initRtc();
  initTimer();
  initUart();
  SysTick_Config(72000);  // 1kHz
  trace_puts("<<< VfdClock main() init");

  GPIO_WriteBit(LED_PORT, LED_PIN, RESET);

  // Disable buzzer.
  GPIO_WriteBit(BUZ_PORT, BUZ_PIN, RESET);
  TIM_Cmd(TIM3, DISABLE);

  backupLoad();

  uint8_t digits[6] = {
      DIGIT_BLANK, DIGIT_DASH, DIGIT_DASH, DIGIT_DASH, DIGIT_DASH, DIGIT_BLANK};
  setDisplay(digits);

  gSeconds = RTC_GetCounter();

  time_t localtime;
  struct tm *t = gmtime(&gSeconds);

  // Logic loop.
  while (1) {
    // Read GPS data, if it exists.
    if (strlen(gGpsLine) > 0) {
      handleGpsLine();
    } else if (gGpsNextPoll < gSeconds) {
      gpsSetPushFreq("ZDA", 2);
    }

    handleDigits(digits, t);
    handleButtonPress();

    if (gSecondFlag) {
      gSecondFlag = 0;
      localtime = gSeconds + gUtcOffset;
      t = gmtime(&localtime);
      handleDigits(digits, t);
      setDisplay(digits);
      // Blink decimal point.
      GPIO_WriteBit(DP_PORT, DP_PIN, SET);
      gDpTick = 500;
    }
  }
}
Esempio n. 3
0
// Interface
// 2.1 General Commands
// AutoBaud - 55hex 
void Serial_LCD::begin(int8_t resetPin0) {
  // default speed = 9600
    
  // reset is required for Goldelox-based screens
  if (resetPin0 > -1) {
      delay(3000);
      pinMode(resetPin0, OUTPUT);
      digitalWrite(resetPin0, LOW);
      delay(10);
      digitalWrite(resetPin0, HIGH);
      delay(10);
  }

  // LCD 500 ms power-up
  // SD card 3000 ms power-up
  delay(500);
  _port->print('U');    // connect
  while (_port->read()!=0x06)  {     
    delay(100);  
  }

  _port->print('o');    // clear touch 
  _port->print((char)0x04);   // touch state
  //  _port->flush();
  delay(100);
  while (_port->available()) _port->read();

  setBacklight(true);  // backlight on
  setDisplay(true);  // display on
  setOrientation(3);
  clear();
  setFont(1);
  _checkedSD=false;  // SD not checked

}
Esempio n. 4
0
static RenderStyle createFullScreenStyle()
{
    auto fullscreenStyle = RenderStyle::create();

    // Create a stacking context:
    fullscreenStyle.setZIndex(INT_MAX);

    fullscreenStyle.setFontDescription({ });
    fullscreenStyle.fontCascade().update(nullptr);

    fullscreenStyle.setDisplay(FLEX);
    fullscreenStyle.setJustifyContentPosition(ContentPositionCenter);
    fullscreenStyle.setAlignItemsPosition(ItemPositionCenter);
    fullscreenStyle.setFlexDirection(FlowColumn);
    
    fullscreenStyle.setPosition(FixedPosition);
    fullscreenStyle.setWidth(Length(100.0, Percent));
    fullscreenStyle.setHeight(Length(100.0, Percent));
    fullscreenStyle.setLeft(Length(0, WebCore::Fixed));
    fullscreenStyle.setTop(Length(0, WebCore::Fixed));
    
    fullscreenStyle.setBackgroundColor(Color::black);

    return fullscreenStyle;
}
Esempio n. 5
0
void frmMain::OnPropSelChanged(wxListEvent& event)
{
    if (properties->GetSelectedItemCount() == 1)
    {
        wxTreeItemId item=browser->GetSelection();
        if (item)
        {
            pgObject *data=browser->GetObject(item);
            if (data && data->IsCollection())
            {
                currentObject=((pgCollection*)data)->FindChild(browser, event.GetIndex());
                if (currentObject)
                {
                    setDisplay(currentObject);
                    sqlPane->SetReadOnly(false);
                    sqlPane->SetText(currentObject->GetSql(browser));
                    sqlPane->SetReadOnly(true);
                }
            }
        }
    }

    editMenu->Enable(MNU_COPY, properties->GetSelectedItemCount() > 0);
    if(properties->GetSelectedItemCount() > 0)
    {
        manager.GetPane(wxT("listViews")).SetFlag(wxAuiPaneInfo::optionActive, true);
    }
}
void parse_message(String message) {
    if(message[0] == '(') {
        int digitVal = 10*(message[1]-'0') + (message[2]-'0');
        Serial.print("Setting display to: ");
        Serial.print(message[1]);
        Serial.println(message[2]);
        setDisplay(digitVal / 10, digitVal % 10);
    }

    Serial.print("message is: ");
    Serial.println(message);
    if(message[message.length() - 1] == ')') {
        double motorVal = 10*(message[message.length()-3]-'0') + (message[message.length()-2]-'0');
        unsigned long motorPer = motorVal * 1000/SPEED_SLOPE;
        unsigned long target = STEPS * motorPer / 100;
        Serial.print("Setting motor target to: ");
        Serial.println(target);
        setMotorTarget(target);
    }

    if (message[0] == '<') {
        int rgbValue = 100*(message[1] -'0') + 10*(message[2]-'0') + (message[3]-'0');
        setLED(rgbValue, 255, 255);
    }
}
Esempio n. 7
0
void SearchTab::currentDateChanged()
{
	const QModelIndex &currentIndex = TimelineView->timeline()->currentIndex();
	if (!currentIndex.isValid())
	{
		TimelineView->messagesView()->setChat(Chat::null);
		TimelineView->messagesView()->clearMessages();
		return;
	}

	const Talkable talkable = currentIndex.data(TalkableRole).value<Talkable>();
	const QDate date = currentIndex.data(DateRole).value<QDate>();

	auto chat = m_talkableConverter->toChat(talkable);
	if (!chat)
	{
		chat = m_chatStorage->create();
		chat.setDisplay("?");
	}
	TimelineView->messagesView()->setChat(chat);

	if (SearchedStorage && *SearchedStorage)
	{
		HistoryQuery query;
		query.setTalkable(talkable);
		query.setFromDate(date);
		query.setToDate(date);

		TimelineView->setFutureMessages((*SearchedStorage)->messages(query));
	}
	else
		TimelineView->setMessages(SortedMessages());
}
Esempio n. 8
0
void MainDialog::setStatus( const QString & status )
{
	updateTray();
	LOG_5( "MainDialog::setStatus() called with status " + status );

	QString st = status;
	st[0] = st[0].toUpper();

	// Find the status display entry
	display * d = disps;
	for( ; d && d->status; d++ )
		if( st == QString( d->status ) )
			break;

	// If not found, move back to "Error"
	if( !d->status ) d--;

	if( d && d->status ) {
		setDisplay( d->button_text, d->status, d->color );
		if( d->bring_to_front ) {
			if( !isVisible() )
				show();
			if( mBringToTop ) {
				raise();
				activateWindow();
			}
		}
	}

	mBringToTop = false;

	LOG_5( "MainDialog::setStatus() done setting status " + status + ", returning");
}
Esempio n. 9
0
void frmMain::OnPropSelChanged(wxListEvent &event)
{
	if (properties->GetSelectedItemCount() == 1)
	{
		wxTreeItemId item = browser->GetSelection();
		if (item)
		{
			pgObject *data = browser->GetObject(item);
			if (data && data->IsCollection())
			{
				currentObject = ((pgCollection *)data)->FindChild(browser, event.GetIndex());
				if (currentObject)
				{
					setDisplay(currentObject);
					sqlPane->SetReadOnly(false);
					sqlPane->SetText(currentObject->GetSql(browser));
					sqlPane->SetReadOnly(true);
				}
			}
		}
	}

	editMenu->Enable(MNU_COPY, properties->GetSelectedItemCount() > 0);

// The generic list view control on the Mac doesn't fire focus events
// as it should, so we set currentControl here instead of relying on
// the ChildFocusEvent. The native list view does fire the events, but
// does weird things with multi-select items so we currently disable
// it (see the creation of the listviews in frmMain.cpp).
#ifdef __WXMAC__
	currentControl = properties;
#endif
}
Esempio n. 10
0
void TM16XX::setDisplayToError()
{
    setDisplay(ERROR_DATA, 8);

	for (int i = 8; i < displays; i++) {
	    clearDisplayDigit(i, 0);
	}
}
Esempio n. 11
0
void Stat::setAll(const char* allch) {
	String all = allch;
	int indexof = all.find(",");
	if (indexof > -1) {
		setDesc(all.substr(0,indexof++).c_str());
		all=all.substr(indexof);
		indexof = all.find(",");
		setDisplay(all.substr(0,indexof++).c_str());
		all=all.substr(indexof);
		indexof = all.find(",");
		setIVal(all.substr(0,indexof++).c_str());
	} else {
		setDesc("");
		setDisplay("");
		setIVal("");
	}
}
Esempio n. 12
0
 */y
#define __HYSTER_CPP__
#include "hyster.h"

Hyster::Hyster()
{
   setDisplay(XOpenDisplay(0));
}
Esempio n. 13
0
 void Slot::setChildArmature(Armature *value)
 {
     _displayList[_displayIndex] = value;
     if(value)
     {
         setDisplay(value->getDisplay());
     }
 }
Esempio n. 14
0
LCDNumber::LCDNumber(QVBoxLayout*& verticalLayout,int minutes,int seconds)
{
    timer	= 	new QTimer();
   timeValue	=	new QTime(0,minutes,seconds,0);
   verticalLayout->addWidget(this);
   this->display(timeValue->toString(QString("mm:ss")));
   QObject::connect(timer,SIGNAL(timeout()),this,SLOT(setDisplay()));

}
Esempio n. 15
0
int
setUnion(Set *setuAB, Set setA, Set setB){
  int i;
  Set setp, prev_setp, union_setp;
  size_t nchars;
  Element e;

  /*DONT TURN THIS IN WITHOUT CHECKING EDGE CASES
   1. both setA and setB could be invalid.
   2. one of the two could be invalid.
  */
  if((setA == NULL) || (setB == NULL)){
    return -1;
  }
  
  union_setp = malloc(sizeof(setElement));
  /*for saftey clear the allocated memory.*/
  memset((void*)union_setp, 0 , sizeof(setElement));
  *setuAB = union_setp;
  i = 0;
  for (setp = setA; setp->next != NULL; setp = setp->next){
    e = setp->element;
#ifdef DEBUG
    debug("Add \"%s\" to Set %p.",e,(void*)(*setuAB));    
#endif
    ++i;
    nchars = strlen(e) + 1;
    union_setp->element = malloc(nchars);
    strncpy(union_setp->element, e, nchars);
    prev_setp = union_setp;
    union_setp = malloc(sizeof(setElement));
    prev_setp->next = union_setp;
  }
  for (setp = setB; setp->next != NULL; setp = setp->next){
    e = setp->element;
    if(setIsElement(e,setA))
      continue;
#ifdef DEBUG
    debug("Add \"%s\" to Set %p.",e,(void*)(*setuAB));
#endif
    ++i;
    nchars = strlen(e) + 1;
    union_setp->element = malloc(nchars);
    strncpy(union_setp->element, e, nchars);
    prev_setp = union_setp;
    union_setp = malloc(sizeof(setElement));
    prev_setp->next = union_setp;
  }
#ifdef DEBUG
  setDisplay(*setuAB);
#endif
  return 0;
}
Esempio n. 16
0
BeingInfo::BeingInfo() :
    mDisplay(),
    // TRANSLATORS: being info default name
    mName(_("unnamed")),
    mTargetCursorSize(TargetCursorSize::MEDIUM),
    mHoverCursor(Cursor::CURSOR_POINTER),
    mSounds(),
    mAttacks(),
    mMenu(),
    mStrings(),
    mBlockWalkMask(BlockMask::WALL
                 | BlockMask::AIR
                 | BlockMask::WATER),
    mBlockType(BlockType::NONE),
    mColors(nullptr),
    mTargetOffsetX(0),
    mTargetOffsetY(0),
    mNameOffsetX(0),
    mNameOffsetY(0),
    mHpBarOffsetX(0),
    mHpBarOffsetY(0),
    mMaxHP(0),
    mSortOffsetY(0),
    mDeadSortOffsetY(31),
    mAvatarId(BeingTypeId_zero),
    mWidth(0),
    mHeight(0),
    mStartFollowDist(3),
    mFollowDist(1),
    mWarpDist(11),
    mWalkSpeed(0),
    mSitOffsetX(0),
    mSitOffsetY(0),
    mMoveOffsetX(0),
    mMoveOffsetY(0),
    mDeadOffsetX(0),
    mDeadOffsetY(0),
    mAttackOffsetX(0),
    mAttackOffsetY(0),
    mThinkTime(50),
    mDirectionType(1),
    mSitDirectionType(1),
    mDeadDirectionType(1),
    mAttackDirectionType(1),
    mStaticMaxHP(false),
    mTargetSelection(true),
    mAllowDelete(true)
{
    SpriteDisplay display;
    display.sprites.push_back(SpriteReference::Empty);

    setDisplay(display);
}
Esempio n. 17
0
/// Fill the digits array based on current state.
void handleDigits(uint8_t *digits, struct tm *t) {
  if (gSettingUtcOffset) {
    digits[0] = 0;
    if (gBlinkStatus) {
      memchr(digits + 1, DIGIT_BLANK, 5);
    } else {
      digits[1] = gUtcOffset < 0 ? DIGIT_DASH : DIGIT_BLANK;
      uint16_t dispHrs = abs(gUtcOffset / 3600);
      uint16_t dispMins = abs(gUtcOffset / 60) % 60;
      digits[2] = (dispHrs / 10) % 10;
      digits[3] = (dispHrs / 1) % 10;
      digits[4] = (dispMins / 10) % 10;
      digits[5] = (dispMins / 1) % 10;
    }
  } else {
    // TODO: Configurable 12/24 hour.
    uint8_t h = t->tm_hour;
    h %= 12; if (h == 0) h = 12;  // Cast 24->12 hour.
    digits[0] = h / 10;
    digits[1] = h % 10;
    digits[2] = t->tm_min / 10;
    digits[3] = t->tm_min % 10;
    digits[4] = t->tm_sec / 10;
    digits[5] = t->tm_sec % 10;
  }

  if (gBlinkPos > 0) {
    if (gBlinkStatus) {
      digits[gBlinkPos] = DIGIT_BLANK;
      // gBlinkPos of 1 means "hours"; blink both digits.
      if (gBlinkPos == 1) {
        digits[0] = DIGIT_BLANK;
      }
    }
    setDisplay(digits);
  } else if (gSettingUtcOffset) {
    setDisplay(digits);
  }
}
Esempio n. 18
0
TableOfContentsConfigure::TableOfContentsConfigure(KoTextEditor *editor, KoTableOfContentsGeneratorInfo *info, QWidget *parent) :
    QDialog(parent),
    m_textEditor(editor),
    m_tocStyleConfigure(0),
    m_tocInfo(0),
    m_document(0),
    m_tocEntryStyleModel(0),
    m_tocEntryConfigureDelegate(0)
{
    init();
    m_tocInfo = info->clone();
    setDisplay();
}
void SpriteDisplayFactory::changeDisplay(Bone *_bone, DecorativeDisplay *_decoDisplay)
{
    CCSprite *_renderNode = (CCSprite*)getRenderNode(_bone, _decoDisplay);
    
    
#if SP_DEBUG_FOR_EDIT
    BatchNodeManager::sharedBatchNodeManager()->getCurrentLayer()->addChild(_renderNode);
#else
    SpriteDisplayData *_displayData = (SpriteDisplayData*)_decoDisplay->getDisplayData();
    
    // remove .xxx
    std::string _textureName = _displayData->getDisplayName();
    size_t startPos = _textureName.find_last_of(".");
    
    if(startPos != std::string::npos)
    {
        _textureName = _textureName.erase(startPos);
    }
    
    _textureName += ".png";
    
    if(_textureName.compare(".png") == 0)
    {
        //BatchNodeManager::sharedBatchNodeManager()->getCurrentLayer()->addChild(_renderNode);
    }
    else
    {
        std::string imagePath =  ArmatureDataManager::sharedArmatureDataManager()->getDisplayImagePath(_textureName.c_str());
        
        CCSpriteBatchNode *_batchNode = BatchNodeManager::sharedBatchNodeManager()->getBatchNode(imagePath);
        _batchNode->addChild(_renderNode);
    }
#endif
    
    
#if SP_DEBUG_FOR_EDIT
    ContourSprite *_contourSprite = _decoDisplay->getContourSprite();
    //CCLOG("change display %s", m_strName.c_str());
    
    if(_contourSprite)
    {
        _contourSprite->removeFromParentAndCleanup(true);
        BatchNodeManager::sharedBatchNodeManager()->getCurrentLayer()->addChild(_contourSprite);
    }
#endif
    
    _bone->setChildArmature(NULL);
    

	setDisplay(_bone, _decoDisplay, _renderNode);
}
Esempio n. 20
0
EGLNativeWindowType QEglFSEmulatorIntegration::createNativeWindow(QPlatformWindow *platformWindow,
                                                                  const QSize &size,
                                                                  const QSurfaceFormat &format)
{
    Q_UNUSED(size);
    Q_UNUSED(format);
    QEglFSEmulatorScreen *screen = static_cast<QEglFSEmulatorScreen *>(platformWindow->screen());
    if (screen && setDisplay) {
        // Let the emulator know which screen the window surface is attached to
        setDisplay(screen->id());
    }
    static QBasicAtomicInt uniqueWindowId = Q_BASIC_ATOMIC_INITIALIZER(0);
    return EGLNativeWindowType(qintptr(1 + uniqueWindowId.fetchAndAddRelaxed(1)));
}
Esempio n. 21
0
void SimpleActiveFiltersModel::Impl::addFilter(const char* display, const char* value, bool active)
{
	auto found = std::find_if(filterTerms_.begin(), filterTerms_.end(), [value](const Variant& term) {
		return term.value<ObjectHandleT<ActiveFilterTerm>>()->getValue() == value;
	});
	if (found == filterTerms_.end())
	{
		auto filterTerm = get<IDefinitionManager>()->create<ActiveFilterTerm>();
		filterTerm->setDisplay(display);
		filterTerm->setValue(value);
		filterTerm->setActive(active);
		filterTerms_.push_back(filterTerm);
	}
}
Esempio n. 22
0
void Serial_LCD::off() {
  clear();

  _port->print('o');
  _port->print((char)0x04);   // state
  _port->flush();

  setBacklight(false);  // backlight off
  clear();
  setDisplay(false);  // display off

  _port->print('Q');    // reset to default speed
  _port->print((char)0x06);    // 
  delay(10);
}
Esempio n. 23
0
void TextUI::processUserInput(string userCommand) {

	//showToUser(MESSAGE_WELCOME);

	//pass user input as a string to Logic
	toLogic.processCommand(userCommand);
		/*
		if(TRUE //valid formatting, command succesfully executed) 
			printCommand();
		else 
			showToUser(ERROR_INVALID_FORMAT);	
		*/
	setFeedback(userCommand);
	setDisplay(userCommand);

}
int Q3TimeEdit::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = Q3DateTimeEditBase::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 3)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 3;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QTime*>(_v) = time(); break;
        case 1: *reinterpret_cast< bool*>(_v) = autoAdvance(); break;
        case 2: *reinterpret_cast< QTime*>(_v) = maxValue(); break;
        case 3: *reinterpret_cast< QTime*>(_v) = minValue(); break;
        case 4: *reinterpret_cast<int*>(_v) = QFlag(display()); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setTime(*reinterpret_cast< QTime*>(_v)); break;
        case 1: setAutoAdvance(*reinterpret_cast< bool*>(_v)); break;
        case 2: setMaxValue(*reinterpret_cast< QTime*>(_v)); break;
        case 3: setMinValue(*reinterpret_cast< QTime*>(_v)); break;
        case 4: setDisplay(QFlag(*reinterpret_cast<int*>(_v))); break;
        }
        _id -= 5;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 5;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 5;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
Esempio n. 25
0
void JabberRoomChat::participantChanged(const QString &id)
{
    auto jid = Jid::parse(id);
    auto contact = m_contactManager->byId(m_chat.chatAccount(), id, ActionCreateAndAdd);
    auto buddy = m_buddyManager->byContact(contact, ActionCreateAndAdd);
    buddy.setDisplay(jid.resource());
    buddy.setTemporary(true);

    auto status = m_presenceService->presenceToStatus(m_room->participantPresence(id));
    contact.setCurrentStatus(status);

    auto details = static_cast<ChatDetailsRoom *>(m_chat.details());
    if (status.isDisconnected())
        details->removeContact(contact);
    else
        details->addContact(contact);
}
Esempio n. 26
0
TableOfContentsConfigure::TableOfContentsConfigure(KoTextEditor *editor, QTextBlock block, QWidget *parent) :
    QDialog(parent),
    m_textEditor(editor),
    m_tocStyleConfigure(0),
    m_tocInfo(0),
    m_block(block),
    m_document(0),
    m_tocEntryStyleModel(0),
    m_tocEntryConfigureDelegate(0)
{
    init();

    KoTableOfContentsGeneratorInfo *info = block.blockFormat().property(KoParagraphStyle::TableOfContentsData).value<KoTableOfContentsGeneratorInfo*>();
    m_tocInfo = info->clone();

    setDisplay();
}
void timer_interrupt(void){
	float vel = 0;
	int vel_int = 0, vel_part = 0;
	cont = (unsigned long int)TACOMETRO_L;
	cont |= ((unsigned long int) TACOMETRO_H)<<8;

	vel = ((float) cont)/(1.4);
	vel_int = vel;
	vel_part = 10000.*(vel-vel_int);

	setDisplay(vel_int, vel_part);

	INTCONbits.TMR0IF = 0;

	TMR0H = 0x3C;
	TMR0L = 0xB0;

	TMR1H = 0;
	TMR1L = 0;
}
Esempio n. 28
0
void XWindow::classicInit(void)
{
    XVisualInfo       *vi, visInfo;
    XWindowAttributes winAttr;

    XGetWindowAttributes(getDisplay(), getWindow(), &winAttr);

    // get the existing glWidget's visual-id
    memset(&visInfo, 0, sizeof(XVisualInfo));

    visInfo.visualid = XVisualIDFromVisual(winAttr.visual);

    // get new display-variable
    if(getDisplay() == NULL)
    {
        setDisplay(XOpenDisplay(DisplayString(getDisplay())));  
    }
        
    // get a visual for the glx context
    int nvis;
    
    vi = XGetVisualInfo(getDisplay(), VisualIDMask, &visInfo, &nvis);

    // is the visual GL-capable ?
    int useGL;
    glXGetConfig( getDisplay(), 
                  vi, 
                  GLX_USE_GL, 
                 &useGL );

    if (!useGL)
    {
        SFATAL << "Visual is not OpenGL-capable!" << std::endl;
        exit(0);
    }    
        
    // create the new context
    this->setContext(glXCreateContext(getDisplay(), vi, None, GL_TRUE));
        
    XFree(vi);
}
Esempio n. 29
0
bool MainScene::init()
{
    Size sizeWin = DIRECTOR->getWinSize();
    float listWidth = sizeWin.width - sizeWin.height;
    
    // background layout
    auto layerColor = LayerColor::create(Color4B::WHITE, sizeWin.width, sizeWin.height);
    auto drawNodeV = DrawNode::create();
    drawNodeV->drawSegment(Point(listWidth, 0), Point(listWidth, sizeWin.height), 2, Color4F::GRAY);
    layerColor->addChild(drawNodeV);
    auto drawNodeH = DrawNode::create();
    drawNodeH->drawSegment(Point(listWidth, sizeWin.height / 3), Point(sizeWin.width, sizeWin.height / 3), 2, Color4F::GRAY);
    layerColor->addChild(drawNodeH);
    addChild(layerColor);
    
    // title
    auto btnTitle = Button::create();
    btnTitle->setTouchEnabled(true);
    btnTitle->ignoreContentAdaptWithSize(false);
    btnTitle->setTitleFontName("Marker Felt");
    btnTitle->setTitleText("Cocos2d Manual");
    btnTitle->setTitleColor(Color3B::GREEN);
    btnTitle->setTitleFontSize(30);
    btnTitle->setSize(Size(listWidth, 40));
    btnTitle->setPosition(Point(listWidth / 2, sizeWin.height - 30));
    BIND_LISTENER_TOUCH(btnTitle, this, MainScene::onTouchTitle);
    addChild(btnTitle);
    
    // manual layer
    auto layerDisplay = ManualDisplay::create();
    auto layerCode = ManualCode::create();
    auto layerList = ManualList::create();
    layerCode->setDisplay(layerDisplay);
    layerCode->setTag(Tag::TAG_CODELAYER);
    layerList->setCode(layerCode);
    addChild(layerDisplay);
    addChild(layerCode);
    addChild(layerList);
    
    return Layer::init();
}
Esempio n. 30
0
void ccGenericMesh::setMaterialSet(ccMaterialSet* materialSet, bool autoReleaseOldMaterialSet/*=true*/)
{
    if (m_materials == materialSet)
        return;

    if (m_materials && autoReleaseOldMaterialSet)
    {
        int childIndex = getChildIndex(m_materials);
        m_materials->release();
        m_materials=0;
        if (childIndex>=0)
            removeChild(childIndex);
    }

    m_materials = materialSet;
    if (m_materials)
        m_materials->link();

    //update display (for textures!)
    setDisplay(m_currentDisplay);
}