white screen nothing happens and no errors?

coding a game of pong and all of a sudden my screen just goes white and i cant figure out why>.<!!!!!!

vs2010 its not displaying any errors or warning so i cant figure out where the problem lies any help would be nice.

its alot to read through

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// SDL_App.cpp : Defines the entry point for our Project
//
//#include "stdafx.h"
#include <Windows.h>
#include "GL_Functions.h"
#include "pctimer.h"
#include <string>
#include <cmath>

#include <crtdbg.h>


int main(int argc, char* argv[])
{

	//Lets open the window and initialise opengl
	InitGL(1024,768);
	
	int ball = LoadTexture ("./images/ball.png");
	int leftpaddle_2 = LoadTexture ("./images/paddle_2.png");
	int rightpaddle_1 = LoadTexture ("./images/paddle_1.png");
	int iBackground = LoadTexture("./images/background.png");

	//int ibackground		= 2;
	//int ibackgroundy		= 0;
	//int ibackgroundx		= 0;
	float paddle_width		= 5;
	float paddle_length		= 15;
	float ball_width		= 2.5;
	float ball_length		= 5;
	float ballx				=492;
	float bally				=384;
	float ballxspeed		= 4;
	float ballyspeed		= 2;
	float rightpaddle_1x	= 980;
	float rightpaddle_1y	= 30;
	float leftpaddle_2x		= 30;
	float lefpaddle_2y		= 350;
	float ballrside			= ballx + 40;

	char iHighscores[7]= {1,2,3,4,5,6,7};
	
do
{
	//Clear the screen, so previous frames don't build up
	ClearScreen();
		
	ballx = ballx + ballxspeed;
	bally = bally + ballyspeed;
		
	//draws images to screen 
	DrawLine(512,0,512,768);
	DrawSprite(ball, ballx, bally, 40, 40); 
	DrawSprite(leftpaddle_2, leftpaddle_2x,  lefpaddle_2y, 20, 100);
	DrawSprite(rightpaddle_1, rightpaddle_1x, rightpaddle_1y, 20, 100);
	//DrawSprite(ibackground, ibackgroundx, ibackgroundy, 1024, 768);


	// ball speed/control 

	if (ballx > 984)	
	{
		ballx = 492;
		bally = 384;
		ballxspeed *= -1;
	}

	if ( ballx < 0)	
	{
		ballx = 492;
		bally = 384;
		ballxspeed *= -1;
	}
		
	if (bally > 728 || bally < 0)
		ballyspeed *= -.5;

	// controls for players one and two
	// player one's controls ( 'w' and 's')
	// player two's controls ( 'up' and 'down')

	if (IsKeyDown(KEY_UP))
	{
		rightpaddle_1y = rightpaddle_1y -5;
		if( rightpaddle_1y < 0 )
		{
			rightpaddle_1y = 0;	
		}
	}
	{
	if (IsKeyDown(KEY_DOWN) && rightpaddle_1y < 668)
		rightpaddle_1y = rightpaddle_1y +5;

	if (IsKeyDown('w') && lefpaddle_2y > 0)
		lefpaddle_2y = lefpaddle_2y -5;
		
	if (IsKeyDown('s') && lefpaddle_2y < 668)
		lefpaddle_2y = lefpaddle_2y +5;
	}

		
	//Esc will quit the game.
	if (IsKeyDown(KEY_ESCAPE))
		return 1;
	
	//limit paddles so that stay with in boundaries placed
	{
		  
	if (ballx <  lefpaddle_2y && ballx >  lefpaddle_2y && bally >  lefpaddle_2y - 20 && bally <  lefpaddle_2y + 120)
		ballxspeed *= -1;

	if (ballx + 40 > rightpaddle_1x && ballx + 40 < rightpaddle_1x && bally > rightpaddle_1y - 20 && bally < rightpaddle_1y + 120)
		ballxspeed *= -1;

	if(lefpaddle_2y + paddle_width > 668)
	lefpaddle_2y = 668 - paddle_width;
		
	if(rightpaddle_1x + paddle_width > 1023)
	rightpaddle_1x = 1023 - paddle_width;  
	}
	if(ball_length + ball_width > paddle_width + paddle_length)
		ballx,bally = 0;
	{
	if(rightpaddle_1x >= ballx  && rightpaddle_1x <= (ballx  + ball_width) ||
	(rightpaddle_1x + paddle_width ) >= ballx && (rightpaddle_1x + paddle_width ) <= (ballx  + ball_width))
	//The ball and paddle appear to overlap...so it should bounce 
     
	if(rightpaddle_1y >= bally && rightpaddle_1y <= ( bally + ball_length) ||
	(rightpaddle_1y + paddle_length) >=  bally && (rightpaddle_1y +  paddle_length) <= ( bally +ball_length)) 
	//Stop it from running too fast! Sleep ZZzzz
	(FrameworkUpdate()); //Do some secret stuff,
	}
	Sleep(5);
	
		
	}while(1); 
	 

	FreeTexture(ball);
	FreeTexture(leftpaddle_2);
	FreeTexture(rightpaddle_1);
	FreeTexture(iBackground);


	//Close down
	CloseDown();

	_CrtDumpMemoryLeaks();

	//Quit!
	return 0;
 }

thanks for your time and effort
Last edited on
Topic archived. No new replies allowed.