Esempio n. 1
0
static int drawLineScreen(lua_State* L){
	int argc = lua_gettop(L);
	if(argc != 5) return luaL_error(L, "Argument error: geDrawLineScreen(x0, y0, x1, y1, color) must take five arguments.");

	geDrawLineScreen( luaL_checknumber(L, 1), luaL_checknumber(L, 2), luaL_checknumber(L, 3), luaL_checknumber(L, 4), *toColor(L, 5) );

	return 1;
}
Esempio n. 2
0
void _geGui_RenderInputBox(ge_GuiAreaObject* object, ge_GuiStyle* style){
	int i = -1;
	ge_GuiInputBox* box = (ge_GuiInputBox*)object->object;
	if(!box->img){
		_geGui_MakeResizableObject((ge_GuiWidget*)box, style);
	}

	if(box->gotfocus){
		geKeyboardInit();
		geKeyboardOutput(box->text, box->maxlen, box->maxlines);
	}
	if(box->focused){
		geKeyboardUpdate();
		i = geKeyboardIndex();
	}
	if(box->lostfocus){
		geKeyboardFinished();
	}

	u32 foreground = RGBA(255-R(box->back_color), 255-G(box->back_color), 255-B(box->back_color), 255);
	geBlitImage(object->absx, object->absy, box->img, 0, 0, box->width, box->height, 0);
	geFontPrintScreen(object->absx+box->textpos[0], object->absy+(box->height/2-style->font->size/2), style->font, box->text, foreground);

	if(i >= 0){
		int w, h;
		char str[2048] = "";
		strncpy(str, box->text, i);
		geFontMeasureText(style->font, str, &w, &h);
		int x = object->absx+box->textpos[0]+w;
		int y = object->absy+(box->height/2-style->font->size/2);

		if(geGetTick() - tick < 500){
			geDrawLineScreen(x, y, x, y+style->font->size, foreground);
		}else if(geGetTick() - tick >= 1000){
			tick = geGetTick();
		}
	}
}