亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ball.c

?? the embedded GUI for SamSung s3c2410 cpu based board.is microwindows0.90
?? C
字號:
/* * NanoBreaker, a Nano-X Breakout clone by Alex Holden. * * The contents of this file are subject to the Mozilla Public License * Version 1.1 (the "License"); you may not use this file except in * compliance with the License. You may obtain a copy of the License at * http://www.mozilla.org/MPL/ *  * Software distributed under the License is distributed on an "AS IS" * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the * License for the specific language governing rights and limitations * under the License. *  * The Original Code is NanoBreaker. *  * The Initial Developer of the Original Code is Alex Holden. * Portions created by Alex Holden are Copyright (C) 2002 * Alex Holden <alex@alexholden.net>. All Rights Reserved. *  * Contributor(s): *  * Alternatively, the contents of this file may be used under the terms * of the GNU General Public license (the  "[GNU] License"), in which case the * provisions of [GNU] License are applicable instead of those * above.  If you wish to allow use of your version of this file only * under the terms of the [GNU] License and not to allow others to use * your version of this file under the MPL, indicate your decision by * deleting  the provisions above and replace  them with the notice and * other provisions required by the [GNU] License.  If you do not delete * the provisions above, a recipient may use your version of this file * under either the MPL or the [GNU] License. *//* ball.c contains functions related to the ball. */#include <math.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <nano-X.h>#include <nxcolors.h>#include "nbreaker.h"/* Called whenever a ball is lost, either by it falling off the bottom of the * screen, or the player pressing the "suicide key". */void lost_ball(nbstate *state){	/* Decrement the balls count and if there are none left: */	if(!state->numballs--) {		/* Go to the "game lost" state and update the high score if		 * appropriate: */		state->state = STATE_GAMELOST;		/* Update the high score and save it if necessary: */		save_hiscore(state);		/* This could probably be done better by just drawing the		 * splash- set_level_active() redraws the entire game area: */		set_level_active(state);		return;	}	/* Erase the balls line at the top of the screen: */	draw_background(state, 0, state->scores.h, state->canvaswidth,			state->ball.s->h + (BALLS_BORDER * 2));	/* Draw the balls again, but with one less than there was before: */	draw_balls(state);	/* Copy the balls row to the output window: */	draw_canvas(state, 0, state->scores.h, state->canvaswidth,				state->ball.s->h + (BALLS_BORDER * 2));	/* Park the new ball and erase the old one: */	park_ball(state);	move_ball(state);	/* Redraw the bat. This is a bit of a hack because sometimes when the	 * ball falls below the top of the bat on its way to the bottom of the	 * screen it can clip the bat and erase a bit of it. This redraws the	 * bat to hide that: */	draw_bat(state);	/* Copy the redrawn bat to the output window: */	draw_canvas(state, state->batx - (state->batwidths[state->bat] / 2),			state->canvasheight - state->batheight,			state->batwidths[state->bat], state->batheight);}/* Park the ball. This means make it sit on the middle of the bat and stay * there until a mouse button is clicked or the space bar pressed. */void park_ball(nbstate *state){	state->ball.parked = 1; /* Set the parked flag. */	/* Set the ball position: */	state->ball.x = state->batx - (state->ball.s->w / 2);	state->ball.y = state->canvasheight -					state->batheight - state->ball.s->h;	/* Set the ball direction to "straight up": */	state->ball.d = 0;}/* Given the current ball position and the direction and velocity of movement, * calculate the next ball position and put it in the passed coords * structure. This uses floating point math for accuracy and convenience, but * it could probably be converted to fixed point math without too much * difficulty. */void calc_new_ball_coords(nbstate *state, coords *c){	c->x = state->ball.x + sin(state->ball.d) * state->ball.v;	c->y = state->ball.y - cos(state->ball.d) * state->ball.v;}/* If the specified angle (in radians) has strayed outside the range 0 to * 2 * PI, add 2 * PI to or subtract 2 * PI from it to get it back into the * correct range. */static double normalise_angle(double d){	if(d < 0) return d + (2 * M_PI);	else if(d > (2 * M_PI)) d -= (2 * M_PI);	return d;}/* Check if the ball will collide with something if it is moved to the * specified coordinates. If so, the direction is changed and 1 is returned * to indicate that the caller should recalculate the new coordinates and * try again. If there was no collision it returns 0. If something exceptional * happens (eg. the last brick is destroyed or the last ball is lost) it * returns 2 to indicate that the caller should give up trying to move the * ball. */int check_ball_collision(nbstate *state, coords *c){	int i, bc;	grid *g = state->grid;	/* Check for a collision with the top of the game area: */	if(c->y < state->ball.s->h + (2 * BALLS_BORDER) + state->scores.h) {		/* Bounce the ball back down and ask the caller to try again: */		state->ball.d = normalise_angle(M_PI - state->ball.d);		return 1;	}	/* Check for a collision with the bottom of the game area: */	if(c->y > state->canvasheight - state->ball.s->h) {		/* If the solidfloor cheat is active, bounce the ball back up		 * and ask the caller to try again: */		if(state->flags.sf) {			state->ball.d = normalise_angle(M_PI - state->ball.d);			return 1;		} else {			/* Otherwise destroy the ball, move the new ball to			 * the parked position (park_ball() is called by			 * lost_ball()) and ask the caller to give up trying			 * to move the ball: */			lost_ball(state);			move_ball(state);			return 2;		}	}	/* Check for a collision with the left hand side of the game area: */	if(c->x < 0) {		/* Bounce the ball back and ask the caller to try again: */		state->ball.d = normalise_angle((2 * M_PI) - state->ball.d);		return 1;	}	/* Check for a collision with the right hand side of the game area: */	if(c->x > state->canvaswidth - state->ball.s->w) {		/* Bounce the ball back and ask the caller to try again: */		state->ball.d = normalise_angle((2 * M_PI) - state->ball.d);		return 1;	}	/* Check for a collision with the bat: */	if(c->y > state->canvasheight - state->batheight - state->ball.s->h &&			c->x > state->batx -			(state->batwidths[state->bat] / 2) - state->ball.s->w &&			c->x < state->batx +			(state->batwidths[state->bat] / 2)) {		/* If the collision happened with the side of the bat instead		 * of the top, we don't care so just tell the caller there		 * was no collision: */		if(state->ball.y > state->canvasheight - state->batheight -				state->ball.s->h)			return 0;		/* If the StickyBat power-up is active, park the ball: */		if(state->powertimes.stickybat) {			park_ball(state);			move_ball(state);			return 2;		} else {			/* Otherwise bounce it back up and ask the caller to			 * try again: */			state->ball.d = normalise_angle(((c->x +						(state->ball.s->w / 2)						- state->batx) /						state->batwidths[state->bat] /						2) * M_PI);			return 1;		}	}	/* Check for collisions with the bricks: */	bc = 0; /* No collisions have happened yet. */	/* For each brick in the grid: */	for(i = 0; i < state->width * state->height; i++) {		/* If there is a brick in this grid position and the ball		 * intersects it:  */		if(g->b && c->y + state->ball.s->h > g->y && c->y < g->y +				state->brickheight && c->x + state->ball.s->w				> g->x && c->x < g->x + state->brickwidth) {			/* Perform the brick collision actions, and if			 * something exceptional happens (ie. we destroy the			 * last brick), return straight away asking the caller			 * to give up trying to move the ball: */			if(brick_collision(state, g)) return 2;			/* Unless the NoBounce cheat is active, bounce the			 * ball off the brick. Only do this on the first brick			 * collision we find. */			if(!state->flags.nb && !bc) {				bc = 1;				/* Bounce off the left face: */				if(state->ball.x + state->ball.s->w < g->x) {					state->ball.d = normalise_angle((2 *							M_PI) - state->ball.d);				/* Bounce off the right face: */				} else if(state->ball.x >= g->x +						state->brickwidth) {					state->ball.d = normalise_angle((2 *							M_PI) - state->ball.d);				/* Bounce off the upper face: */				} else if(state->ball.y + state->ball.s->h								< g->y) {					state->ball.d = normalise_angle(M_PI -								state->ball.d);				/* Bounce off the lower face: */				} else if(state->ball.y >= g->y +							state->brickheight) {					state->ball.d = normalise_angle(M_PI -								state->ball.d);				} else {					/* This shouldn't happen, but I don't					 * trust the above algorithm 100%. */					fprintf(stderr, "Internal error: "						"couldn't figure out brick "						"collision face\n");				}			}		}		g++; /* Increment to the next grid position. */	}	/* If a brick collision occured, ask the caller to try again: */	if(bc) return 1;	return 0; /* Otherwise tell the caller that no collision occured. */}/* Move the ball to from the position specified by state->ball.lx and * state->ball.ly to state->ball.x and state->ball.y, and update the relevant * area of the output window. */void move_ball(nbstate *state){	int x, w, y, h;	/* Check that the ball really has moved: */	if(state->ball.lx == state->ball.x && state->ball.ly == state->ball.y)		return;	/* Calculate the position and dimensions of the rectangle which	 * encloses both the old ball and the new ball so we know what area	 * to copy to the output window later. FIXME: this is quite inefficient	 * when doing stuff like parking the ball, where the old ball position	 * could be at the other side of the screen to the place we want to	 * move it to. It is however OK in the common case of only moving the	 * ball a few pixels at a time. */	if(state->ball.x < state->ball.lx) {		x = (int)state->ball.x;		w = state->ball.lx - x + state->ball.s->w;	} else {		x = state->ball.lx;		w = (int)state->ball.x - x + state->ball.s->w;	}	if(state->ball.y < state->ball.ly) {		y = (int)state->ball.y;		h = state->ball.ly - y + state->ball.s->h;	} else {		y = state->ball.ly;		h = (int)state->ball.y - y + state->ball.s->h;	}	/* Draw the background where the old ball image is to erase it: */	draw_background(state, state->ball.lx, state->ball.ly,			state->ball.s->w, state->ball.s->h);	/* Redraw any powers that are under that position: */	redraw_powers(state, state->ball.lx, state->ball.ly, state->ball.s->w,							state->ball.s->h);	/* Draw the ball in the new position and update ball.lx and ball.ly: */	draw_ball(state);	/* Draw the modified area of the canvas to the output window: */	draw_canvas(state, x, y, w, h);}/* Redraw the ball in its current position, including copying it to the output * window. */void redraw_ball(nbstate *state){	/* Erase the ball area to the background: */	draw_background(state, (int)state->ball.x, (int)state->ball.y,			state->ball.s->w, state->ball.s->h);	/* Redraw any powers we may have erased: */	redraw_powers(state, (int)state->ball.x, (int)state->ball.y,			state->ball.s->w, state->ball.s->h);	/* Redraw the ball: */	draw_ball(state);	/* Copy it to the output window: */	draw_canvas(state, state->ball.lx, state->ball.ly, state->ball.s->w,			state->ball.s->h);}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
亚洲成人av电影| 日本高清不卡aⅴ免费网站| 国产麻豆精品久久一二三| 中文字幕欧美一区| 麻豆成人综合网| 日韩高清不卡一区| 亚洲二区在线视频| 亚洲综合自拍偷拍| 亚洲精品中文在线| 亚洲午夜精品一区二区三区他趣| 777午夜精品视频在线播放| 欧美日韩一级二级三级| 亚洲国产va精品久久久不卡综合| 国产自产2019最新不卡| 日本一区二区三区在线观看| 97se亚洲国产综合在线| 亚洲第一福利视频在线| 欧美刺激脚交jootjob| 成人美女视频在线观看| 亚洲综合视频在线| 亚洲日本护士毛茸茸| 亚洲女人****多毛耸耸8| 天天av天天翘天天综合网色鬼国产| 在线免费观看不卡av| 欧美一级片在线看| 91亚洲精品久久久蜜桃| 国产电影精品久久禁18| 成人午夜精品在线| 五月婷婷久久丁香| 欧美做爰猛烈大尺度电影无法无天| 欧美一级午夜免费电影| 一卡二卡三卡日韩欧美| 国产乱理伦片在线观看夜一区| 一本大道久久a久久精品综合| 日韩精品影音先锋| 视频在线观看国产精品| 91丨porny丨国产入口| 久久综合久久综合久久| 国产乱码字幕精品高清av| 欧洲国内综合视频| 一区二区三区小说| a在线欧美一区| 国产日韩欧美一区二区三区乱码 | 丁香另类激情小说| 波多野结衣亚洲| 中文字幕精品一区二区三区精品| 国产在线精品国自产拍免费| 欧美群妇大交群中文字幕| 久久激情五月婷婷| 欧美日韩亚州综合| 一区二区三区电影在线播| 国产精品亚洲一区二区三区在线| 国产成人在线观看免费网站| 精品国产免费人成电影在线观看四季 | 一级日本不卡的影视| 色婷婷久久99综合精品jk白丝| 国产一区二区精品久久| 午夜国产精品影院在线观看| 国产一区二区三区| 爽好久久久欧美精品| 亚洲人精品午夜| 中文一区二区完整视频在线观看 | 欧美一区二区三区免费在线看| 国产传媒欧美日韩成人| 欧美一区二区三级| 成人毛片在线观看| 一区二区高清免费观看影视大全| 99re这里只有精品6| 亚洲欧美激情插| 国产欧美1区2区3区| 精品少妇一区二区三区在线视频 | 91年精品国产| 成人美女视频在线观看| 成人av在线网站| 国产**成人网毛片九色 | 日韩在线观看一区二区| 亚洲一区二区美女| 亚洲成人av福利| 日韩和欧美的一区| 九九精品一区二区| 激情综合网最新| 国产电影一区二区三区| 成人黄色a**站在线观看| 国产91精品露脸国语对白| 高清国产一区二区三区| 成年人国产精品| 色综合久久六月婷婷中文字幕| 91污在线观看| 欧美综合亚洲图片综合区| 欧美日韩免费观看一区二区三区| 欧美日韩情趣电影| 日韩欧美国产小视频| 久久久午夜精品理论片中文字幕| 精品美女一区二区| 国产精品青草久久| 亚洲欧美日韩一区| 亚洲超碰精品一区二区| 精品在线播放午夜| 成人激情电影免费在线观看| 色一区在线观看| 日韩一区二区三区三四区视频在线观看| 日韩一区二区在线观看| 久久久久久久久久电影| 亚洲综合色区另类av| 日本午夜一本久久久综合| 国产成人精品亚洲日本在线桃色| 99免费精品视频| 8x福利精品第一导航| 久久久蜜桃精品| 伊人色综合久久天天人手人婷| 青椒成人免费视频| 北岛玲一区二区三区四区| 欧美三级韩国三级日本一级| 日韩精品中文字幕一区二区三区| 欧美高清在线视频| 天堂蜜桃91精品| 国产+成+人+亚洲欧洲自线| 欧美性视频一区二区三区| 久久色.com| 亚洲第一电影网| 成人网页在线观看| 欧美精品免费视频| 成人欧美一区二区三区在线播放| 日本中文在线一区| 99久久精品99国产精品| 欧美一区二区三区在| 亚洲婷婷国产精品电影人久久| 蜜臀av在线播放一区二区三区| 99精品国产99久久久久久白柏| 日韩欧美一卡二卡| 一区二区不卡在线播放| 成人免费毛片嘿嘿连载视频| 91精品国产综合久久久久久久久久| 国产精品久久久久久户外露出| 毛片av中文字幕一区二区| 一本大道久久a久久精品综合| 久久天堂av综合合色蜜桃网| 男男成人高潮片免费网站| 色综合视频在线观看| 久久久777精品电影网影网| 午夜久久久久久| 91碰在线视频| 国产精品美女久久久久aⅴ | 国产欧美一区二区在线| 日韩精品亚洲一区| 欧美亚洲另类激情小说| 国产精品人人做人人爽人人添| 久久精品噜噜噜成人88aⅴ| 欧美亚州韩日在线看免费版国语版 | 成人网在线播放| 久久免费午夜影院| 老司机精品视频导航| 欧美欧美欧美欧美| 天天亚洲美女在线视频| 在线观看一区二区视频| 亚洲欧美日韩国产手机在线 | 日本人妖一区二区| 欧美三级电影在线观看| 亚洲精品网站在线观看| 91麻豆国产在线观看| 国产精品视频麻豆| 成人深夜在线观看| 国产欧美va欧美不卡在线| 国产91精品露脸国语对白| 久久精品一区二区三区四区| 国产综合久久久久影院| 久久青草欧美一区二区三区| 久久激五月天综合精品| xnxx国产精品| 国产精品一区二区视频| 国产亚洲成aⅴ人片在线观看| 精品一区二区国语对白| 久久九九久精品国产免费直播| 极品少妇xxxx偷拍精品少妇| 久久人人爽爽爽人久久久| 国产精品99久久久久久久vr| 国产精品嫩草影院com| 99re这里只有精品6| 亚洲va韩国va欧美va精品| 欧美一区二区久久| 韩国毛片一区二区三区| 欧美国产日韩一二三区| 不卡一区中文字幕| 亚洲一二三四区| 69久久99精品久久久久婷婷 | 国产精品午夜在线| 日本电影亚洲天堂一区| 亚洲444eee在线观看| 欧美成人精品福利| 成熟亚洲日本毛茸茸凸凹| 中文字幕一区二区三区视频| 色哟哟一区二区在线观看| 婷婷一区二区三区| 久久五月婷婷丁香社区| 91伊人久久大香线蕉| 日韩二区三区在线观看| 国产欧美日韩三级| 欧美日韩在线播| 国产一区二区三区免费在线观看| 亚洲欧洲韩国日本视频|