Fixed bug 2190 - test/testdrawchessboard.c line endings
authorSam Lantinga <slouken@libsdl.org>
Sun, 03 Nov 2013 11:27:06 -0800
changeset 7905586eddae6340
parent 7904 915b9b6c9fa0
child 7906 19f5760dc1a7
Fixed bug 2190 - test/testdrawchessboard.c line endings

Joseph Carter
test/testdrawchessboard.c checks out of hg with DOS line endings on non-dos systems. Fixed via:

perl -pi -e 's/\r//g' test/testdrawchessboard.c
test/testdrawchessboard.c
     1.1 --- a/test/testdrawchessboard.c	Sun Nov 03 11:13:06 2013 -0800
     1.2 +++ b/test/testdrawchessboard.c	Sun Nov 03 11:27:06 2013 -0800
     1.3 @@ -1,110 +1,110 @@
     1.4 -/*
     1.5 -   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
     1.6 -
     1.7 -   This software is provided 'as-is', without any express or implied
     1.8 -   warranty.  In no event will the authors be held liable for any damages
     1.9 -   arising from the use of this software.
    1.10 -
    1.11 -   Permission is granted to anyone to use this software for any purpose,
    1.12 -   including commercial applications, and to alter it and redistribute it
    1.13 -   freely.
    1.14 -
    1.15 -   This file is created by : Nitin Jain (nitin.j4@samsung.com)
    1.16 -*/
    1.17 -
    1.18 -/* Sample program:  Draw a Chess Board  by using SDL_CreateSoftwareRenderer API */
    1.19 -
    1.20 -#include <stdlib.h>
    1.21 -#include <stdio.h>
    1.22 -
    1.23 -#include "SDL.h"
    1.24 -
    1.25 -void
    1.26 -DrawChessBoard(SDL_Renderer * renderer)
    1.27 -{
    1.28 -	int row = 0,coloum = 0,x = 0;
    1.29 -	SDL_Rect rect, darea;
    1.30 -
    1.31 -	/* Get the Size of drawing surface */
    1.32 -	SDL_RenderGetViewport(renderer, &darea);
    1.33 -
    1.34 -	for(row; row < 8; row++)
    1.35 -	{
    1.36 -		coloum = row%2;
    1.37 -		x = x + coloum;
    1.38 -		for(coloum; coloum < 4+(row%2); coloum++)
    1.39 -		{
    1.40 -			SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
    1.41 -
    1.42 -			rect.w = darea.w/8;
    1.43 -			rect.h = darea.h/8;
    1.44 -			rect.x = x * rect.w;
    1.45 -			rect.y = row * rect.h;
    1.46 -			x = x + 2;
    1.47 -			SDL_RenderFillRect(renderer, &rect);
    1.48 -		}
    1.49 -		x=0;
    1.50 -	}
    1.51 -}
    1.52 -
    1.53 -int
    1.54 -main(int argc, char *argv[])
    1.55 -{
    1.56 -	SDL_Window *window;
    1.57 -	SDL_Surface *surface;
    1.58 -	SDL_Renderer *renderer;
    1.59 -
    1.60 +/*
    1.61 +   Copyright (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
    1.62 +
    1.63 +   This software is provided 'as-is', without any express or implied
    1.64 +   warranty.  In no event will the authors be held liable for any damages
    1.65 +   arising from the use of this software.
    1.66 +
    1.67 +   Permission is granted to anyone to use this software for any purpose,
    1.68 +   including commercial applications, and to alter it and redistribute it
    1.69 +   freely.
    1.70 +
    1.71 +   This file is created by : Nitin Jain (nitin.j4@samsung.com)
    1.72 +*/
    1.73 +
    1.74 +/* Sample program:  Draw a Chess Board  by using SDL_CreateSoftwareRenderer API */
    1.75 +
    1.76 +#include <stdlib.h>
    1.77 +#include <stdio.h>
    1.78 +
    1.79 +#include "SDL.h"
    1.80 +
    1.81 +void
    1.82 +DrawChessBoard(SDL_Renderer * renderer)
    1.83 +{
    1.84 +	int row = 0,coloum = 0,x = 0;
    1.85 +	SDL_Rect rect, darea;
    1.86 +
    1.87 +	/* Get the Size of drawing surface */
    1.88 +	SDL_RenderGetViewport(renderer, &darea);
    1.89 +
    1.90 +	for(row; row < 8; row++)
    1.91 +	{
    1.92 +		coloum = row%2;
    1.93 +		x = x + coloum;
    1.94 +		for(coloum; coloum < 4+(row%2); coloum++)
    1.95 +		{
    1.96 +			SDL_SetRenderDrawColor(renderer, 0, 0, 0, 0);
    1.97 +
    1.98 +			rect.w = darea.w/8;
    1.99 +			rect.h = darea.h/8;
   1.100 +			rect.x = x * rect.w;
   1.101 +			rect.y = row * rect.h;
   1.102 +			x = x + 2;
   1.103 +			SDL_RenderFillRect(renderer, &rect);
   1.104 +		}
   1.105 +		x=0;
   1.106 +	}
   1.107 +}
   1.108 +
   1.109 +int
   1.110 +main(int argc, char *argv[])
   1.111 +{
   1.112 +	SDL_Window *window;
   1.113 +	SDL_Surface *surface;
   1.114 +	SDL_Renderer *renderer;
   1.115 +
   1.116      /* Enable standard application logging */
   1.117 -    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   1.118 -
   1.119 -	/* Initialize SDL */
   1.120 -	if(SDL_Init(SDL_INIT_VIDEO) != 0)
   1.121 -	{
   1.122 -		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
   1.123 -		return 1;
   1.124 -	}
   1.125 -
   1.126 -
   1.127 -	/* Create window and renderer for given surface */
   1.128 -	window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
   1.129 -	if(!window)
   1.130 -	{
   1.131 -		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
   1.132 -		return 1;
   1.133 -	}	
   1.134 -	surface = SDL_GetWindowSurface(window);
   1.135 -	renderer = SDL_CreateSoftwareRenderer(surface);
   1.136 -	if(!renderer)
   1.137 -	{
   1.138 -		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
   1.139 -		return 1;
   1.140 -	}
   1.141 -
   1.142 -	/* Clear the rendering surface with the specified color */
   1.143 -	SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0);
   1.144 -	SDL_RenderClear(renderer);
   1.145 -
   1.146 -
   1.147 -	/* Draw the Image on rendering surface */
   1.148 -	while(1)
   1.149 -	{
   1.150 -		SDL_Event e;
   1.151 -		if (SDL_PollEvent(&e)) {
   1.152 -			if (e.type == SDL_QUIT) 
   1.153 -				break;
   1.154 -
   1.155 -			if(e.key.keysym.sym == SDLK_ESCAPE)
   1.156 -				break;
   1.157 -		}
   1.158 -		
   1.159 -		DrawChessBoard(renderer);
   1.160 -		
   1.161 -		/* Got everything on rendering surface,
   1.162 - 		   now Update the drawing image on window screen */
   1.163 -		SDL_UpdateWindowSurface(window);
   1.164 -
   1.165 -	}
   1.166 -
   1.167 -	return 0;
   1.168 -}
   1.169 -
   1.170 +    SDL_LogSetPriority(SDL_LOG_CATEGORY_APPLICATION, SDL_LOG_PRIORITY_INFO);
   1.171 +
   1.172 +	/* Initialize SDL */
   1.173 +	if(SDL_Init(SDL_INIT_VIDEO) != 0)
   1.174 +	{
   1.175 +		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "SDL_Init fail : %s\n", SDL_GetError());
   1.176 +		return 1;
   1.177 +	}
   1.178 +
   1.179 +
   1.180 +	/* Create window and renderer for given surface */
   1.181 +	window = SDL_CreateWindow("Chess Board", SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, 640, 480, SDL_WINDOW_SHOWN);
   1.182 +	if(!window)
   1.183 +	{
   1.184 +		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Window creation fail : %s\n",SDL_GetError());
   1.185 +		return 1;
   1.186 +	}	
   1.187 +	surface = SDL_GetWindowSurface(window);
   1.188 +	renderer = SDL_CreateSoftwareRenderer(surface);
   1.189 +	if(!renderer)
   1.190 +	{
   1.191 +		SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Render creation for surface fail : %s\n",SDL_GetError());
   1.192 +		return 1;
   1.193 +	}
   1.194 +
   1.195 +	/* Clear the rendering surface with the specified color */
   1.196 +	SDL_SetRenderDrawColor(renderer, 0xFF, 0xFF, 0xFF, 0);
   1.197 +	SDL_RenderClear(renderer);
   1.198 +
   1.199 +
   1.200 +	/* Draw the Image on rendering surface */
   1.201 +	while(1)
   1.202 +	{
   1.203 +		SDL_Event e;
   1.204 +		if (SDL_PollEvent(&e)) {
   1.205 +			if (e.type == SDL_QUIT) 
   1.206 +				break;
   1.207 +
   1.208 +			if(e.key.keysym.sym == SDLK_ESCAPE)
   1.209 +				break;
   1.210 +		}
   1.211 +		
   1.212 +		DrawChessBoard(renderer);
   1.213 +		
   1.214 +		/* Got everything on rendering surface,
   1.215 + 		   now Update the drawing image on window screen */
   1.216 +		SDL_UpdateWindowSurface(window);
   1.217 +
   1.218 +	}
   1.219 +
   1.220 +	return 0;
   1.221 +}
   1.222 +