static int screen_init(lua_State *L) { Screen *screen; int w, h, bpp; screen = check_screen(L, 1); if (SDL_Init(SDL_INIT_VIDEO) < 0) { fprintf(stderr, "Couldn't initialize SDL: %s\n", SDL_GetError()); /* TODO: Don't die, just return error */ exit(1); } lua_getfield(L, 2, "y"); h = lua_tointeger(L, -1); lua_getfield(L, 2, "x"); w = lua_tointeger(L, -1); bpp = lua_tointeger(L, 3); screen->screen = SDL_SetVideoMode( w, h, bpp, SDL_RESIZABLE); SDL_WM_SetCaption("Marauder_rl", NULL); if (!screen) { fprintf(stderr, "SDL_SetVideoMode() error: %s\n", SDL_GetError()); exit(1); } IMG_Init(IMG_INIT_PNG); init_colors(screen); init_characters(screen); screen->font = build_font(loadimg("img/font_8x12.png"), 8, 12); return 0; }
static mpdm_t kde4_drv_startup(mpdm_t a, mpdm_t ctxt) /* driver initialization */ { register_functions(); build_font(1); build_colors(); window = new MPWindow(); window->show(); return NULL; }
int SYS::window_create() { #ifdef WIN32 glClearStencil(0); glStencilFunc(GL_ALWAYS, 1, 1); glStencilOp(GL_REPLACE, GL_REPLACE, GL_REPLACE); //glMTexCoord2fSGIS = (lpMTexFUNC) wglGetProcAddress("glMultiTexCoord2fARB"); //glSelectTextureSGIS = (lpSelTexFUNC) wglGetProcAddress("glActiveTextureARB"); //if(glMTexCoord2fSGIS == NULL) // glMTexCoord2fSGIS = (lpMTexFUNC) wglGetProcAddress("glMTexCoord2fSGIS"); /*GetWindowRect(openGL,&rc); ClipCursor(&rc); ShowCursor(FALSE); GLWindow.Size(rc.left,rc.top,rc.right-rc.left,rc.bottom-rc.top); */ glColor4f(1, 1, 1, 1.0f); glViewport(0, 0, DS_SCREEN_WIDTH - 1, DS_SCREEN_HEIGHT - 1); glMatrixMode(GL_TEXTURE); glLoadIdentity(); glMatrixMode(GL_PROJECTION); glLoadIdentity(); //gluPerspective(73.74, 256.0 / 192.0, 0.005, 40.0); //gluPerspective(68.3, (float)800 / (float)600, 0.005, 40.0); //gluPerspective(73.74, (float)DS_SCREEN_WIDTH / (float)DS_SCREEN_HEIGHT, 5, 10000.0); MYgluPerspective(CalcFov(90, DS_SCREEN_WIDTH, DS_SCREEN_HEIGHT), (float)DS_SCREEN_WIDTH / (float)DS_SCREEN_HEIGHT, 4, 8192); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glEnable(GL_ALPHA_TEST); glAlphaFunc(GL_GREATER, 0); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); //glDisable(GL_TEXTURE_2D); ShowCursor(0); #endif set_position(0, 0, 400, 240); build_font(); return 0; }
BitmapFont::BitmapFont( SDL_Surface *surface ) { //Construit le font build_font( surface ); }