PolycodeProjectBrowser::PolycodeProjectBrowser() : UIElement() {

	headerBg = new ScreenShape(ScreenShape::SHAPE_RECT,10,10);
	addChild(headerBg);
	headerBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	headerBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
	
	ScreenLabel *label = new ScreenLabel("PROJECT BROWSER", 18, "section", Label::ANTIALIAS_FULL);
	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
	
	addChild(label);
	label->setPosition(10, 3);


	treeContainer = new UITreeContainer("boxIcon.png", L"Projects", 200, 555);
	treeContainer->getRootNode()->toggleCollapsed();
	treeContainer->getRootNode()->addEventListener(this, UITreeEvent::SELECTED_EVENT);
	treeContainer->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	treeContainer->setPosition(0, 30);
	
	BrowserUserData *data = new BrowserUserData();
	data->type = 0;
	data->parentProject = NULL;
	treeContainer->getRootNode()->setUserData((void*) data)	;
	
	addChild(treeContainer);		
	selectedData = NULL;
}
Exemple #2
0
void UITextInput::checkBufferLines() {

	if(neededBufferLines < currentBufferLines) 
		return;
	
	int aaMode = Label::ANTIALIAS_FULL;
	if(useStrongHinting) {
		aaMode = Label::ANTIALIAS_STRONG;
	}

	for(int i=0; i < neededBufferLines - currentBufferLines; i++) {
		if(multiLine) {
			ScreenLabel *newNumberLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
			newNumberLine->color = lineNumberColor;
			lineNumberAnchor->addChild(newNumberLine);
			numberLines.push_back(newNumberLine);		
			
			if(!lineNumbersEnabled) {
				newNumberLine->visible = false;
			}
		}
	
		ScreenLabel *newLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
		newLine->color = textColor;
		lineHeight = newLine->getHeight();
		linesContainer->addChild(newLine);
		bufferLines.push_back(newLine);
	}
	
	currentBufferLines = neededBufferLines;
}
Exemple #3
0
void UITextInput::dragSelectionTo(Number x, Number y) {
	x -= padding;
	y -= padding;
	int lineOffset = y  / (lineHeight+lineSpacing);
	if(lineOffset > lines.size()-1)
		lineOffset = lines.size()-1;

	ScreenLabel *selectToLine = lines[lineOffset];
	
	int len = selectToLine->getText().length();
	Number slen;
	int caretPosition = selectToLine->getLabel()->getTextWidth(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), selectToLine->getText().substr(0,len), fontSize);
	for(int i=0; i < len; i++) {
		slen = selectToLine->getLabel()->getTextWidth(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), selectToLine->getText().substr(0,i), fontSize);
		if(slen > x) {
			caretPosition = i;
			break;
		}
	}
	if(x > slen)
		caretPosition = len;
	
	if(caretPosition < 0)
		caretPosition = 0;

	setSelection(this->lineOffset, lineOffset, this->caretPosition, caretPosition);
}
ConsoleWindow::ConsoleWindow() : UIElement() {


	labelBg = new ScreenShape(ScreenShape::SHAPE_RECT, 20,30);
	labelBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	labelBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
	addChild(labelBg);
	
	ScreenLabel *label = new ScreenLabel("CONSOLE", 18, "section");
	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
	addChild(label);
	label->setPosition(35,3);

	debugTextInput = new UITextInput(true, 100, 100);
	consoleTextInput = new UITextInput(false, 100, 100);
	addChild(consoleTextInput);	
	addChild(debugTextInput);	
	
	clearButton = new UIImageButton("Images/clear_buffer_icon.png");
	addChild(clearButton);
	
	hideConsoleButton = new UIImageButton("Images/console_hide_button.png");
	addChild(hideConsoleButton);
	hideConsoleButton->setPosition(7,5);
	
}
Exemple #5
0
int UITextInput::insertLine(bool after) {
	
	numLines++;	
	
	int aaMode = Label::ANTIALIAS_FULL;
	if(useStrongHinting) {
		aaMode = Label::ANTIALIAS_STRONG;
	}

	if(multiLine) {
		ScreenLabel *newNumberLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
		newNumberLine->color = lineNumberColor;
		lineNumberAnchor->addChild(newNumberLine);
		numberLines.push_back(newNumberLine);		
		
		if(!lineNumbersEnabled) {
			newNumberLine->visible = false;
		}
	}
	
	ScreenLabel *newLine = new ScreenLabel(L"", fontSize, fontName, aaMode);
	newLine->color = textColor;
	lineHeight = newLine->getHeight();
	linesContainer->addChild(newLine);	
	
	if(after) {	
		
		if(currentLine) {
			String ctext = currentLine->getText();
			String text2 = ctext.substr(caretPosition, ctext.length()-caretPosition);
			ctext = ctext.substr(0,caretPosition);
			currentLine->setText(ctext);
			newLine->setText(text2);
			caretPosition=0;
		}
		
		currentLine = newLine;		
		
		vector<ScreenLabel*>::iterator it;
		it = lines.begin();
		
		for(int i=0; i < lineOffset+1; i++) {
			it++;
		}
		
		lineOffset = lineOffset + 1;	
		lines.insert(it,newLine);
		
		renumberLines();
		restructLines();
	} else {	
		// do we even need that? I don't think so.
	}	
	
	changedText();
	return 1;	
}
ExportProjectWindow::ExportProjectWindow() : UIWindow(L"Publish Project", 400, 300) {

    closeOnEscape = true;

    ScreenLabel *label = new ScreenLabel("LOCATION", 22, "section", Label::ANTIALIAS_FULL);
    addChild(label);
    label->color.a = 0.4;
    label->setPosition(padding, 50);

    projectLocationInput = new UITextInput(false, 420-(padding*2.0), 12);
    addChild(projectLocationInput);
    projectLocationInput->setPosition(padding, 80);


    locationSelectButton = new UIButton(L"Choose...", 100);
    locationSelectButton->addEventListener(this, UIEvent::CLICK_EVENT);
    addChild(locationSelectButton);
    locationSelectButton->setPosition(padding, projectLocationInput->getPosition().y+projectLocationInput->getHeight()+5);


    label = new ScreenLabel("PLATFORMS", 22, "section", Label::ANTIALIAS_FULL);
    addChild(label);
    label->color.a = 0.4;
    label->setPosition(padding, 150);

    macCheckBox = new UICheckBox("MacOS X (Intel 64-bit)", false);
    addChild(macCheckBox);
    macCheckBox->setPosition(padding, 185);

    winCheckBox = new UICheckBox("Microsoft Windows (32-bit)", false);
    addChild(winCheckBox);
    winCheckBox->setPosition(padding, 205);

    linCheckBox = new UICheckBox("Linux (Intel 32-bit)", false);
    addChild(linCheckBox);
    linCheckBox->setPosition(padding, 225);


    cancelButton = new UIButton(L"Cancel", 100);
    cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
    addChild(cancelButton);
    cancelButton->setPosition(400-75-padding-100-10, 300-15);


    okButton = new UIButton(L"Publish", 100);
    okButton->addEventListener(this, UIEvent::CLICK_EVENT);
    addChild(okButton);
    okButton->setPosition(400-75-padding, 300-15);

    projectLocationInput->setText(CoreServices::getInstance()->getCore()->getUserHomeDirectory()+"/Documents/Polycode");

}
Exemple #7
0
void UITextInput::deleteSelection() {
	if(selectionTop == selectionBottom) {
		String ctext = lines[selectionTop]->getText();
		String newText = ctext.substr(0, selectionL);
		int rside = selectionR;
		if(rside > ctext.length()-1)
			rside = ctext.length() - 1;
		newText += ctext.substr(rside,ctext.length() - selectionR); 
		lines[selectionTop]->setText(newText);
	} else {
		
		String ctext = lines[selectionTop]->getText();
		String newText = ctext.substr(0, selectionL);
		lines[selectionTop]->setText(newText);

		ScreenLabel *bottomLine = lines[selectionBottom];
		
		// if whole lines to remove, do it
		vector<ScreenLabel*> linesToRemove;
		if(selectionBottom > selectionTop + 1) {
			for(int i=selectionTop+1; i < selectionBottom; i++) {
				linesToRemove.push_back(lines[i]);
			}
			for(int i=0; i < linesToRemove.size(); i++) {
				removeLine(linesToRemove[i]);
			}
		}
		
		ctext = bottomLine->getText();
		
		int rside = selectionR;
		if(rside > ctext.length()-1)
			rside = ctext.length() - 1;
		newText = ctext.substr(rside,ctext.length() - selectionR); 
		
				
		lineOffset = selectionTop;
		selectLineFromOffset();
		caretPosition = currentLine->getText().length();
		updateCaretPosition();
		currentLine->setText(currentLine->getText() + newText);	
		removeLine(bottomLine);				
		
		
	}
	clearSelection();
	caretPosition = selectionL;
	updateCaretPosition();
	changedText();
}
BackTraceWindow::BackTraceWindow() : UIElement() {

	Config *conf = CoreServices::getInstance()->getConfig();	
	String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
	int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");		

	labelBg = new ScreenShape(ScreenShape::SHAPE_RECT, 20,30);
	labelBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	labelBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
	addChild(labelBg);
	
	ScreenLabel *label = new ScreenLabel("CRASH STACK", 18, "section");
	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
	addChild(label);
	label->setPosition(5,3);
	
}	
Exemple #9
0
void UITextInput::insertText(String text) {
	vector<String> strings = text.split("\n");
	int numLines = lines.size();
	for(int i=0; i < strings.size(); i++) {
		if(i < numLines) {
			lines[i]->setText(strings[i]);
		} else {
			numLines++;		
			ScreenLabel *newLine = new ScreenLabel(L"", fontSize, fontName, Label::ANTIALIAS_FULL);
			newLine->setColor(0,0,0,1);
			addChild(newLine);			
			lines.push_back(newLine);
			newLine->setText(strings[i]);
		}
	}
	restructLines();	
}
int LabelMgr::labelScreen(const QString& text,
                          int x,
                          int y,
                          bool visible,
                          float fontSize,
                          const QString& fontColor)
{
	QFont font;
	font.setPixelSize(fontSize);
	ScreenLabel* l = new ScreenLabel(text, x, y, font, StelUtils::htmlColorToVec3f(fontColor));
	if (l==NULL)
		return -1;

	if (visible)
		l->setFlagShow(true);

	allLabels.append(l);
	return allLabels.size()-1;
}
Exemple #11
0
SettingsWindow::SettingsWindow() : UIWindow(L"Settings", SETTINGS_WINDOW_WIDTH, SETTINGS_WINDOW_HEIGHT) {

	closeOnEscape = true;


	ScreenLabel *label = new ScreenLabel("MISC", 22, "section", Label::ANTIALIAS_FULL);
	addChild(label);
	label->color.a = 0.4;
	label->setPosition(padding, 50);


	useExternalTextEditorBox = new UICheckBox("Use external text editor", false);
	addChild(useExternalTextEditorBox); 
	useExternalTextEditorBox->setPosition(padding, 85);

	#define BUTTON_WIDTH 80
	#define BUTTON_PADDING 10
	#define EDITOR_BROWSE_POS 110
	#define TEXTBOX_HEIGHT 12

	externalTextEditorCommand = new UITextInput(false, SETTINGS_WINDOW_WIDTH - (padding*2 + BUTTON_WIDTH + BUTTON_PADDING/2), TEXTBOX_HEIGHT);
	addChild(externalTextEditorCommand);
	externalTextEditorCommand->setPosition(padding, EDITOR_BROWSE_POS);

	browseButton = new UIButton("Browse...", BUTTON_WIDTH);
	browseButton->addEventListener(this, UIEvent::CLICK_EVENT);
	addChild(browseButton);
	browseButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH/2), EDITOR_BROWSE_POS);
	

	cancelButton = new UIButton("Cancel", BUTTON_WIDTH);
	cancelButton->addEventListener(this, UIEvent::CLICK_EVENT);
	addChild(cancelButton);
	cancelButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH*1.5 + BUTTON_PADDING), SETTINGS_WINDOW_HEIGHT - padding);

	okButton = new UIButton("OK", BUTTON_WIDTH);
	okButton->addEventListener(this, UIEvent::CLICK_EVENT);
	addChild(okButton);
	okButton->setPosition(SETTINGS_WINDOW_WIDTH - (2*padding + BUTTON_WIDTH/2), SETTINGS_WINDOW_HEIGHT - padding);
}
Exemple #12
0
void UITextInput::dragSelectionTo(Number x, Number y) {
	x -= padding * 2.0;
	y -= padding;
	int lineOffset = y  / (lineHeight+lineSpacing);
	if(lineOffset > lines.size()-1)
		lineOffset = lines.size()-1;
	
	ScreenLabel *selectToLine = lines[lineOffset];
	
	int len = selectToLine->getText().length();
	Number slen;
	int caretPosition = selectToLine->getLabel()->getTextWidthForString(selectToLine->getText().substr(0,len));
	for(int i=0; i < len; i++) {
		slen = selectToLine->getLabel()->getTextWidthForString(selectToLine->getText().substr(0,i));
		if(slen > x) {
			caretPosition = i;
			break;
		}
	}
	if(x > slen)
		caretPosition = len;
	
//	if(multiLine)
//		caretPosition++;
		
	if(caretPosition < 0)
		caretPosition = 0;		

	setSelection(this->lineOffset, lineOffset, this->caretPosition, caretPosition);
}
FindBar::FindBar() : UIElement() {
	barBg = new ScreenShape(ScreenShape::SHAPE_RECT, 30,30);
	barBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	barBg->setColorInt(255, 222, 0, 255);
	addChild(barBg);
	this->height = 30;
	
	ScreenLabel *findLabel = new ScreenLabel("Find:", 16);
	addChild(findLabel);
	findLabel->setColor(0.0, 0.0, 0.0, 0.3);
	findLabel->setPosition(10,4);

	ScreenLabel *replaceLabel = new ScreenLabel("Replace:", 16);
	addChild(replaceLabel);
	replaceLabel->setColor(0.0, 0.0, 0.0, 0.3);
	replaceLabel->setPosition(200,4);

	processInputEvents = true;
	
	findInput = new UITextInput(false, 120, 12);
	addChild(findInput);
	findInput->setPosition(60, 4);

	replaceInput = new UITextInput(false, 120, 12);
	addChild(replaceInput);
	replaceInput->setPosition(280, 4);
	
	replaceAllButton = new UIImageButton("Images/replaceAll.png");
	addChild(replaceAllButton);
	replaceAllButton->setPosition(420, 5);
	
	closeButton = new UIImageButton("Images/barClose.png");
	addChild(closeButton);
}
Exemple #14
0
int UITextInput::insertLine(bool after) {
	
	numLines++;	
	
	ScreenLabel *newLine = new ScreenLabel(L"", fontSize, fontName, Label::ANTIALIAS_FULL);
	newLine->setColor(0,0,0,1);
	lineHeight = newLine->getHeight();
	addChild(newLine);
	
	if(after) {	
		
		if(currentLine) {
			String ctext = currentLine->getText();
			String text2 = ctext.substr(caretPosition, ctext.length()-caretPosition);
			ctext = ctext.substr(0,caretPosition);
			currentLine->setText(ctext);
			newLine->setText(text2);
			caretPosition=0;
		}
		
		currentLine = newLine;		
		
		vector<ScreenLabel*>::iterator it;
		it = lines.begin();
		
		for(int i=0; i < lineOffset+1; i++) {
			it++;
		}
		
		lineOffset = lineOffset + 1;	
		lines.insert(it,newLine);
		
		restructLines();
	} else {	
		// do we even need that? I don't think so.
	}	
	
	dispatchEvent(new UIEvent(), UIEvent::CHANGE_EVENT);
	return 1;	
}
Exemple #15
0
PolycodeFrame::PolycodeFrame() : ScreenEntity() {

    globalFrame = this;
    processInputEvents = true;
    willHideModal = false;
    showingConsole = true;
    modalChild = NULL;

    welcomeEntity = new ScreenEntity();
    welcomeEntity->processInputEvents = true;
    addChild(welcomeEntity);
    welcomeImage = new ScreenImage("Images/welcome.png");
    welcomeEntity->addChild(welcomeImage);
    welcomeEntity->snapToPixels = true;

    newProjectButton = new UIButton("Create A New Project!", 220);
    newProjectButton->setPosition(230,80);
    newProjectButton->addEventListener(this, UIEvent::CLICK_EVENT);

    examplesButton = new UIButton("Browse Example Projects!", 220);
    examplesButton->setPosition(460,80);
    examplesButton->addEventListener(this, UIEvent::CLICK_EVENT);

    welcomeEntity->addChild(newProjectButton);
    welcomeEntity->addChild(examplesButton);

    mainSizer = new UIHSizer(100,100,200,true);
    mainSizer->setPosition(0, 45);
    addChild(mainSizer);

    consoleSize = 200;

    consoleSizer = new UIVSizer(100,100,200, false);
    mainSizer->addRightChild(consoleSizer);

    projectBrowser = new PolycodeProjectBrowser();
    mainSizer->addLeftChild(projectBrowser);

    editorHolder = new EditorHolder();
    consoleSizer->addTopChild(editorHolder);

    console = new PolycodeConsole();
    consoleSizer->addBottomChild(console);

    projectBrowser->treeContainer->getRootNode()->addEventListener(this, UITreeEvent::DRAG_START_EVENT);

    topBarBg = new ScreenShape(ScreenShape::SHAPE_RECT, 2,2);
    topBarBg->setColorInt(21, 18, 17, 255);
    topBarBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
    topBarBg->processInputEvents = true;
    topBarBg->blockMouseInput = true;
    addChild(topBarBg);

    logo = new ScreenImage("Images/barlogo.png");
    addChild(logo);


    playButton = new UIImageButton("Images/play_button.png");
    addChild(playButton);
    playButton->setPosition(10,4);

    stopButton = new UIImageButton("Images/stop_button.png");
    addChild(stopButton);
    stopButton->setPosition(10,4);

    currentProjectTitle = new ScreenLabel("", 32, "section");
    addChild(currentProjectTitle);
    currentProjectTitle->color.a = 0.4;
    currentProjectTitle->setPosition(70, 0);

    currentFileSelector = new UIComboBox(globalMenu, 300);
    currentFileSelector->addEventListener(this, UIEvent::CHANGE_EVENT);

    addChild(currentFileSelector);


    resizer = new ScreenImage("Images/corner_resize.png");
    addChild(resizer);
    resizer->setColor(0,0,0,0.4);

    modalBlocker = new ScreenShape(ScreenShape::SHAPE_RECT, 10,10);
    modalBlocker->setColor(0,0,0,0.4);
    modalBlocker->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
    modalBlocker->enabled = false;
    modalBlocker->blockMouseInput = true;
    modalBlocker->processInputEvents = true;
    addChild(modalBlocker);

    assetBrowser = new AssetBrowser();
    assetBrowser->visible = false;

    newProjectWindow = new NewProjectWindow();
    newProjectWindow->visible = false;

    exampleBrowserWindow = new ExampleBrowserWindow();
    exampleBrowserWindow->visible = false;

    newFileWindow = new NewFileWindow();
    newFileWindow->visible = false;

    exportProjectWindow = new ExportProjectWindow();
    exportProjectWindow->visible = false;

    textInputPopup = new TextInputPopup();
    textInputPopup->visible = false;

    yesNoPopup = new YesNoPopup();
    yesNoPopup->visible = false;

    yesNoCancelPopup = new YesNoCancelPopup();
    yesNoCancelPopup->visible = false;


    aboutWindow = new UIWindow("", 800, 440);
    aboutWindow->closeOnEscape = true;
    ScreenImage *aboutImage = new ScreenImage("Images/about.png");
    aboutWindow->addChild(aboutImage);
    aboutImage->setPosition(20, 40);
    aboutWindow->visible = false;
    aboutOKButton = new UIButton("OK", 100);
    aboutWindow->addChild(aboutOKButton);
    aboutOKButton->setPosition(700, 420);
    aboutOKButton->addEventListener(this, UIEvent::CLICK_EVENT);

    ScreenLabel *versionLabel = new ScreenLabel("version 0.8.2", 12, "mono");
    aboutWindow->addChild(versionLabel);
    versionLabel->setPosition(20, 430);
    versionLabel->color.a = 0.4;

    isDragging  = false;
    dragLabel = new ScreenLabel("NONE", 11, "sans");
    dragLabel->setPosition(0,-15);

    dragEntity = new ScreenEntity();
    dragEntity->addChild(dragLabel);
    addChild(dragEntity);
    dragEntity->visible = false;


    CoreServices::getInstance()->getCore()->getInput()->addEventListener(this, InputEvent::EVENT_MOUSEUP);
    CoreServices::getInstance()->getCore()->getInput()->addEventListener(this, InputEvent::EVENT_MOUSEMOVE);

    curveEditor = new CurveEditor();
    addChild(curveEditor);
    curveEditor->setPosition(200,100);
    curveEditor->visible = false;
    curveEditor->enabled = false;


    globalColorPicker = new UIColorPicker();
    globalColorPicker->setPosition(300,300);
    addChild(globalColorPicker);

    modalRoot = new UIElement();
    addChild(modalRoot);

    fileDialogBlocker = new ScreenShape(ScreenShape::SHAPE_RECT, 100, 100);
    fileDialogBlocker->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
    addChild(fileDialogBlocker);
    fileDialogBlocker->setColor(0.0, 0.0, 0.0, 0.5);
    fileDialogBlocker->processInputEvents = true;
    fileDialogBlocker->blockMouseInput = true;
    fileDialogBlocker->visible = false;
    fileDialogBlocker->enabled = false;

    fileBrowserRoot = new UIElement();
    addChild(fileBrowserRoot);

    fileDialog = NULL;
}
PolycodeSpriteEditor::PolycodeSpriteEditor() : PolycodeEditor(true){
	headerBg = new ScreenShape(ScreenShape::SHAPE_RECT,10,10);
	addChild(headerBg);
	headerBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	headerBg->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderBgColor"));
	
	initialLoad = false;

	propList = new PropList("SPRITE EDITOR");
	addChild(propList);
	propList->setPosition(0, 0);

	PropSheet *baseProps = new PropSheet("IMAGE OPTIONS", "");
	propList->addPropSheet(baseProps);
	
	textureProp = new TextureProp("Base image");
	baseProps->addProp(textureProp);

	widthProp = new NumberProp("Frame width");
	widthProp->set(32);
	baseProps->addProp(widthProp);	

	heightProp = new NumberProp("Frame height");
	heightProp->set(32);
	baseProps->addProp(heightProp);	
	
	widthProp->addEventListener(this, Event::CHANGE_EVENT);	
	textureProp->addEventListener(this, Event::CHANGE_EVENT);
	heightProp->addEventListener(this, Event::CHANGE_EVENT);		
			
	baseProps->propHeight = 180;
	
	ScreenLabel *label = new ScreenLabel("PREVIEW", 18, "section", Label::ANTIALIAS_FULL);
	label->color.setColorHexFromString(CoreServices::getInstance()->getConfig()->getStringValue("Polycode", "uiHeaderFontColor"));
	addChild(label);
	label->setPosition(390, 36);
			
				
	PropSheet *animationProps = new PropSheet("ANIMATIONS", "");
	propList->addPropSheet(animationProps);

	ScreenLabel *animHelpLabel = new ScreenLabel("Comma separated frames, ranges or repeats (e.g. 1,2,3-7,8x5)", 11);
	animHelpLabel->color.a = 0.4;
	animationProps->addChild(animHelpLabel);
	animHelpLabel->setPosition(5, 40);


	animationProps->propHeight = 230;
	
	animationsAnchor = new UIElement();
	animationProps->contents->addChild(animationsAnchor);
	
	addAnimationButton = new UIButton("Add Animation", 100);
	animationsAnchor->addChild(addAnimationButton);
	addAnimationButton->addEventListener(this, UIEvent::CLICK_EVENT);
	
	propList->updateProps();
	
	zoomBox = new UIComboBox(globalMenu, 100);
	addChild(zoomBox);
	zoomBox->setPosition(490, 37);
	zoomBox->addEventListener(this, UIEvent::CHANGE_EVENT);
	
	zoomBox->addComboItem("No Zoom");
	zoomBox->addComboItem("Zoom 2x");
	zoomBox->addComboItem("Zoom 4x");
	zoomBox->addComboItem("Zoom 8x");
	zoomBox->addComboItem("Zoom 16x");
}
Exemple #17
0
void UITextInput::setSelection(int lineStart, int lineEnd, int colStart, int colEnd) {

	if(lineStart == lineOffset) {
		selectionLine = lineEnd;
	} else {
		selectionLine = lineStart;	
	}

	if(colStart == caretPosition) {
		selectionCaretPosition = colEnd;
	} else {
		selectionCaretPosition = colStart;
	}

	
//	Logger::log("SET lineStart:%d lineEnd:%d colStart:%d colEnd:%d\n", lineStart, lineEnd, colStart, colEnd);
	
	if(lineStart > lineEnd) {
		int tmp = lineStart;
		lineStart = lineEnd;
		lineEnd = tmp;
		
		tmp = colStart;
		colStart = colEnd;
		colEnd = tmp;		
	}	
	
	if(colStart > colEnd && lineStart == lineEnd) {
		int tmp = colStart;
		colStart = colEnd;
		colEnd = tmp;
	}
	
	clearSelection();
	
	if(lineStart > lines.size()-1)
		return;	
	
	ScreenLabel *topLine = lines[lineStart];	
	
	if(colStart+1 > topLine->getText().length())
		return;
	
	Number fColEnd  = colEnd;
	
	if(colEnd > topLine->getText().length() || lineStart != lineEnd)
		fColEnd = topLine->getText().length();

	Number topSize, topHeight, topX;
	
	selectorRectTop->visible = true;	
	topSize = topLine->getLabel()->getTextWidth(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), topLine->getText().substr(colStart,fColEnd-colStart), fontSize) - 4; 
	topHeight = lineHeight+lineSpacing;
	if(colStart > 0) {
		topX = topLine->getLabel()->getTextWidth(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), topLine->getText().substr(0,colStart-1), fontSize); ;
	} else {
		topX = 0;
	}

	selectorRectTop->setScale(topSize, topHeight);
	selectorRectTop->setPosition(topX + padding + (topSize/2.0)+ 1, padding + (lineStart * (lineHeight+lineSpacing)) + (topHeight/2.0));
	
	if(lineEnd > lineStart && lineEnd < lines.size()) {
		ScreenLabel *bottomLine = lines[lineEnd];	
		selectorRectBottom->visible = true;		
		Number bottomSize = bottomLine->getLabel()->getTextWidth(CoreServices::getInstance()->getFontManager()->getFontByName(fontName), bottomLine->getText().substr(0,colEnd), fontSize) - 4; 
		Number bottomHeight = lineHeight+lineSpacing;
		selectorRectBottom->setScale(bottomSize, bottomHeight);
		selectorRectBottom->setPosition(padding + (bottomSize/2.0) + 1, padding + (lineEnd * (lineHeight+lineSpacing)) + (bottomHeight/2.0));
		
		if(lineEnd != lineStart+1) {
			// need filler
			selectorRectMiddle->visible = true;		
			Number midSize = this->width-padding;
			Number midHeight = 0;			
			for(int i=lineStart+1; i < lineEnd;i++) {
				midHeight += lineHeight+lineSpacing;
			}
			selectorRectMiddle->setScale(midSize, midHeight);
			selectorRectMiddle->setPosition(padding + (midSize/2.0), padding + ((lineStart+1) * (lineHeight+lineSpacing)) + (midHeight/2.0));										
			
		}
		
	}
	hasSelection = true;
	
	selectionTop = lineStart;
	selectionBottom = lineEnd;
	selectionL = colStart;
	selectionR = colEnd;	 		
}
Exemple #18
0
void UITextInput::setSelection(int lineStart, int lineEnd, int colStart, int colEnd) {

	if(lineStart == lineEnd && colStart == colEnd) {
		clearSelection();
		return;
	}

	if(lineStart == lineOffset) {
		selectionLine = lineEnd;
	} else {
		selectionLine = lineStart;	
	}

	if(colStart == caretPosition) {
		selectionCaretPosition = colEnd;
	} else {
		selectionCaretPosition = colStart;
	}
	
//	printf("SET lineStart:%d lineEnd:%d colStart:%d colEnd:%d\n", lineStart, lineEnd, colStart, colEnd);
	
	if(lineStart > lineEnd) {
		int tmp = lineStart;
		lineStart = lineEnd;
		lineEnd = tmp;
		
		tmp = colStart;
		colStart = colEnd;
		colEnd = tmp;		
	}	
	
	if(colStart > colEnd && lineStart == lineEnd) {
		int tmp = colStart;
		colStart = colEnd;
		colEnd = tmp;
	}
	
	clearSelection();	

	
	if(lineStart > lines.size()-1)
		return;	

	ScreenLabel *topLine = lines[lineStart];	
	
	if(colStart+1 > topLine->getText().length()) {
		colStart = topLine->getText().length();
	}
		
	Number fColEnd  = colEnd;
	
	if(colEnd > topLine->getText().length() || lineStart != lineEnd)
		fColEnd = topLine->getText().length();

	Number topSize, topHeight, topX;
	
	selectorRectTop->visible = true;	
	topSize = topLine->getLabel()->getTextWidthForString(topLine->getText().substr(colStart,fColEnd-colStart)) ; 
	topHeight = lineHeight+lineSpacing;
	if(colStart >= 0) {
		topX = topLine->getLabel()->getTextWidthForString(topLine->getText().substr(0,colStart)) + 2;
	} else {
		topX = 0;
	}

	selectorRectTop->setScale(topSize, topHeight);
	selectorRectTop->setPosition(decoratorOffset + topX + padding + (topSize/2.0), padding + (lineStart * (lineHeight+lineSpacing)) + (topHeight/2.0));
	
	if(lineEnd > lineStart && lineEnd < lines.size()) {
		ScreenLabel *bottomLine = lines[lineEnd];	
		selectorRectBottom->visible = true;		
		Number bottomSize = bottomLine->getLabel()->getTextWidthForString(bottomLine->getText().substr(0,colEnd)) ; 
		if(bottomSize < 0)
			bottomSize = this->width-padding;
		Number bottomHeight = lineHeight+lineSpacing;
		selectorRectBottom->setScale(bottomSize, bottomHeight);
		selectorRectBottom->setPosition(decoratorOffset + padding + (bottomSize/2.0), padding + (lineEnd * (lineHeight+lineSpacing)) + (bottomHeight/2.0));
		
		if(lineEnd != lineStart+1) {
			// need filler
			selectorRectMiddle->visible = true;		
			Number midSize = this->width-padding;
			Number midHeight = 0;			
			for(int i=lineStart+1; i < lineEnd;i++) {
				midHeight += lineHeight+lineSpacing;
			}
			selectorRectMiddle->setScale(midSize, midHeight);
			selectorRectMiddle->setPosition(decoratorOffset + padding + (midSize/2.0), padding + ((lineStart+1) * (lineHeight+lineSpacing)) + (midHeight/2.0));										
			
		}
		
	}
	hasSelection = true;
	
	selectionTop = lineStart;
	selectionBottom = lineEnd;
	selectionL = colStart;
	selectionR = colEnd;	 		
}
Exemple #19
0
UIColorPicker::UIColorPicker() : UIWindow(L"", 300, 240) {
	closeOnEscape = true;
	
//	topPadding
	Config *conf = CoreServices::getInstance()->getConfig();	
		
		
	String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
	int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");

	String mainBgImage = conf->getStringValue("Polycode", "uiColorPickerMainBg");		
	String mainFrameImage = conf->getStringValue("Polycode", "uiColorPickerMainFrame");
	String hueFrameImage = conf->getStringValue("Polycode", "uiColorPickerHueFrame");
	String hueSelectorImage = conf->getStringValue("Polycode", "uiColorPickerHueSelector");
	String mainSelectorImage = conf->getStringValue("Polycode", "uiColorPickerMainSelector");

	mainBg = new ScreenImage(mainBgImage);
	mainBg->setPosition(padding, topPadding+padding);
	addChild(mainBg);

	mainFrame = new ScreenImage(mainFrameImage);
	mainFrame->setPosition(padding, topPadding+padding);
	
	alphaSlider = new UIHSlider(0, 1.0, mainFrame->getWidth());
	alphaSlider->setPosition(padding, mainFrame->getHeight() + mainFrame->getPosition().y + 13);
	addChild(alphaSlider);
	alphaSlider->addEventListener(this, UIEvent::CHANGE_EVENT);
	
	mainColorRect = new ScreenShape(ScreenShape::SHAPE_RECT, mainFrame->getWidth(), mainFrame->getHeight());
	mainColorRect->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	mainColorRect->setPosition(padding+1, topPadding+padding+1);
	addChild(mainColorRect);
	addChild(mainFrame);

	hueFrame = new ScreenImage(hueFrameImage);
	hueFrame->setPosition(mainFrame->getPosition().x + mainFrame->getWidth()+10, topPadding+padding);
	addChild(hueFrame);
	
	hueSelector = new ScreenImage(hueSelectorImage);
	hueSelector->setPositionMode(ScreenEntity::POSITION_CENTER);
	hueSelector->setPosition(hueFrame->getPosition().x + (hueFrame->getWidth()/2.0), hueFrame->getPosition().y);
	addChild(hueSelector);	

	hueSelector->setDragLimits(Polycode::Rectangle(hueSelector->getPosition().x,hueSelector->getPosition().y,0,hueFrame->getHeight()));
				
	mainSelector = new ScreenImage(mainSelectorImage);
	mainSelector->setPositionMode(ScreenEntity::POSITION_CENTER);	
	mainSelector->setPosition(mainFrame->getPosition());
	addChild(mainSelector);	
	
	mainColorRect->getMesh()->useVertexColors = true;
	
	mainColorRect->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	mainColorRect->addEventListener(this, InputEvent::EVENT_MOUSEUP);
	mainColorRect->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);
	mainColorRect->processInputEvents = true;
	
	
	hueFrame->addEventListener(this, InputEvent::EVENT_MOUSEDOWN);
	hueFrame->addEventListener(this, InputEvent::EVENT_MOUSEUP);
	hueFrame->addEventListener(this, InputEvent::EVENT_MOUSEUP_OUTSIDE);
	hueFrame->processInputEvents = true;	
	
	ScreenLabel *label = new ScreenLabel(L"R:", fontSize, fontName);
	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 3);
	addChild(label);
	
	rTextInput = new UITextInput(false, 40, 12);
	rTextInput->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 30, topPadding+padding);
	addChild(rTextInput);
	rTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);

	label = new ScreenLabel(L"G:", fontSize, fontName);
	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 33);
	addChild(label);
	
	gTextInput = new UITextInput(false, 40, 12);
	gTextInput->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 30, topPadding+padding + 30);
	addChild(gTextInput);
	gTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
	
	label = new ScreenLabel(L"B:", fontSize, fontName);
	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 63);
	addChild(label);
	
	bTextInput = new UITextInput(false, 40, 12);
	bTextInput->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 30, topPadding+padding + 60);
	addChild(bTextInput);
	bTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
	
	label = new ScreenLabel(L"A:", fontSize, fontName);
	label->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 15, topPadding+padding + 93);
	addChild(label);
	
	aTextInput = new UITextInput(false, 40, 12);
	aTextInput->setPosition(hueFrame->getPosition().x+hueFrame->getWidth() + 30, topPadding+padding + 90);
	addChild(aTextInput);
	aTextInput->addEventListener(this, UIEvent::CHANGE_EVENT);
	
	setHue(0.0);
	setSaturationAndValue(0.0, 0.0);
	
	rTextInput->setNumberOnly(true);
	gTextInput->setNumberOnly(true);
	bTextInput->setNumberOnly(true);
	aTextInput->setNumberOnly(true);
	
	lastHueSelectorPosition = 0;
	
	mainSelector->setDragLimits(Polycode::Rectangle(mainColorRect->getPosition().x,mainColorRect->getPosition().y,mainColorRect->getWidth(), mainColorRect->getHeight()));
				
	colorAlpha = 1.0;
	
	visible = false;
	enabled = false;
	
}
PolycodeProjectEditor::PolycodeProjectEditor(PolycodeProjectManager *projectManager) : PolycodeEditor(true){

	this->projectManager = projectManager;


	Config *conf = CoreServices::getInstance()->getConfig();	
	String fontName = conf->getStringValue("Polycode", "uiDefaultFontName");
	int fontSize = conf->getNumericValue("Polycode", "uiDefaultFontSize");	
	Number padding = conf->getNumericValue("Polycode", "uiWindowSkinPadding");	
		

	headerBg = new ScreenShape(ScreenShape::SHAPE_RECT,10,10);
	addChild(headerBg);
	headerBg->setPositionMode(ScreenEntity::POSITION_TOPLEFT);
	headerBg->setColor(0.1, 0.1, 0.1, 1.0);
	
	ScreenLabel *label = new ScreenLabel("PROJECT SETTINGS", 22, "section", Label::ANTIALIAS_FULL);
	label->color.a = 0.4;
	addChild(label);
	label->setPosition(10, 0);



	moduleSettingsWindow = new UIElement();
	moduleSettingsWindow->setPosition(350,10);
	addChild(moduleSettingsWindow);
	
	
	Number lastYPos = 40;

	label = new ScreenLabel("PROJECT MODULES", 22, "section", Label::ANTIALIAS_FULL);
	label->color.a = 0.4;
	moduleSettingsWindow->addChild(label);
	label->setPosition(0, lastYPos);

	lastYPos += 40;
	
	String polycodeBasePath = CoreServices::getInstance()->getCore()->getDefaultWorkingDirectory();
		
	std::vector<OSFileEntry> moduleFolders = OSBasics::parseFolder(polycodeBasePath+"/Standalone/Modules", false);
	for(int i=0; i < moduleFolders.size(); i++) {
		OSFileEntry entry = moduleFolders[i];
		if(entry.type == OSFileEntry::TYPE_FOLDER) {
			UICheckBox *moduleCheckBox = new UICheckBox(entry.name, false);
			moduleCheckBox->setPosition(0, lastYPos);
			lastYPos += moduleCheckBox->getHeight() + 5;
			moduleSettingsWindow->addChild(moduleCheckBox);
			moduleCheckboxes.push_back(moduleCheckBox);
		}
	}
	
	lastYPos += 20;

	label = new ScreenLabel("PROJECT FONTS", 22, "section", Label::ANTIALIAS_FULL);
	label->color.a = 0.4;
	moduleSettingsWindow->addChild(label);
	label->setPosition(0, lastYPos);
	
	lastYPos += 30;
	
	fontEntryBase = new UIElement();
	moduleSettingsWindow->addChild(fontEntryBase);	
	fontEntryBase->setPosition(0, lastYPos);
			
	addFontButton = new UIButton("Add Font", 100);
	fontEntryBase->addChild(addFontButton);
	addFontButton->addEventListener(this, UIEvent::CLICK_EVENT);

	mainSettingsWindow = new UIElement();
	mainSettingsWindow->setPosition(0,10);
	addChild(mainSettingsWindow);
	
	ScreenLabel *label2 = new ScreenLabel(L"DEFAULT VIDEO OPTIONS", 22, "section", Label::ANTIALIAS_FULL);	
	label2->setColor(1.0, 1.0, 1.0, 0.4);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, 40);		

		
	label2 = new ScreenLabel(L"Width:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, 80);		
	
	defaultWidthInput = new UITextInput(false, 60, 12);	
	mainSettingsWindow->addChild(defaultWidthInput);
	defaultWidthInput->setPosition(label2->getPosition().x, label2->getPosition().y+18);
	defaultWidthInput->setNumberOnly(true);

	label2 = new ScreenLabel(L"Height:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding + 80, 80);		
	
	defaultHeightInput = new UITextInput(false, 60, 12);	
	mainSettingsWindow->addChild(defaultHeightInput);
	defaultHeightInput->setPosition(label2->getPosition().x, label2->getPosition().y+18);
	defaultHeightInput->setNumberOnly(true);
	
	label2 = new ScreenLabel(L"Anti-aliasing:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding + 160, 80);		
	
	aaLevelComboBox = new UIComboBox(globalMenu, 120);		
	aaLevelComboBox->addComboItem("No AA");
	aaLevelComboBox->addComboItem("2x MSAA");
	aaLevelComboBox->addComboItem("4x MSAA");
	aaLevelComboBox->addComboItem("6x MSAA");			
	aaLevelComboBox->setPosition(label2->getPosition().x, label2->getPosition().y+18);

	label2 = new ScreenLabel(L"Anisotropic filtering:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, defaultHeightInput->getPosition().y+30);		
	
	afLevelComboBox = new UIComboBox(globalMenu, 250);		
	afLevelComboBox->addComboItem("No Anisotropic Filtering");
	afLevelComboBox->addComboItem("1x Anisotropic Filtering");
	afLevelComboBox->addComboItem("2x Anisotropic Filtering");
	afLevelComboBox->addComboItem("4x Anisotropic Filtering");
	afLevelComboBox->addComboItem("8x Anisotropic Filtering");
	afLevelComboBox->addComboItem("16x Anisotropic Filtering");			
	afLevelComboBox->setPosition(label2->getPosition().x, label2->getPosition().y+18);

	label2 = new ScreenLabel(L"Framerate:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, afLevelComboBox->getPosition().y+30);		
	
	framerateInput = new UITextInput(false, 60, 12);	
	mainSettingsWindow->addChild(framerateInput);
	framerateInput->setPosition(label2->getPosition().x, label2->getPosition().y+18);
	framerateInput->setNumberOnly(true);

	vSyncCheckBox = new UICheckBox("V-Sync", false);
	vSyncCheckBox->setPosition(padding, framerateInput->getPosition().y+framerateInput->getHeight()+10);
	mainSettingsWindow->addChild(vSyncCheckBox);
	
	label2 = new ScreenLabel(L"STARTUP OPTIONS", 22, "section", Label::ANTIALIAS_FULL);	
	label2->setColor(1.0, 1.0, 1.0, 0.4);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, vSyncCheckBox->getPosition().y+vSyncCheckBox->getHeight()+20);		
	
	
	label2 = new ScreenLabel(L"Entry point file:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, vSyncCheckBox->getPosition().y+70);		
	
	entryPointInput = new UITextInput(false, 200, 12);	
	mainSettingsWindow->addChild(entryPointInput);
	entryPointInput->setPosition(label2->getPosition().x, label2->getPosition().y+18);


	mainSettingsWindow->addChild(afLevelComboBox);			
	mainSettingsWindow->addChild(aaLevelComboBox);		


	label2 = new ScreenLabel(L"Background color:", fontSize, fontName, Label::ANTIALIAS_FULL);
	mainSettingsWindow->addChild(label2);
	label2->setPosition(padding, entryPointInput->getPosition().y+entryPointInput->getHeight()+10);		


	bgColorBox = new UIColorBox(globalColorPicker, Color(1.0, 0.5, 0.0, 0.9), 30,30);
	bgColorBox->setPosition(label2->getPosition().x, label2->getPosition().y+18);
	mainSettingsWindow->addChild(bgColorBox);

}
Exemple #21
0
bool CurrentApp::Update() {
	double elapsed = core->getElapsed();

	if(player.levelPos == level->getLevelSize() - 1)
	{
		timer.stop();
		
		int timeBonusPoints = 0;
		if(timer.getTimeInSeconds() <= 106.0) timeBonusPoints += 1000;
		else if(timer.getTimeInSeconds() <= 111.0) timeBonusPoints += 500;
		else if(timer.getTimeInSeconds() <= 116.0) timeBonusPoints += 250;
		
		//winner label
		ScreenLabel * winner = new ScreenLabel("Congratulations!", 50);
		winner->setPosition(120,140);
		hud->addChild(winner);
		//time bonus
		ScreenLabel * timebonus = new ScreenLabel("Time Bonus: ", 16);
		timebonus->setPosition(220,200);
		hud->addChild(timebonus);
		ScreenLabel * timebonusDisp = new ScreenLabel(String::IntToString(timeBonusPoints), 16);
		timebonusDisp->setPosition(330,200);
		hud->addChild(timebonusDisp);		
		//coin bonus
		ScreenLabel * coinbonus = new ScreenLabel("Coin Bonus: ", 16);
		coinbonus->setPosition(220,220);
		hud->addChild(coinbonus);
		ScreenLabel * coinbonusDisp = new ScreenLabel(String::IntToString(player.coins * 100), 16);
		coinbonusDisp->setPosition(330,220);
		hud->addChild(coinbonusDisp);		
		//total score
		ScreenLabel * score = new ScreenLabel("Total Score: ", 16);
		score->setPosition(220,240);
		hud->addChild(score);
		ScreenLabel * scoreDisp = new ScreenLabel(String::IntToString(player.coins*100 + timeBonusPoints), 16);
		scoreDisp->setPosition(330,240);
		hud->addChild(scoreDisp);
				
		Vector3 winPos = level->getLevel(level->getLevelSize() - 1)->light->getPosition();
		Vector3 winDir = winPos - player.getPosition();
		winDir.Normalize();
		player.obj->Translate(winDir);
	}
	else
	{
		level->Update(elapsed, player);
		timer.Update(elapsed);
		player.Update(elapsed, keyboard);
		coins_hud->setText("Coins: "+ String::IntToString(player.coins));
		time_hud->setText("Time: " + timer.getTime());
	}
    return core->updateAndRender();
}