Ooops, I used abs, not fabs. That caused the code to be buggy!
The new one is 899 bytes. I also optimised your game logic a bit better for crinkler (about 10 bytes saved).
Oh yes also was able to remove glLoadIdentity. You might actually be able to add "bloop", "blop" sounds.
// New crinkler optimised OpenGL 1k framework.
// /CRINKLER /COMPMODE:SLOW /HASHSIZE:200 /HASHTRIES:50 /ORDERTRIES:6000
// this version is 899 bytes
#include <windows.h>
#include <math.h>
#include <GL/gl.h>
#include <GL/glu.h>
#define NULLNULL 0.0000000000f
#define NULLNULLONETRHEE 0.0130000000f
#define NULLNINE 0.8984375000f
#define NULLTWO 0.2001953125f
#define NULLNULLFIVE 0.0500488281f
#define NULLEIGHTSIX 0.8593750000f
#define NULLNULLEIGHT 0.0800781250f
#define NULLFIVE 0.5000000000f
static GLfloat batY, ballX, ballY;
static PIXELFORMATDESCRIPTOR pfd={
0, // Size Of This Pixel Format Descriptor... BAD coding, nothing new, saves 6 bytes
1, PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER, 32, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 32, 0, 0, 0, 0, 0, 0, 0
};
static void drawRect(float x, float y, float s) {glRectf(x, y, x+NULLNULLFIVE, y+s);}
void WINAPI WinMainCRTStartup()
{
DWORD cur;
GLfloat veloX, veloY, check;
veloX=veloY=NULLNULLONETRHEE;
HDC hDC = GetDC( CreateWindow("edit", 0, WS_POPUP|WS_VISIBLE|WS_MAXIMIZE, 0, 0, 0, 0, 0, 0, 0, 0) );
SetPixelFormat ( hDC, ChoosePixelFormat ( hDC, &pfd) , &pfd );
wglMakeCurrent ( hDC, wglCreateContext(hDC) );
ShowCursor(FALSE);
DWORD start = GetTickCount();
for (;;)
{
cur = GetTickCount();
if ( (cur - start ) < 10 ) continue;
start = cur;
ballX+=veloX;
ballY+=veloY;
if ( ballY > NULLNINE || ballY < -NULLNINE ) veloY = -veloY;
check = fabs(batY - ballY);
if ( ballX > NULLEIGHTSIX) if (check<NULLTWO) veloX = -(0.005f + (check/5)); else break;
check = abs(-batY - ballY);
if ( ballX < -NULLEIGHTSIX) if (check<NULLTWO) veloX = 0.005f + (check/5); else break;
if ( GetAsyncKeyState(VK_RIGHT) && batY < NULLNINE ) batY += NULLNULLFIVE;
if ( GetAsyncKeyState(VK_LEFT) && batY > -NULLNINE) batY -= NULLNULLFIVE;
glClear( GL_COLOR_BUFFER_BIT );
drawRect( NULLNINE, -NULLNULLEIGHT + batY, NULLTWO );
drawRect( -NULLNINE, -NULLNULLEIGHT - batY, NULLTWO );
drawRect( ballX, ballY, NULLNULLFIVE );
SwapBuffers(hDC);
}
ExitProcess(0);
}