2023-02-19 02:17:52 +01:00
|
|
|
// 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.
|
|
|
|
//
|
|
|
|
//-----------------------------------------------------------------------------
|
|
|
|
|
2023-02-19 03:08:56 +01:00
|
|
|
#include <signal.h>
|
2023-02-19 02:17:52 +01:00
|
|
|
#include <stddef.h>
|
2023-02-19 03:08:56 +01:00
|
|
|
#include <stdint.h>
|
2023-02-19 02:17:52 +01:00
|
|
|
#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"
|
|
|
|
|
2023-02-19 03:08:56 +01:00
|
|
|
#define BYTES_PER_PIXEL 3
|
|
|
|
|
|
|
|
//uint8_t frameBuffer[SCREENWIDTH * SCREENHEIGHT * BYTES_PER_PIXEL];
|
|
|
|
static uint8_t *g_frameBuffer;
|
|
|
|
static size_t g_pitch;
|
|
|
|
|
2023-02-19 02:17:52 +01:00
|
|
|
//
|
|
|
|
// IB_StartTic
|
|
|
|
//
|
|
|
|
void IB_StartTic (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void IB_GetFramebuffer(unsigned char **pixels, size_t *pitch)
|
|
|
|
{
|
2023-02-19 03:08:56 +01:00
|
|
|
*pixels = g_frameBuffer;
|
|
|
|
*pitch = g_pitch;
|
2023-02-19 02:17:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IB_FinishUpdate (void)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
void IB_GetColor(unsigned char *bytes, unsigned char red, unsigned char green, unsigned char blue)
|
|
|
|
{
|
2023-02-19 03:08:56 +01:00
|
|
|
bytes[0] = red;
|
|
|
|
bytes[1] = green;
|
|
|
|
bytes[2] = blue;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void I_Quit_Wrapper(int dummy)
|
|
|
|
{
|
|
|
|
(void)dummy;
|
|
|
|
|
|
|
|
I_Quit();
|
2023-02-19 02:17:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IB_InitGraphics(const char *title, size_t screen_width, size_t screen_height, size_t *bytes_per_pixel)
|
|
|
|
{
|
2023-02-19 03:08:56 +01:00
|
|
|
(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);
|
2023-02-19 02:17:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IB_ShutdownGraphics(void)
|
|
|
|
{
|
2023-02-19 03:08:56 +01:00
|
|
|
free(g_frameBuffer);
|
2023-02-19 02:17:52 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void IB_GrabMouse(boolean grab)
|
|
|
|
{
|
2023-02-19 03:08:56 +01:00
|
|
|
(void) grab;
|
2023-02-19 02:17:52 +01:00
|
|
|
}
|