3H-GDC m.II **** The results are in ****

Started by
149 comments, last by Binomine 18 years, 9 months ago
I know(btw eastern = GMT-5, cental = -6), but why does the server time for me read central time not eastern, but he said eastern time by the gdnet server clocks.
Advertisement
The time on forum posts reads what it is where it thinks you are located, I'm guessing, since mine is reading ~5pm and that's the time here.

-Mezz
Regardless of whether or not it's the same as the GDNet clocks, the contest is at 3:00PM.

And is capn_midnight planning on releasing the topic soon or what?
Quote:Original post by DerAnged
I know(btw eastern = GMT-5, cental = -6), but why does the server time for me read central time not eastern, but he said eastern time by the gdnet server clocks.

So it starts at two for us then? Heh, good to know
Quote:Original post by Samith
Quote:Original post by DerAnged
I know(btw eastern = GMT-5, cental = -6), but why does the server time for me read central time not eastern, but he said eastern time by the gdnet server clocks.

So it starts at noon for us then? Heh, good to know


Where are you located?

It starts at 2 here.

Also, SDL is acceptable, what about sdl_ttf(true type fonts) and sdl_image(other image types besides bmp)?
Quote:Original post by DerAnged
Where are you located?

It starts at 2 here.

Also, SDL is acceptable, what about sdl_ttf(true type fonts) and sdl_image(other image types besides bmp)?

I know, I messed up my math :p (3-1 = ZERO!)

And if sdl_ttf is allowed, can I use my font class? I know that capn said only an input manager, rendering frame, and sound manager were allowed...but...font classes don't really affect gameplay. I'll post the code so other people can use it too (assuming it's allowed).

"Color" is just a struct with four floats, r, g, b, and a. It's the only thing defined in "util_classes.h"

font.h
#ifndef H_FONT#define H_FONT#include <string>#include <sstream>#include "glheaders.h"#include "util_classes.h"class Font{public:	Font();	~Font();	void BuildFont(const char* face, int size, int wgt);	void Newline();	float getLength(std::string str);	float getSize() { return size; }	void setPosition(const float x, const float y) { xScreen = x; yScreen = y; xMod=0.0f; }	void setColor(float r, float g, float b, float a) { color.r=r; color.g=g; color.b=b; color.a=a; }	void setColor(const Color& c) { color = c; }	void setFontFace(const char* face);	void setFontSize(float newSize);	void DeleteFont();	template<typename T> Font& operator<<(const T& t) {		oss << t;		s = oss.str();		glDisable(GL_DEPTH_TEST);		glMatrixMode(GL_PROJECTION);		glPushMatrix();		glLoadIdentity();		glOrtho(0, 800, 600, 0, -1, 1);		glMatrixMode(GL_MODELVIEW);		glPushMatrix();		glLoadIdentity();		glBindTexture(GL_TEXTURE_2D, 0);		glColor4f(color.r, color.g, color.b, color.a);		glRasterPos2f(xScreen+xMod, yScreen);		glPushAttrib(GL_LIST_BIT);			glListBase(base);			glCallLists(s.length(), GL_UNSIGNED_BYTE, s.c_str());		glPopAttrib();		glColor4f(1.0f, 1.0f, 1.0f, 1.0f);		glMatrixMode(GL_PROJECTION);		glPopMatrix();		glMatrixMode(GL_MODELVIEW);		glPopMatrix();		glEnable(GL_DEPTH_TEST);		for(unsigned int i = 0; i < s.length(); i++) {			xMod += abcf[s].abcfA; 			xMod += abcf[s].abcfB; 			xMod += abcf[s].abcfC;		}		s.clear();		oss.str("");		return *this;	}private:	std::ostringstream oss;	std::string s;	std::string fontname;	float size;	int weight;	unsigned int base;				// base for displaylist	float xScreen, yScreen;	Color color;	float xMod;						// so you know how much to add to the xScreen so you don't constantly draw	ABCFLOAT abcf[256];};#endif


font.cpp
#include "font.h"Font::Font() : fontname(""), base(0), 			   xScreen(0.0f), yScreen(0.0f), 			   color(), xMod(0.0f){}Font::~Font(){	DeleteFont();}void Font::BuildFont(const char* face, int size1, int wgt){	fontname = face;	size = size1;	weight = wgt;	HFONT font;	HDC hDC;	base = glGenLists(256);	hDC = wglGetCurrentDC();	font = CreateFont(-size*1.4f, 						  0, 						  0, 						  0, 						  weight, 						  false, 						  false, 						  false, 						  ANSI_CHARSET,						  OUT_TT_PRECIS,						  CLIP_DEFAULT_PRECIS,						  ANTIALIASED_QUALITY,						  FF_DONTCARE|DEFAULT_PITCH,						  fontname.c_str());	SelectObject(hDC, font);	wglUseFontBitmaps(hDC, 0, 256, base);	if(GetCharABCWidthsFloat(hDC, 0, 255, abcf) == 0)	{		MessageBox(0, "GetCharABCWidthsFloat() failed like no other.", "omg", MB_OK);	}}float Font::getLength(std::string str) { 	float length = 0.0f;	for(unsigned int i = 0; i < str.length(); i++)	{		length += abcf[str].abcfA;		length += abcf[str].abcfB;		length += abcf[str].abcfC;	}	return length;}void Font::Newline(){	yScreen += size;	xMod = 0.0f;}void Font::setFontSize(float newSize){	DeleteFont();	BuildFont(fontname.c_str(), newSize, weight);}void Font::setFontFace(const char *face){	DeleteFont();	BuildFont(face, size, weight);}void Font::DeleteFont(){	glDeleteLists(base, 256);}


usage
Font* font = new Font();font->BuildFont("Courier New", 16, 700);  // font name, size, and boldness (1000 is most, 0 is none)font->setColor(1.0f, 1.0f, 1.0f, 1.0f);font->setPosition(x, y) // must call this every time before hand, it resets the position*font << "Hello " << 1.6f;OUTPUT:Hello 1.6
That code is not allowed, it had to be approved by capn_midnight before mindnight EST last night.
Quote:Original post by Cypher19
That code is not allowed, it had to be approved by capn_midnight before mindnight EST last night.


EST 2 nights ago.
I can still....retype it into my project though, can't I? Otherwise I won't have any way to put text on the screen.
People, eastern time is GMT - 4 right now because of daylight savings. The GDNet server clock properly registers EST.

[Formerly "capn_midnight". See some of my projects. Find me on twitter tumblr G+ Github.]

This topic is closed to new replies.

Advertisement