/* * ================ * VID_Update * ================ */ public static void VID_Update(vrect_t rects) { //surface.UpdateBitmap(rects.x, rects.y, rects.width, rects.height); //surface.Blit(Page.bitmap); int ofs = surface.PixelWidth * rects.y + rects.x; for (int r = 0; r < rects.height; r++) { for (int col = 0; col < rects.width; col++) { int c = screen.vid.buffer[ofs + col]; surface.Pixels[ofs + col] = (vid_current_palette[c * 3 + 0] << 16) | (vid_current_palette[c * 3 + 1] << 8) | vid_current_palette[c * 3 + 2]; } ofs += surface.PixelWidth; } surface.Invalidate(); //Page.thePage.image.Source = surface; }
/* ================ VID_Update ================ */ public static void VID_Update(vrect_t rects) { int ofs = surface.PixelWidth * rects.y + rects.x; #if SILVERLIGHT for (int r = 0; r < rects.height; r++) { for (int col = 0; col < rects.width; col++) { int c = screen.vid.buffer[ofs + col]; surface.Pixels[ofs + col] = (vid_current_palette[c * 3 + 0] << 16) | (vid_current_palette[c * 3 + 1] << 8) | vid_current_palette[c * 3 + 2]; } ofs += surface.PixelWidth; } surface.Invalidate(); #else var imageData = surface.context.GetImageData(0, 0, surface.canvas.Width, surface.canvas.Height); for (int r = 0; r < rects.height; r++) { for (int col = 0; col < rects.width; col++) { var pixelOffset = ofs + col; var c = screen.vid.buffer[pixelOffset]; var offset = (pixelOffset) * 4; imageData.Data[offset] = vid_current_palette[c * 3]; //r imageData.Data[offset + 1] = vid_current_palette[c * 3 + 1]; //g imageData.Data[offset + 2] = vid_current_palette[c * 3 + 2]; //b imageData.Data[offset + 3] = 255; //a } ofs += surface.PixelWidth; } surface.context.PutImageData(imageData, 0, 0); #endif //Page.thePage.image.Source = surface; }
public static void SCR_CalcRefdef() { scr_fullupdate = 0; // force a background redraw vid.recalc_refdef = false; // force the status bar to redraw Sbar_Changed(); // bound viewsize if (scr_viewsize.value < 30) { Cvar.Cvar_Set("viewsize", "30"); } if (scr_viewsize.value > 120) { Cvar.Cvar_Set("viewsize", "120"); } // bound field of view if (scr_fov.value < 10) { Cvar.Cvar_Set("fov", "10"); } if (scr_fov.value > 170) { Cvar.Cvar_Set("fov", "170"); } // intermission is always full screen float size; if (cl.intermission > 0) { size = 120; } else { size = scr_viewsize.value; } if (size >= 120) { sb_lines = 0; // no status bar at all } else if (size >= 110) { sb_lines = 24; // no inventory } else { sb_lines = 24 + 16 + 8; } bool full = false; if (scr_viewsize.value >= 100.0) { full = true; size = 100.0f; } else { size = scr_viewsize.value; } if (cl.intermission > 0) { full = true; size = 100; sb_lines = 0; } size /= 100.0f; int h = vid.height - sb_lines; refdef_t rdef = r_refdef; rdef.vrect.width = (int)(vid.width * size); if (rdef.vrect.width < 96) { size = 96.0f / rdef.vrect.width; rdef.vrect.width = 96; // min for icons } rdef.vrect.height = (int)(vid.height * size); if (rdef.vrect.height > vid.height - sb_lines) { rdef.vrect.height = vid.height - sb_lines; } if (rdef.vrect.height > vid.height) { rdef.vrect.height = vid.height; } rdef.vrect.x = (vid.width - rdef.vrect.width) / 2; if (full) { rdef.vrect.y = 0; } else { rdef.vrect.y = (h - rdef.vrect.height) / 2; } rdef.fov_x = scr_fov.value; rdef.fov_y = CalcFov(rdef.fov_x, rdef.vrect.width, rdef.vrect.height); scr_vrect = rdef.vrect; }