Example #1
0
/**
 * @name	tealeaf_canvas_resize
 * @brief	resize's the onscreen canvas
 * @param	w - (int) width to resize to
 * @param	h - (int) height to resize to
 * @retval	NONE
 */
void tealeaf_canvas_resize(int w, int h) {
    LOG("{canvas} Resizing screen to (%d, %d)", w, h);

    context_2d *ctx = canvas.onscreen_ctx;
    context_2d_resize(ctx, w, h);

    if (canvas.active_ctx == canvas.onscreen_ctx) {
        tealeaf_canvas_bind_render_buffer(ctx);
        tealeaf_context_update_viewport(ctx, true);
        context_2d_clear(ctx);
    }

    GLTRACE(glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA));
    GLTRACE(glEnable(GL_BLEND));
    config_set_screen_width(w);
    config_set_screen_height(h);
    canvas.should_resize = true;
}
Example #2
0
/**
 * @name	core_init
 * @brief	initilizes the config object with given options
 *			See config.c for examples for options
 * @param	entry_point - (const char*) entry point
 * @param	tcp_host - (const char*) tcp host
 * @param	code_host - (const char*) code host
 * @param	tcp_port - (int) representing the tcp port
 * @param	code_port - (int) representing the code port
 * @param	source_dir - (const char*) representing where the source directory is located
 * @param	width - (int) representing the width of the screen
 * @param	height - (int) representing the height of the screen
 * @param	remote_loading - (bool) representing whether remote loading is on / orr
 * @param	splash - (const char*) splash screen path
 * @param	simulate_id - (const char*) representing the id of the game to be simulated
 * @retval	NONE
 */
void core_init(const char *entry_point,
               const char *tcp_host,
               const char *code_host,
               int tcp_port,
               int code_port,
               const char *source_dir,
               int width,
               int height,
               bool remote_loading,
               const char *splash,
			   const char *simulate_id) {
	config_set_remote_loading(remote_loading);
	config_set_entry_point(entry_point);
	config_set_tcp_host(tcp_host);
	config_set_code_host(code_host);
	config_set_tcp_port(tcp_port);
	config_set_code_port(code_port);
	config_set_screen_width(width);
	config_set_screen_height(height);
	config_set_splash(splash);
	config_set_simulate_id(simulate_id);
	// http_init();
	// register default HTML color names
	rgba_init();
	//make checks for halfsized images
	resource_loader_initialize(source_dir);
	//default halfsized textures to false
	use_halfsized_textures = false;

	if (width <= MIN_SIZE_TO_HALFSIZE || height <= MIN_SIZE_TO_HALFSIZE) {
		use_halfsized_textures = true;
		//set halfsized textures setting to true here or else java will overwrite with
		//a potentially wrong value
		set_halfsized_textures(true);
	}

	texture_manager_set_use_halfsized_textures();
	texture_manager_load_texture(texture_manager_get(), config_get_splash());

	LOG("{core} Initialization complete");
}