static void video_resize_callback(Widget w, XtPointer clientData, XtPointer callData) { PLOT *plot = (PLOT *)clientData; video_set(plot); return; }
function main() { video_set( 1024, 768, 32, 2 ) ; level_state = 0 ; game_init() ; sceneManager() ; // MAIN GAME LOOP // while(1) { if( level_state == 0 ) { // pause the game freeze_mode = 1 ; } else { freeze_mode = 0; } wait(1); } }
void screen_division() { ScreenSegment screen_segment = screen_segment_table[DEBUG]; int offset; for(offset = 0; offset < screen_segment.char_offset_limit; offset++) { video_set(DEBUG, offset, screen_segment.line_offset_limit - 1, '-'); } }
/* * Erase previous written position. * Does not support multi lines erasing. */ void video_erase_write(int fd) { ScreenSegment* ss = &screen_segment_table[fd]; if (ss->char_offset > 0) { ss->char_offset--; video_set(fd, ss->char_offset, ss->line_offset, ' '); video_move_type_cursor(fd); } }
void video_showvideoframe(PLOT *plot, unsigned long long ntime) { struct videodata *plotdata = (struct videodata *)plot->plotdata; GROUP *group = plot->group; VIDCLOSESTFRAME vcf; vcf.ntime = ntime; vcf.framenum = -1; vid_ctl(group->vidfp, VIDIOGETCLOSESTFRAME, &vcf); plotdata->framenum = vcf.framenum; video_set(plot); return; }
/* * Cleans a screen segment and starts offset from 0 */ void clean_screen_segment(int fd) { ScreenSegment ss = screen_segment_table[fd]; int line; int char_pos; for (line = 0; line < ss.line_offset_limit; line++) { for (char_pos = 0; char_pos < ss.char_offset_limit; char_pos++) { video_set(fd, char_pos, line, ' '); } } }
int video_display(PLOT *plot) { struct videodata *plotdata = (struct videodata *)plot->plotdata; int status = SUCCESS, tstatus; GROUP *group = plot->group; /* ** Load the video data, but only if we need to... */ if (group->viddirty == 1) { if (load_viddata(&group->vidfp, group->loadedfilename, group->filename, group->entry, &plotdata->nframes, &plotdata->width, &plotdata->height, &plotdata->ncomps, &plotdata->microsecs_per_frame, &group->ntime) == 0) { if (plotdata->framedata) { free(plotdata->framedata); plotdata->framedata = (char *)calloc(plotdata->height * plotdata->width, plotdata->ncomps); } group->viddirty = 0; plotdata->image->width = plotdata->width; plotdata->image->height = plotdata->height; plotdata->image->xoffset = 0; plotdata->image->format = ZPixmap; /* XYBitmap, XYPixmap, or ZPixmap */ plotdata->image->data = NULL; plotdata->image->byte_order = LSBFirst; plotdata->image->bitmap_unit = 8; plotdata->image->bitmap_bit_order = LSBFirst; plotdata->image->bitmap_pad = 8; plotdata->image->depth = plotdata->ncomps; plotdata->image->bytes_per_line = plotdata->width * plotdata->ncomps; plotdata->image->bits_per_pixel = plotdata->ncomps * 8; plotdata->image->red_mask = 0; plotdata->image->green_mask = 0; plotdata->image->blue_mask = 0; XInitImage(plotdata->image); plotdata->image->data = plotdata->framedata; } else status = ERROR; } /* ** Update the plot */ tstatus = video_set(plot); return (status == SUCCESS) ? (tstatus) : (status); }
void video_write(int fd, char ascii){ ScreenSegment* ss = &screen_segment_table[fd]; video_set(fd, ss->char_offset, ss->line_offset, ascii); /* * We increment one positions since we only * count logic characters, not bytes on screen. */ ss->char_offset++; if (ss->char_offset == ss->char_offset_limit) { _video_new_line(fd); } video_move_type_cursor(fd); }
void main() { // initialize game video_set(1024, 768, 32, 2); warn_level = 2; tex_share = 1; mouse_mode = 4; mouse_range = 100000; shadow_stencil = 2; random_seed(0); level_load("eggz.wmb"); // load the level wait(2); // wait two ticks for the level to finish loading // position the camera camera.x = 800; camera.y = 0; camera.z = 500; camera.pan = 180; camera.tilt = -20 ; // MAIN GAME LOOP // while(1) // start the loop. { wait(1); } }