Example #1
0
Scrn *titlescrnnew(Gfx *g){
	static Tit t = {0};
	static Scrn s = {0};

	t.title = resrcacq(imgs, "img/title.png", 0);
	if(!t.title)
		return NULL;

	Txtinfo ti = { TxtSzMedium };
	t.f = resrcacq(txt, TxtStyleMenu, &ti);
	if(!t.f)
		return NULL;

	ti.size = TxtSzSmall;
	Txt *f = resrcacq(txt, TxtStyleMenu, &ti);
	if(!f)
		return NULL;

	t.copy = txt2img(g, f, "Copyright 2011 Steve McCoy and Ethan Burns");
	if(!t.copy)
		return NULL;

	t.titlepos = (Point){
		gfxdims(g).x / 2 - imgdims(t.title).x / 2,
		0
	};

	Point sd = txtdims(t.f, "Press 'x' to Start a new game");
	t.startpos = (Point){
		gfxdims(g).x / 2 - sd.x / 2,
		t.titlepos.y + imgdims(t.title).y
	};

	Point ld = txtdims(t.f, "Press 'x' to Load the saved game");
	t.loadpos = (Point){
		gfxdims(g).x / 2 - ld.x / 2,
		t.startpos.y + sd.y + 16
	};

	Point od = txtdims(t.f, "Press 'x' for Options");
	t.optspos = (Point){
		gfxdims(g).x / 2 - od.x / 2,
		t.loadpos.y + ld.y + 16
	};

	t.copypos = (Point){
		gfxdims(g).x / 2 - imgdims(t.copy).x / 2,
		gfxdims(g).y - imgdims(t.copy).y - 8
	};

	s.mt = &titmt;
	s.data = &t;
	return &s;
}
Example #2
0
void camcenter(Gfx *g, Point p){
	Point dims = gfxdims(g);
	g->tr.x = -p.x + dims.x/2;
	g->tr.y = -p.y + dims.y/2;
}