2403f060eb
So when PACKET_SDL_EVENT was SDL_USEREVENT, things worked fine in the main loop it would see SDL_USEREVENT and send it off to my_SDL_UserEvent. But when I started adding more events, the SDL_UserEvent paradigm given in the SDL Wiki stopped working. The example here is broken: https://wiki.libsdl.org/SDL_AddTimer The example here is working and "correct": https://wiki.libsdl.org/SDL_UserEvent All SDL_RegisterEvents is increase a static counter. SDL doesn't actually use these events anyway. It's purely symbolic, as far as I can tell. So anyway. Now events work after a bunch of debugging. SHADER_PROGRAM_REFRESH is the second user event I've done. The ShaderProgram runs an SDL_TimerID that looks at mVertexPath, mGeometryPath if present, and mFragmentPath. mVertexPath and mFragmentPath are required by Compile3ShaderBuffers. In the future I'd like to change the way this class behaves.
32 lines
633 B
C++
32 lines
633 B
C++
#pragma once
|
|
|
|
#ifndef _FILE_OFFSET_BITS
|
|
#define _FILE_OFFSET_BITS 64 /* off_t */
|
|
#endif
|
|
|
|
#ifndef _POSIX_C_SOURCE
|
|
#define _POSIX_C_SOURCE 200112L
|
|
#endif
|
|
|
|
#include <ctime>
|
|
#include <string>
|
|
|
|
class FileIO
|
|
{
|
|
FILE* fp;
|
|
std::string path;
|
|
public:
|
|
FileIO (const std::string&, const std::string&);
|
|
~FileIO (void);
|
|
FILE *Open (const std::string&, const std::string&);
|
|
int Close (void);
|
|
int Seek (const off_t, const int);
|
|
off_t Tell (void);
|
|
size_t Read (void *, const size_t);
|
|
size_t Write (const void *, const size_t);
|
|
void Rewind (void);
|
|
/* I added these. */
|
|
off_t Size (void);
|
|
std::string ReadToString (void);
|
|
};
|