コード例 #1
0
ファイル: gendsl.c プロジェクト: alepharchives/casm
void string_gen(Context* context, char* label, int* err, char* str, int lineNum, char* origLine) {
	node* n;
	if (label[0]=='\0') {
		n = newLabel("",  lineNum, trimNewline(origLine));
		context->allLabels = append(context->allLabels, n);
	} else {
		n = find(context->allLabels, findLabelText, label);
		if (n!=NULL) {
			if (LABEL(n)->isExtern == 1) {
				printf(" Error at line %d '%s': label '%s' defined as extern in line  %d '%s'.\n", lineNum, trimNewline(origLine), label, LABEL(n)->origLineNuber, LABEL(n)->origLine);
				*err = GEN_ERROR;
				return;
			}
			else if (LABEL(n)->isEntry == 0) {
				printf(" Error at line %d '%s': label '%s' already defined in line %d '%s'.\n", lineNum, trimNewline(origLine), label, LABEL(n)->origLineNuber, LABEL(n)->origLine);
				*err = GEN_ERROR;
				return;
			}
			else if (LABEL(n)->isEntry == 1) {
				LABEL(n)->origLineNuber = lineNum;
				strcpy(LABEL(n)->origLine, trimNewline(origLine));
			}
		}
		else {
			n = newLabel(label,   lineNum, trimNewline(origLine));
			context->allLabels = append(context->allLabels, n);
		}
	}
	LABEL(n)->kind = STRING_KIND;
	LABEL(n)->get.data.kind = STRING_KIND;
	LABEL(n)->get.data.getData.str = str;
	LABEL(n)->get.data.offset=-1;

}
コード例 #2
0
void Picnic1::createBg()
{
    newSprite("picnic01-background", G_SWIDTH/2, G_SHEIGHT/2, this, -1, RATIO_XY);
    joshSprite = newSprite("picnic01-josh", getX(252), getY(330), this, 0, RATIO_XY);
    emmaSprite = newSprite("picnic01-emma", getX(854), getY(330), this, 0, RATIO_XY);
    ballSprite = newSprite("picnic03-ball", getX(540), getY(350), this, 0, RATIO_XY);
    sunSprite = newSprite("picnic01-sun", getX(852), getY(50), this, 0, RATIO_XY);
    
    lbFirst = newLabel("Josh and Emma are getting hungry,", "Arial", 40, G_SWIDTH/2, getY(530), this, 1, RATIO_X);
    lbFirst->setOpacity(0);
    lbSecond = newLabel("it must be time for lunch.", "Arial", 40, G_SWIDTH/2, getY(580), this, 1, RATIO_X);
    lbSecond->setOpacity(0);
    
    labelBackgroundSprite = newSprite("white-1-pixel", G_SWIDTH/2, getY(530), this, 0, RATIO_XY);
    labelBackgroundSpriteForlabel2 = newSprite("white-1-pixel", G_SWIDTH/2, getY(580), this, 0, RATIO_XY);
    CCSize labelSize = lbFirst->getContentSize();
    CCSize labelSize2 = lbSecond->getContentSize();
    labelBackgroundSprite->setScaleX(labelSize.width);
    labelBackgroundSprite->setScaleY(40);
    //labelBackgroundSprite->setOpacity(30);
    labelBackgroundSpriteForlabel2->setScaleX(labelSize2.width);
    labelBackgroundSpriteForlabel2->setScaleY(40);
  //  labelBackgroundSpriteForlabel2->setOpacity(30);
    labelBackgroundSpriteForlabel2->setVisible(false);
    labelBackgroundSprite->setVisible(false);
    
    lbFirst->runAction(CCSequence::create(CCDelayTime::create(1.0f), CCCallFunc::create(this,callfunc_selector(Picnic1::playEffect1)), CCFadeIn::create(0.5f), CCCallFunc::create(this,callfunc_selector(Picnic1::SetvisibilityForTextBackground1)), NULL));
    lbSecond->runAction(CCSequence::create(CCDelayTime::create(3.0f), CCCallFunc::create(this,callfunc_selector(Picnic1::playEffect2)),CCFadeIn::create(1.0f), CCCallFunc::create(this,callfunc_selector(Picnic1::SetvisibilityForTextBackground2)), NULL));
}
コード例 #3
0
ファイル: parser.cpp プロジェクト: paddatrapper/compiler
 void Parser::doFor()
 {
     input.match('f');
     std::string l1 = newLabel();
     std::string l2 = newLabel();
     input.match('(');
     char name = input.getName();
     input.match('=');
     expression();
     output.emitLine("SUBQ #1,D0");
     output.emitLine("LEA " + Cradle::toString(name) + "(PC),A0");
     output.emitLine("MOVE D0,-(SP)");
     output.postLabel(l1);
     output.emitLine("LEA " + Cradle::toString(name) + "(PC),A0");
     output.emitLine("MOVE (A0),D0");
     output.emitLine("ADDQ #1,D0");
     output.emitLine("MOVE D0,(A0)");
     output.emitLine("CMP (SP),D0");
     output.emitLine("BGT " + l2);
     input.match(')');
     input.match('{');
     block(l2);
     output.emitLine("BRA " + l1);
     output.postLabel(l2);
     output.emitLine("ADDQ #2,SP");
     input.match('}');
 }
コード例 #4
0
ファイル: tac.c プロジェクト: marceloprates/compiladores
TAC* loop_tac(TAC* test, TAC* loopBlock)
{
	linkedList_t* testResult = test->destination;
	linkedList_t* loopLabel = newLabel();
	linkedList_t* endLabel = newLabel();

	TAC* new_test = clone(test);
	
	return
		append(
			append(
				append(
					append(
						test,
						append(	
							tac(TAC_LABEL, loopLabel, NULL, NULL),
							tac(TAC_IFZ, endLabel, testResult, NULL)
						)
					),
					loopBlock
				),
				append(
					new_test,
					tac(TAC_JUMP, loopLabel, NULL, NULL)
				)
			),
			tac(TAC_LABEL, endLabel, NULL, NULL)
		);
}
コード例 #5
0
void doFor()
{
	int l1, l2;
	char name;

	match('f');
	l1 = newLabel();
	l2 = newLabel();
	name = getName();
	match('=');
	expression();
	emit("DEC AX");
	emit("MOV [%c], AX", name);
	expression();
	emit("PUSH AX");
	postLabel(l1);
	emit("MOV AX, [%c]", name);
	emit("INC AX");
	emit("MOV [%c], AX", name);
	emit("POP BX");
	emit("PUSH BX");
	emit("CMP AX, BX");
	emit("JG L%d", l2);
	block(l2);
	match('e');
	emit("JMP L%d", l1);
	postLabel(l2);
	emit("POP AX");
}
コード例 #6
0
ファイル: parser.cpp プロジェクト: nicolai490/---endur
SymbolTableEntry* Parser::parseExpressionPrime(SymbolTableEntry* prevEntry){
	SymbolTableEntry* result = prevEntry;
	if(isNext(tc_RELOP)){
		OpType t = m_currentToken->getOpType();
		match(tc_RELOP);
		SymbolTableEntry* exp = parseSimpleExpression();
		result = newTemp();
		SymbolTableEntry* tr = newLabel();
		SymbolTableEntry* end = newLabel();
		if(t == op_LT){
			m_code->generate(cd_LT, prevEntry, exp, tr);
		}
		else if(t == op_LE){
			m_code->generate(cd_LE, prevEntry, exp, tr);
		}
		else if(t == op_GT){
			m_code->generate(cd_GT, prevEntry, exp, tr);
		}
		else if(t == op_GE){
			m_code->generate(cd_GE, prevEntry, exp, tr);
		}
		else if(t == op_EQ){
			m_code->generate(cd_EQ, prevEntry, exp, tr);
		}
		else{
			m_code->generate(cd_NE, prevEntry, exp, tr);
		}
		m_code->generate(cd_ASSIGN, m_symbolTable->lookup(CodeFalse), NULL, result);
		m_code->generate(cd_GOTO, NULL, NULL, end);
		m_code->generate(cd_LABEL, NULL, NULL, tr);
		m_code->generate(cd_ASSIGN, m_symbolTable->lookup(CodeTrue), NULL, result);
		m_code->generate(cd_LABEL, NULL, NULL, end);
	}
	return result;
}
コード例 #7
0
ファイル: tac.c プロジェクト: marceloprates/compiladores
TAC* ifZero_tac(TAC* test, TAC* thenBlock, TAC* elseBlock)
{
	TAC* result;
	linkedList_t* testResult = test->destination;
	linkedList_t* elseLabel = newLabel();
	
	TAC* ifThen = append(append(test, tac(TAC_IFZ, elseLabel, testResult, NULL)), thenBlock);
	
	if(elseBlock == NULL)
	{
		result = append(ifThen, tac(TAC_LABEL, elseLabel, NULL, NULL));
	}
	else
	{
		linkedList_t* endLabel = newLabel();
		
		result =
			append(
				append(
					append(
						append(
							ifThen,
							tac(TAC_JUMP, endLabel, NULL, NULL)
						),
						tac(TAC_LABEL, elseLabel, NULL, NULL)
					),
					elseBlock
				),
				tac(TAC_LABEL, endLabel, NULL, NULL)
			);
	}
	
	return result;
}
コード例 #8
0
void Picnic2::createBg()
{
    newSprite("picnic02-background", G_SWIDTH/2, G_SHEIGHT/2, this, -1, RATIO_XY);
    basketSprite = newSprite("picnic02-basket", getX(630), getY(350), this, 0, RATIO_XY);
    
    lbFirst = newLabel("Mom says she packed a special picnic lunch for the beach.", "Arial", 40, G_SWIDTH/2, getY(530), this, 1, RATIO_X);
    lbFirst->setOpacity(0);
    lbSecond = newLabel("I wonder what makes it so special.", "Arial", 40, G_SWIDTH/2, getY(580), this, 1, RATIO_X);
    lbSecond->setOpacity(0);
    
    labelBackgroundSprite = newSprite("white-1-pixel", G_SWIDTH/2, getY(530), this, 0, RATIO_XY);
    labelBackgroundSpriteForlabel2 = newSprite("white-1-pixel", G_SWIDTH/2, getY(580), this, 0, RATIO_XY);
    CCSize labelSize = lbFirst->getContentSize();
    CCSize labelSize2 = lbSecond->getContentSize();
    labelBackgroundSprite->setScaleX(labelSize.width);
    labelBackgroundSprite->setScaleY(40);
    //labelBackgroundSprite->setOpacity(30);
    labelBackgroundSpriteForlabel2->setScaleX(labelSize2.width);
    labelBackgroundSpriteForlabel2->setScaleY(40);
    //labelBackgroundSpriteForlabel2->setOpacity(30);
    labelBackgroundSpriteForlabel2->setVisible(false);
    labelBackgroundSprite->setVisible(false);
    
    lbFirst->runAction(CCSequence::create(CCDelayTime::create(1.0f), CCCallFunc::create(this,callfunc_selector(Picnic2::playEffect1)), CCFadeIn::create(0.5f), CCCallFunc::create(this,callfunc_selector(Picnic2::SetvisibilityForTextBackground1)), NULL));
    lbSecond->runAction(CCSequence::create(CCDelayTime::create(5.0f), CCCallFunc::create(this,callfunc_selector(Picnic2::playEffect2)),CCFadeIn::create(1.0f), CCCallFunc::create(this,callfunc_selector(Picnic2::SetvisibilityForTextBackground2)), NULL));
}
コード例 #9
0
ファイル: parser.cpp プロジェクト: nicolai490/---endur
void Parser::parseStatement(){
	if(isNext(tc_ID)){
		SymbolTableEntry* entry = m_currentToken->getSymTabEntry();
		match(tc_ID);
		parseStatementPrime(entry);
	}
	else if(isNext(tc_IF)){
		match(tc_IF);
		SymbolTableEntry* exp = parseExpression();
		SymbolTableEntry* f = newLabel();
		SymbolTableEntry* end = newLabel();
		m_code->generate(cd_EQ, exp, m_symbolTable->lookup(CodeFalse), f);
		match(tc_THEN);
		if(m_parserError){
			TokenCode synch[] = {tc_ID, tc_BEGIN, tc_IF, tc_WHILE, tc_NONE};
			recover(synch);
//			if(isNext(tc_THEN)){
//				match(tc_THEN);
//			}
		}
		parseStatement();
		m_code->generate(cd_GOTO, NULL, NULL, end);
		m_code->generate(cd_LABEL, NULL, NULL, f);
		match(tc_ELSE);
		if(m_parserError){
			TokenCode synch[] = {tc_ID, tc_BEGIN, tc_IF, tc_WHILE, tc_NONE};
			recover(synch);
//			if(isNext(tc_ELSE)){
//				match(tc_ELSE);
//			}
		}
		parseStatement();
		m_code->generate(cd_LABEL, NULL, NULL, end);
	}
	else if(isNext(tc_WHILE)){
		match(tc_WHILE);
		SymbolTableEntry* start = newLabel();
		m_code->generate(cd_LABEL, NULL, NULL, start);
		SymbolTableEntry* exp = parseExpression();
		SymbolTableEntry* end = newLabel();
		m_code->generate(cd_EQ, exp, m_symbolTable->lookup(CodeFalse), end);
		match(tc_DO);
		if(m_parserError){
			TokenCode synch[] = {tc_ID, tc_BEGIN, tc_IF, tc_WHILE, tc_NONE};
			recover(synch);
//			if(isNext(tc_DO)){
//				match(tc_DO);
//			}
		}
		parseStatement();
		m_code->generate(cd_GOTO, NULL, NULL, start);
		m_code->generate(cd_LABEL, NULL, NULL, end);
	}
	else{
		parseCompoundStatement();
	}
}
コード例 #10
0
ファイル: parser.cpp プロジェクト: paddatrapper/compiler
 void Parser::doLoop()
 {
     input.match('l');
     std::string l1 = newLabel();
     std::string l2 = newLabel();
     output.postLabel(l1);
     input.match('{');
     block(l2);
     input.match('}');
     output.emitLine("BRA " + l1);
     output.postLabel(l2);
 }
コード例 #11
0
/* analisa e traduz um comando LOOP*/
void doLoop()
{
	int l1, l2;

	match('p');
	l1 = newLabel();
	l2 = newLabel();
	postLabel(l1);
	block(l2);
	match('e');
	emit("JMP L%d", l1);
	postLabel(l2);
}
コード例 #12
0
ファイル: parser.cpp プロジェクト: paddatrapper/compiler
 void Parser::doDoWhile()
 {
     input.match('r');
     std::string l1 = newLabel();
     std::string l2 = newLabel();
     input.match('{');
     output.postLabel(l1);
     block(l2);
     input.match('}');
     input.match('w');
     boolExpression();
     output.emitLine("BEQ " + l1);
     output.postLabel(l2);
 }
コード例 #13
0
/* analisa e traduz um REPEAT-UNTIL*/
void doRepeat()
{
	int l1, l2;

	match('r');
	l1 = newLabel();
        l2 = newLabel();
	postLabel(l1);
	block(l2);
	match('u');
	condition();
	emit("JZ L%d", l1);
	postLabel(l2);
}
コード例 #14
0
void Else::gen(int b, int a){
	int label1 = newLabel();
	int label2 = newLabel();
	test->jumping(0,label2);

	emitLabel(label1);
	stmt1->gen(label1, a);
	std::stringstream gt;
	gt<<"goto L"<<a;
	emit(gt.str());

	emitLabel(label2);
	stmt2->gen(label2,a);
}
コード例 #15
0
/* analisa e traduz um comando WHILE */
void doWhile()
{
	int l1, l2;

	match('w');
	l1 = newLabel();
	l2 = newLabel();
	postLabel(l1);
	condition();
	emit("JZ L%d", l2);
	block(l2);
	match('e');
	emit("JMP L%d", l1);
	postLabel(l2);
}
コード例 #16
0
ファイル: vmCode.c プロジェクト: tctsigemura/C--
// if 文
static void genIf(int node) {
  struct Label* ifLab = newLabel(0);              // ラベルを割り当てる
  genCnd(syGetLVal(node), false, ifLab);          // 条件式がfalseならジャンプ
  traceTree(syGetRVal(node));                     // 本文の解析
  printLab(ifLab->no);
  free(ifLab);
}
コード例 #17
0
ファイル: vmCode.c プロジェクト: tctsigemura/C--
// while 文 と for 文
static void genWhl(int node) {
  int tmpLabB = brkLab;                           // ラベルを保存
  int tmpLabC = cntLab;
  int loopLab = newLab();                         // 条件式のラベル
  int sta = syGetRVal(node);                      // 本文 + 再初期化
  boolean jb = jmpBlock(syGetLVal(sta));          // 本文は JMP で終わる
  cntLab = -1;                                    // continue 時のジャンプ先
  brkLab = -1;                                    // break 時のジャンプ先
  if (syGetRVal(sta)==SyNULL) cntLab = loopLab;   // 再初期化がない場合
  printLab(loopLab);                              // ループ先頭のラベル
  if (syGetLVal(node)!=SyNULL) {                  // 条件式がある場合
    struct Label* bLab = newLabel(0);             //   ループ脱出用ラベル
    genCnd(syGetLVal(node), false, bLab);         //   falseならジャンプ
    brkLab = bLab->no;                            //   break 時にも使用する
    free(bLab);
  }
  traceTree(syGetLVal(sta));                      // 本文の解析
  if (syGetRVal(sta)!=SyNULL &&                   // 再初期化がある場合
      (!jb || cntLab!=-1)) {                      //   再初期化に到達するなら
    printLab(cntLab);                             //   continue 時のジャンプ先
    traceTree(syGetRVal(sta));                    //   再初期化を解析
    jb = false;                                   //   再初期化はJMPで終わらない
  } 
  if (!jb) vmJmp(loopLab);                        // 条件式に戻る
  printLab(brkLab);                               // break 時のジャンプ先
  cntLab = tmpLabC;
  brkLab = tmpLabB;
}
コード例 #18
0
ファイル: dashboardgui.cpp プロジェクト: HuyLafa/RocketBook
void DashboardGUI::displayMultimedia(Multimedia* multimedia, QListWidget* theList) {

    // get data to display
    QString title = multimedia->getTitle();
    QString description = multimedia->getDescription();
    QString content = multimedia->getContent();

    if (title.isEmpty()) {
        title = "<No Title>";
    }

    QString newLabel("PHOTO \n" +
                     title + "\n" +
                     "@" + multimedia->getAuthorUsername() + "\n" +
                     description + "\n");

    // display each media as a QListWidgetItem
    QListWidgetItem *newMedia = new QListWidgetItem(QIcon(content), newLabel, theList);

    newMedia->setData(listItemTypeRole, multimediaListItemType);
    newMedia->setData(listItemIDRole, multimedia->getID());

    theList->addItem(newMedia);

    theList->setIconSize(QSize(125,125));
}
コード例 #19
0
QLabel * newLabel(const QString &pText, QWidget *pParent)
{
    // Create and return a label

    return newLabel(pText, 1.0, false, false, Qt::AlignLeft|Qt::AlignVCenter,
                    pParent);
}
コード例 #20
0
ファイル: parser.cpp プロジェクト: paddatrapper/compiler
 void Parser::doDo()
 {
     input.match('d');
     std::string l1 = newLabel();
     std::string l2 = newLabel();
     expression();
     output.emitLine("SUBQ #1,D0");
     output.postLabel(l1);
     output.emitLine("MOVE D0,-(SP)");
     block(l2);
     output.emitLine("MOVE (SP)+,D0");
     output.emitLine("DBRA D0," + l1);
     output.emitLine("SUBQ #2,SP");
     output.postLabel(l2);
     output.emitLine("ADDQ #2,SP");
 }
コード例 #21
0
QLabel * newLabel(const QString &pText, const double &pFontPercentage,
                  QWidget *pParent)
{
    // Create and return a label

    return newLabel(pText, pFontPercentage, false, false,
                    Qt::AlignLeft|Qt::AlignVCenter, pParent);
}
コード例 #22
0
QLabel * newLabel(const QString &pText, const double &pFontPercentage,
                  const bool &pBold, const bool &pItalic, QWidget *pParent)
{
    // Create and return a label

    return newLabel(pText, pFontPercentage, pBold, pItalic,
                    Qt::AlignLeft|Qt::AlignVCenter, pParent);
}
コード例 #23
0
ファイル: vmCode.c プロジェクト: tctsigemura/C--
// genLogExpr を使用して論理値を求める
static void genLOpExpr(int node, struct Expr* c) {
  int op   = syGetType(node);                     // 論理和か論理積か
  int lab0 = newLab();                            // 論理式の最後
  struct Label *lab1 = newLabel(0);               // 途中で結果が出たとき
  struct Label *lab2 = newLabel(1);               // 途中で結果が出たとき

  int rNode = genLogExpr(node, c, 1, lab2, lab1); // コード生成
  genExpr(rNode, c);                              // 最後の項の論理値を求める

  if (op==SyOR)                                   // || なら
    vmBoolOR(lab2->no, lab1->no, lab0);           //   BOOLOR マクロ命令を生成
  else                                            // && なら
    vmBoolAND(lab2->no, lab1->no, lab0);          //   BOOLAND マクロ命令を生成

  free(lab1);
  free(lab2);
}
コード例 #24
0
void Do::gen(int b, int a) 
{
	after = a;
	int label = newLabel();
	stmt->gen(b,label);
	emitLabel(label);
	test->jumping(b,0);
}
コード例 #25
0
/* analisa e traduz um comando DO*/
void doDo()
{
	int l1, l2;

	match('d');
	l1 = newLabel();
	l2 = newLabel();
	expression();
	emit("MOV CX, AX");
	postLabel(l1);
	emit("PUSH CX");
	block(l2);
	emit("POP CX");
	emit("LOOP L%d", l1);
	emit("PUSH CX");
	postLabel(l2);
	emit("POP CX");
}
コード例 #26
0
ファイル: emit.cpp プロジェクト: goTJ/tj
void emitCOND(char op, GeneralType a, GeneralType b, GeneralType c) // {{{
{
	if(!isNoError)
		return;
        const char *prefixV=(b.t==INT)?"I":"F";
        const char *prefixF=(b.t==INT)?"":"F";
        const char *zero=(a.t==INT)?"0":"0.0";
        int labelTrue=newLabel(); // true
        int labelEnd=newLabel(); // end

        switch(op){
                case '<':
                case '>':
                case '=':
                case 'G':
                case 'L':
                case 'N':
                        GeneralType constGt;
                        constGt.t = INT;
                        constGt.s = _CONST;

                        fprintf(cmmOut, "/* a = b %c c */\n", op);
                        loadAddr(b, 1);
                        loadAddr(c, 2);
                        fprintf(cmmOut, "%s__1 = %s__1 - %s__2;\n", prefixV, prefixV, prefixV);
                        if(op == 'G')
                                fprintf(cmmOut, "if ( %s__1 >= %s ) ", prefixV, zero);
                        else if(op == 'L')
                                fprintf(cmmOut, "if ( %s__1 <= %s ) ", prefixV, zero);
                        else if(op == 'N' || op == '=')
                                fprintf(cmmOut, "if ( %s__1 == %s ) ", prefixV, zero);
                        else
                                fprintf(cmmOut, "if ( %s__1 %c %s ) ", prefixV, op, zero);
                        emitJUMP(labelTrue);
                        constGt.ival = (op=='N')?1:0;
                        emitASSIGN('=', a, constGt);
                        emitJUMP(labelEnd);
                        emitLABEL(labelTrue);
                        constGt.ival = (op=='N')?0:1;
                        emitASSIGN('=', a, constGt);
                        emitLABEL(labelEnd);
                        break;
        }
} // }}}
コード例 #27
0
/* analisa e traduz um comando IF */
void doIf(int exitLabel)
{
	int l1, l2;

	match('i');
	condition();
	l1 = newLabel();
	l2 = l1;
	emit("JZ L%d", l1);
	block(exitLabel);
	if (look == 'l') {
		match('l');
		l2 = newLabel();
		emit("JMP L%d", l2);
		postLabel(l1);
		block(exitLabel); //passa o label para realizar o break
	}
	match('e');
	postLabel(l2);
}
コード例 #28
0
ファイル: parser.cpp プロジェクト: paddatrapper/compiler
 void Parser::doIf(std::string l)
 {
     input.match('i');
     std::string l1 = newLabel();
     std::string l2 = l1;
     boolExpression();
     output.emitLine("BEQ " + l1);
     input.match('{');
     block(l);
     input.match('}');
     if (input.getChar() == 'e') {
         input.match('e');
         l2 = newLabel();
         output.emitLine("BRA " + l2);
         output.postLabel(l1);
         input.match('{');
         block(l);
         input.match('}');
     }
     output.postLabel(l2);
 }
コード例 #29
0
void StoreLayer::createBg(){
    
    newSprite("setting_bg", G_SWIDTH/2, G_SHEIGHT/2, this, 0, RATIO_XY);
    newLabel("Store", "Arial MT", 50, G_SWIDTH/2, getY(220), this, 0, RATIO_XY);

    lbEnglish = newLabel("English", "Arial MT", 30, G_SWIDTH/2 - getX(180), getY(320), this, 0, RATIO_XY);
    lbSpanish = newLabel("Spanish", "Arial MT", 30, G_SWIDTH/2 - getX(180), getY(400), this, 0, RATIO_XY);

    lbEnglish->setAnchorPoint(ccp(0, 0.5f));
    lbSpanish->setAnchorPoint(ccp(0, 0.5f));
    
    btnEnglish = newButton("select", G_SWIDTH/2 + getX(120), getY(320), this, menu_selector(StoreLayer::onClose), true, RATIO_XY);
    btnEnglish->setScale(0.8*G_SCALEX);
    btnSpanish = newButton("buy", G_SWIDTH/2 + getX(120), getY(400), this, menu_selector(StoreLayer::onClose), true, RATIO_XY);
    btnSpanish->setScale(0.8*G_SCALEX);
    btnClose = newButton("close", getX(800), getY(180), this, menu_selector(StoreLayer::onClose), true, RATIO_XY);
    
    CCMenu *menu = CCMenu::create(btnClose,btnEnglish,btnSpanish, NULL);
    menu->setPosition(ccp(0, 0));
    this->addChild(menu, 0);
}
コード例 #30
0
ファイル: axe_engine.c プロジェクト: gianluca-venturini/acse
/* reserve a new label identifier */
t_axe_label * assignNewLabel(t_program_infos *program)
{
   t_axe_label * reserved_label;

   /* reserve a new label */
   reserved_label = newLabel(program);
   if (reserved_label == NULL)
      return NULL;

   /* fix the label */
   return assignLabel(program, reserved_label);
}