mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-10 23:02:03 +00:00
- fixed console event processing and added a texture memory calculator.
This commit is contained in:
parent
672498be1d
commit
7e70c217fe
5 changed files with 31 additions and 2 deletions
|
@ -465,6 +465,7 @@ int main(int argc, char *argv[])
|
|||
#endif
|
||||
|
||||
if (initsystem()) Bexit(9);
|
||||
SDL_StartTextInput();
|
||||
|
||||
r = GameMain();
|
||||
|
||||
|
@ -1886,7 +1887,7 @@ int32_t handleevents_pollsdl(void)
|
|||
{
|
||||
if (GUICapture & 1)
|
||||
{
|
||||
event_t event;
|
||||
event_t event = {};
|
||||
event.type = EV_GUI_Event;
|
||||
event.subtype = ev.type == SDL_KEYDOWN ? EV_GUI_KeyDown : EV_GUI_KeyUp;
|
||||
SDL_Keymod kmod = SDL_GetModState();
|
||||
|
|
|
@ -1060,6 +1060,10 @@ void C_Ticker()
|
|||
|
||||
lasttic = consoletic;
|
||||
NotifyStrings.Tick();
|
||||
if (GUICapture & 1)
|
||||
{
|
||||
D_ProcessEvents();
|
||||
}
|
||||
}
|
||||
|
||||
void FNotifyBuffer::Tick()
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "c_bind.h"
|
||||
#include "d_event.h"
|
||||
#include "c_console.h"
|
||||
#include "d_gui.h"
|
||||
#include "inputstate.h"
|
||||
|
||||
|
@ -146,9 +147,9 @@ void D_ProcessEvents (void)
|
|||
continue;
|
||||
if (ev->type == EV_DeviceChange)
|
||||
(void)0;//UpdateJoystickMenu(I_UpdateDeviceList());
|
||||
#if 0
|
||||
if (C_Responder (ev))
|
||||
continue; // console ate the event
|
||||
#if 0
|
||||
if (M_Responder (ev))
|
||||
continue; // menu ate the event
|
||||
#endif
|
||||
|
|
|
@ -37,12 +37,20 @@
|
|||
#include "glad/glad.h"
|
||||
#include "glbackend.h"
|
||||
#include "bitmap.h"
|
||||
#include "c_dispatch.h"
|
||||
#include "printf.h"
|
||||
//#include "compat.h"
|
||||
|
||||
// Workaround to avoid including the dirty 'compat.h' header. This will hopefully not be needed anymore once the texture format uses something better.
|
||||
# define B_LITTLE_ENDIAN 1
|
||||
# define B_BIG_ENDIAN 0
|
||||
|
||||
uint64_t alltexturesize;
|
||||
|
||||
CCMD(alltexturesize)
|
||||
{
|
||||
Printf("All textures are %llu bytes\n", alltexturesize);
|
||||
}
|
||||
|
||||
|
||||
//===========================================================================
|
||||
|
@ -54,6 +62,7 @@
|
|||
unsigned int FHardwareTexture::CreateTexture(int w, int h, int type, bool mipmapped)
|
||||
{
|
||||
static int gltypes[] = { GL_R8, GL_RGBA8, GL_RGB5_A1, GL_RGBA2 };
|
||||
static uint8_t bytes[] = { 1, 4, 2, 1 };
|
||||
glTexID = GLInterface.GetTextureID();
|
||||
glActiveTexture(GL_TEXTURE15);
|
||||
glBindTexture(GL_TEXTURE_2D, glTexID);
|
||||
|
@ -65,6 +74,18 @@ unsigned int FHardwareTexture::CreateTexture(int w, int h, int type, bool mipmap
|
|||
mWidth = w;
|
||||
mHeight = h;
|
||||
|
||||
allocated = w * h;
|
||||
if (mipmapped)
|
||||
{
|
||||
|
||||
for (auto mip = allocated>>2; mip > 0; mip >>= 2)
|
||||
{
|
||||
allocated += mip;
|
||||
}
|
||||
}
|
||||
allocated *= bytes[type];
|
||||
alltexturesize += allocated;
|
||||
|
||||
glTexStorage2D(GL_TEXTURE_2D, mipmapped? bits : 1, gltypes[type], w, h);
|
||||
glBindTexture(GL_TEXTURE_2D, 0);
|
||||
glActiveTexture(GL_TEXTURE0);
|
||||
|
@ -122,6 +143,7 @@ unsigned int FHardwareTexture::LoadTexturePart(const unsigned char* buffer, int
|
|||
//===========================================================================
|
||||
FHardwareTexture::~FHardwareTexture()
|
||||
{
|
||||
alltexturesize -= allocated;
|
||||
if (glTexID != 0) glDeleteTextures(1, &glTexID);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,7 @@ private:
|
|||
bool mipmapped = true;
|
||||
int mWidth = 0, mHeight = 0;
|
||||
int colorId = 0;
|
||||
uint32_t allocated = 0;
|
||||
|
||||
public:
|
||||
|
||||
|
|
Loading…
Reference in a new issue