doompanning/src/dp_doom/linuxdoom-1.10/ib_video/ib_video_nng.c

97 lines
2.1 KiB
C
Raw Normal View History

// Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// $Id:$
//
// Copyright (C) 1993-1996 by id Software, Inc.
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// $Log:$
//
// DESCRIPTION:
// DOOM graphics stuff for X11, UNIX.
//
//-----------------------------------------------------------------------------
#include <signal.h>
#include <stddef.h>
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include "../doomstat.h"
#include "../i_system.h"
#include "../v_video.h"
#include "../m_argv.h"
#include "../d_main.h"
#include "../doomdef.h"
#include "../ib_video.h"
#define BYTES_PER_PIXEL 3
//uint8_t frameBuffer[SCREENWIDTH * SCREENHEIGHT * BYTES_PER_PIXEL];
static uint8_t *g_frameBuffer;
static size_t g_pitch;
//
// IB_StartTic
//
void IB_StartTic (void)
{
}
void IB_GetFramebuffer(unsigned char **pixels, size_t *pitch)
{
*pixels = g_frameBuffer;
*pitch = g_pitch;
}
void IB_FinishUpdate (void)
{
}
void IB_GetColor(unsigned char *bytes, unsigned char red, unsigned char green, unsigned char blue)
{
bytes[0] = red;
bytes[1] = green;
bytes[2] = blue;
}
static void I_Quit_Wrapper(int dummy)
{
(void)dummy;
I_Quit();
}
void IB_InitGraphics(const char *title, size_t screen_width, size_t screen_height, size_t *bytes_per_pixel)
{
(void) title;
g_frameBuffer = malloc(screen_width * screen_height * BYTES_PER_PIXEL);
g_pitch = screen_width * BYTES_PER_PIXEL;
*bytes_per_pixel = BYTES_PER_PIXEL;
signal(SIGINT, I_Quit_Wrapper);
}
void IB_ShutdownGraphics(void)
{
free(g_frameBuffer);
}
void IB_GrabMouse(boolean grab)
{
(void) grab;
}