Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - logi

Pages: [1]
1
General Jo Engine Help / Re: How to autoload game after video
« on: July 16, 2018, 06:38:46 pm »
I have not really spent much time on this issue, but I have noticed one thing.

If I let the video play through and wait for the my_video_stopped() callback to be executed before I try to load the background image, then the out of memory error is thrown.

But if I manually stop the video using the jo_video_stop() function just 1 frame before the video ends and remove the callback, I am then able to load the background image into memory.
Although the video window is still being displayed over the background image it is not giving any memory errors.

https://youtu.be/LYE-Hb-WM8k

Code: [Select]
#include <jo/jo.h>
#include <jo/video.h>

int viedo_draw_id;
int video_counter;

void my_draw(void) {
video_counter += 1;

if (video_counter < 385) {
// Yes, it consume a lot of memory during playing :)
jo_printf(0, 0, "Dynamic memory usage: %d%%  ", jo_memory_usage_percent());
jo_printf(0, 1, "Sprite memory usage: %d%%  ", jo_sprite_usage_percent());
jo_printf(0, 5, jo_get_last_error());
jo_sprite_draw3D(jo_get_video_sprite(), 0, 0, 170);
}
else {
jo_core_remove_callback(viedo_draw_id);
jo_sprite_free_from(jo_get_video_sprite());
jo_video_stop();
my_background();
}
}

void my_background() {
jo_clear_screen();
        jo_img      bg;
        bg.data = NULL;
        jo_tga_loader(&bg, "BG", "BG.TGA", JO_COLOR_Transparent);
        jo_set_background_sprite(&bg, 0, 0);
        jo_free_img(&bg);
}

void  my_video_stopped(void) {

}

void jo_main(void) {
jo_core_init(JO_COLOR_Black);
video_counter = 0;

if (jo_video_open_file("SAMPLE.CPK"))
            jo_video_play(my_video_stopped);

viedo_draw_id = jo_core_add_callback(my_draw);
jo_core_run();
}

EDIT:
I also modified the 'RING_BUF_SIZ' in the video.c file, which is why the video is now consuming less dynamic memory.

2
General Jo Engine Help / Re: Can't compile demo1 on Windows 10
« on: July 14, 2018, 09:05:42 am »
I am using Windows 10 Enterprise LTSB on one of my machines and I have no issues compiling demo1 using the latest version of the engine. Just downloaded from the repo now.

3
General Jo Engine Help / Re: How to autoload game after video
« on: July 11, 2018, 03:27:33 pm »
I am experiencing the same issue.
This is not something that I particularly need to implement, but it would be nice to figure out how to properly clear the memory after a video has been loaded.

When the video sample application is running it is using 71% of dynamic memory and 32% of sprite memory, according to the returned values of jo_memory_usage_percent() and jo_sprite_usage_percent() respectively.

When the video stops playing and the my_video_stopped() callback function is executed, the jo_memory_usage_percent() returns a zero, indicating that the video data is no longer consuming the dynamic memory, but the jo_sprite_usage_percent() returns 32, showing that the data has not been cleared from the sprite memory.

When I call the jo_sprite_free_from() function passing it the jo_get_video_sprite() function for the sprite ID, this then clears the sprite memory, at which point both the jo_memory_usage_percent() and jo_sprite_usage_percent() return a zero.

If I then try to load the background image from the background sample (usually consumes 4% sprite memory) I receive an out of memory error message.
https://www.youtube.com/watch?v=OtGekEpw_ro

Pages: [1]
SMF spam blocked by CleanTalk