예제 #1
0
파일: core.c 프로젝트: timsjostrand/lodge
static void core_assets_init()
{
	/* FIXME: nice way to set this pointer from game library OR engine specific console shader. */
	core_global->console_shader = &assets->shaders.basic_shader;
	shader_uniform_matrix4f(core_global->console_shader, "projection", &core_global->graphics.projection);
	shader_constant_uniform1i(core_global->console_shader, "tex", 0);
	shader_constant_uniform4f(core_global->console_shader, "color", COLOR_WHITE);

	/* Load console. */
	console_new(&core_global->console, &core_global->font_console, core_global->view_width, 16, &core_global->textures.none,
			core_global->console_shader, &core_global->env);

	/* Create core commands. */
	core_console_new(&core_global->console, &core_global->env);

	/* Create game-specific commands. */
	if (core_global->console_init_callback != NULL) {
		core_global->console_init_callback(&core_global->console, &core_global->env);
	}
	console_parse_conf(&core_global->console, &core_global->console.conf);

	/* Game specific init. */
	if (core_global->init_callback != NULL) {
		core_global->init_callback();
	}
}
예제 #2
0
// ------------------------------------------------------------------- init ---
void init( void )
{
    control_key_handled = 0;

    console = console_new();
    console_print( console,
                   "OpenGL Freetype console\n"
                   "Copyright 2011 Nicolas P. Rougier. All rights reserved.\n \n" );
    console_connect( console, "activate",     console_activate );
    console_connect( console, "complete",     console_complete );
    console_connect( console, "history-prev", console_history_prev );
    console_connect( console, "history-next", console_history_next );

    glClearColor( 1.00, 1.00, 1.00, 1.00 );
    glDisable( GL_DEPTH_TEST );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
    glEnable( GL_TEXTURE_2D );
    glEnable( GL_BLEND );

    shader = shader_load("shaders/v3f-t2f-c4f.vert",
                         "shaders/v3f-t2f-c4f.frag");
    mat4_set_identity( &projection );
    mat4_set_identity( &model );
    mat4_set_identity( &view );
}
예제 #3
0
int
main( int argc, char **argv )
{
    glutInit( &argc, argv );
    glutInitDisplayMode( GLUT_DOUBLE | GLUT_RGB | GLUT_DEPTH );
    glutCreateWindow( argv[0] );
    glutReshapeFunc( on_reshape );
    glutDisplayFunc( on_display );
    glutKeyboardFunc( on_key_press );
    glutSpecialFunc( on_special_key_press );
    glutReshapeWindow( 600,400 );
#ifndef __APPLE__
    glewExperimental = GL_TRUE;
    GLenum err = glewInit();
    if (GLEW_OK != err)
    {
        /* Problem: glewInit failed, something is seriously wrong. */
        fprintf( stderr, "Error: %s\n", glewGetErrorString(err) );
        exit( EXIT_FAILURE );
    }
    fprintf( stderr, "Using GLEW %s\n", glewGetString(GLEW_VERSION) );
#endif
    console = console_new();
    console_print( console,
                   L"OpenGL Freetype console\n"
                   L"Copyright 2011 Nicolas P. Rougier. All rights reserved.\n \n" );
    console_connect( console, "activate",     console_activate );
    console_connect( console, "complete",     console_complete );
    console_connect( console, "history-prev", console_history_prev );
    console_connect( console, "history-next", console_history_next );

    glClearColor( 1.00, 1.00, 1.00, 1.00 );
    glDisable( GL_DEPTH_TEST );
    glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );
    glEnable( GL_TEXTURE_2D );
    glEnable( GL_BLEND );

    shader = shader_load("shaders/v3f-t2f-c4f.vert",
                         "shaders/v3f-t2f-c4f.frag");
    mat4_set_identity( &projection );
    mat4_set_identity( &model );
    mat4_set_identity( &view );
    glutMainLoop();


    return 0;
}
예제 #4
0
void  kbd_irq(void)
{
	unsigned scan_code;
   char temp[255];
   unsigned int c;
   DWORD flags;
   dex32_stopints(&flags);
/* read I/O port 60h to reset interrupt at 8042 keyboard controller chip */
	scan_code = inportb(0x60);
   c=set1_scancode_to_ascii(scan_code);


   if (c!=-1)
    {
    
           if (!kb_dohotkey(c,kbd_status))
           {     
                   if (c == SOFT_RESET) ps_shutdown();
                        else 
                   if (c==KEY_F2+400) console_new();
                        else 
                   if (c==KEY_F1+400) dex32_set_tm_state(!dex32_get_tm_state());
                        else 
                   if (c==KEY_F4+400) kill_foreground();  //force terminate
                        else
                   if (c=='c'-'a')
                        signal_foreground(); //ask the app to terminate itself
                   else
                        {
                      	if (inq(&_q,c)==-1) beep();
                      	}
          	};
    };
    
   dex32_restoreints(flags);
};