Moved some variables to defines
This commit is contained in:
parent
44d584dfdb
commit
352ae83858
|
@ -14,7 +14,6 @@ typedef unsigned int Uint32;
|
||||||
typedef signed int Sint32;
|
typedef signed int Sint32;
|
||||||
|
|
||||||
#define SAMPLE_FREQUENCY 44100
|
#define SAMPLE_FREQUENCY 44100
|
||||||
#define POLYPHONY 4
|
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Uint8 *addr;
|
Uint8 *addr;
|
||||||
|
|
12
src/uxnemu.c
12
src/uxnemu.c
|
@ -21,6 +21,10 @@ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||||
WITH REGARD TO THIS SOFTWARE.
|
WITH REGARD TO THIS SOFTWARE.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define PAD 4
|
||||||
|
#define POLYPHONY 4
|
||||||
|
#define BENCH 0
|
||||||
|
|
||||||
static SDL_AudioDeviceID audio_id;
|
static SDL_AudioDeviceID audio_id;
|
||||||
static SDL_Window *gWindow;
|
static SDL_Window *gWindow;
|
||||||
static SDL_Surface *winSurface, *idxSurface, *rgbaSurface;
|
static SDL_Surface *winSurface, *idxSurface, *rgbaSurface;
|
||||||
|
@ -30,9 +34,7 @@ static Apu apu[POLYPHONY];
|
||||||
static Device *devsystem, *devscreen, *devmouse, *devctrl, *devaudio0, *devconsole;
|
static Device *devsystem, *devscreen, *devmouse, *devctrl, *devaudio0, *devconsole;
|
||||||
static Uint32 stdin_event;
|
static Uint32 stdin_event;
|
||||||
|
|
||||||
#define PAD 4
|
static Uint8 zoom = 1, reqdraw = 0;
|
||||||
|
|
||||||
static Uint8 zoom = 1, reqdraw = 0, bench = 0;
|
|
||||||
|
|
||||||
static Uint8 font[][8] = {
|
static Uint8 font[][8] = {
|
||||||
{0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
|
{0x00, 0x7c, 0x82, 0x82, 0x82, 0x82, 0x82, 0x7c},
|
||||||
|
@ -434,7 +436,7 @@ run(Uxn *u)
|
||||||
while(1) {
|
while(1) {
|
||||||
SDL_Event event;
|
SDL_Event event;
|
||||||
double elapsed, start = 0;
|
double elapsed, start = 0;
|
||||||
if(!bench)
|
if(!BENCH)
|
||||||
start = SDL_GetPerformanceCounter();
|
start = SDL_GetPerformanceCounter();
|
||||||
while(SDL_PollEvent(&event) != 0) {
|
while(SDL_PollEvent(&event) != 0) {
|
||||||
switch(event.type) {
|
switch(event.type) {
|
||||||
|
@ -473,7 +475,7 @@ run(Uxn *u)
|
||||||
uxn_eval(u, mempeek16(devscreen->dat, 0));
|
uxn_eval(u, mempeek16(devscreen->dat, 0));
|
||||||
if(reqdraw || devsystem->dat[0xe])
|
if(reqdraw || devsystem->dat[0xe])
|
||||||
redraw(u);
|
redraw(u);
|
||||||
if(!bench) {
|
if(!BENCH) {
|
||||||
elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;
|
elapsed = (SDL_GetPerformanceCounter() - start) / (double)SDL_GetPerformanceFrequency() * 1000.0f;
|
||||||
SDL_Delay(clamp(16.666f - elapsed, 0, 1000));
|
SDL_Delay(clamp(16.666f - elapsed, 0, 1000));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue