资源简介
好不容易搜寻到,多多共享。使用OPengl 包含物理引擎
代码片段和文件信息
/*
* asteroids.cpp
* Asteroidsbase
*
* Created by Andrew Hogue on 23/10/08.
* Copyright 2008 UOIT. All rights reserved.
*
*/
#include “asteroids.h“
GameState_t GameState;
/************************************
* INITIALIZATION FUNCTIONS
************************************/
/*
* ASTEROIDS_initialize(widthheight)
* - main initialization function
* - this is called once before anything else should load init all sprites
*/
void ASTEROIDS_initialize(int winWidth int winHeight)
{
/* init physics engine */
Physics_init(&GameState.physicsEngine PHYSICS_DRAG_FACTOR 70.f 200.f);
Physics_initShip(&GameState.physicsEngine SHIP_MASS);
/* init basic game stuff */
GameState.win.width = winWidth;
GameState.win.height = winHeight;
GameState.numShots = 0;
GameState.winner = false;
GameState.shouldStartGame = true;
/* load the game sprites */
ASTEROIDS_initializeGameSprites();
/* load/init the gui/hud */
ASTEROIDS_initHUD();
/* init/load the explosion animation */
ASTEROIDS_initExplosions();
}
/*
* ASTEROIDS_initHUD()
* - initialize the gui and hud scoreboard
*/
void ASTEROIDS_initHUD()
{
/* load main screen & game over screen */
GameState.MainScreen = newSprite(“./images/menu1.jpg“
GameState.win.widthGameState.win.height
BACKGROUND_layer
POSITION(000) DIRECTION(000)
ANGLE_RADIANS(0) layerID(0) IS_ANIMATED(false) IS_ACTIVE(true));
GameState.GameOverScreen = newSprite(“./images/gameover.jpg“
GameState.win.widthGameState.win.height
BACKGROUND_layer
POSITION(000) DIRECTION(000)
ANGLE_RADIANS(0) layerID(0) IS_ANIMATED(false) IS_ACTIVE(true));
/* create the font for text drawing */
GameState.gui.f.open(FONT_NAMEFONT_SIZE);
/* create the number of ships indicator */
float x = GameState.win.width - MAX_LIVES*GameState.ship->width;
float y = GameState.win.height - GameState.ship->height;
for(int i=0;i {
GameState.gui.ships[i] = newSpriteFromCopy(GameState.ship);
GameState.gui.ships[i]->isActive = true;
vector3_set(&GameState.gui.ships[i]->positionxy0);
x += GameState.ship->width;
GameState.gui.sprites.push_back(GameState.gui.ships[i]);
}
/* create the energy level indicator */
GameState.gui.spriteEnergy = newSprite(“./images/energy.gif“
40020 GUI_ENERGY
POSITION(2005800) DIRECTION(010)
ANGLE_RADIANS(0) layerID(50) IS_ANIMATED(true) IS_ACTIVE(true));
GameState.gui.sprites.push_back(GameState.gui.spriteEnergy);
}
/*
* ASTEROIDS_initExplosions()
* - load/init explosion animations
*/
void ASTEROIDS_initExplosions()
{
sprite_t *exp = newSprite(“./images/exp2.png“
6464 EXPLOSIONS
POSITION(1003000) DIRECTION(010)
ANGLE_RADIANS(0) layerID(500) IS_ANIMATED(false) IS_ACTIVE(false));
sprite_addAnimationSquare(exp44);
exp->curren
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2008-12-03 22:16 INFR2310 Assignment 3\
目录 0 2008-12-03 22:17 INFR2310 Assignment 3\debug\
文件 23040 2008-10-14 09:33 INFR2310 Assignment 3\INFR2310 Assignment 1.suo
文件 17408 2008-10-15 09:04 INFR2310 Assignment 3\INFR2310 Assignment 2.suo
文件 897 2007-09-14 11:11 INFR2310 Assignment 3\INFR2310 Assignment 3.sln
文件 87040 2008-12-03 22:16 INFR2310 Assignment 3\INFR2310 Assignment 3.suo
目录 0 2008-12-03 22:16 INFR2310 Assignment 3\opengltest\
文件 18349 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\asteroids.cpp
文件 5028 2008-12-03 21:21 INFR2310 Assignment 3\opengltest\asteroids.h
文件 5845 2008-12-03 22:03 INFR2310 Assignment 3\opengltest\asteroidsCollision.cpp
文件 766 2008-12-03 22:02 INFR2310 Assignment 3\opengltest\asteroidsCollision.h
文件 3927 2008-12-03 21:26 INFR2310 Assignment 3\opengltest\asteroidsDrawing.cpp
文件 492 2008-10-27 21:32 INFR2310 Assignment 3\opengltest\asteroidsDrawing.h
文件 5472 2008-12-03 16:30 INFR2310 Assignment 3\opengltest\asteroidsInputControl.cpp
文件 1179 2008-11-30 22:27 INFR2310 Assignment 3\opengltest\asteroidsInputControl.h
文件 7526 2008-12-03 21:42 INFR2310 Assignment 3\opengltest\asteroidsUtility.cpp
文件 1020 2008-11-30 21:35 INFR2310 Assignment 3\opengltest\asteroidsUtility.h
目录 0 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\Debug\
文件 405 2008-11-30 16:42 INFR2310 Assignment 3\opengltest\Debug\Asteroids.exe.em
文件 472 2008-11-30 16:42 INFR2310 Assignment 3\opengltest\Debug\Asteroids.exe.em
文件 387 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\Debug\Asteroids.exe.intermediate.manifest
文件 252291 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\Debug\asteroids.obj
文件 57047 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\Debug\asteroidsCollision.obj
文件 209610 2008-12-03 22:03 INFR2310 Assignment 3\opengltest\Debug\asteroidsDrawing.obj
文件 59072 2008-12-03 22:03 INFR2310 Assignment 3\opengltest\Debug\asteroidsInputControl.obj
文件 230087 2008-12-03 22:03 INFR2310 Assignment 3\opengltest\Debug\asteroidsUtility.obj
文件 10700 2008-12-03 22:14 INFR2310 Assignment 3\opengltest\Debug\BuildLog.htm
文件 224880 2008-11-30 16:42 INFR2310 Assignment 3\opengltest\Debug\GLFT_Font.obj
文件 167985 2008-11-30 16:42 INFR2310 Assignment 3\opengltest\Debug\Keyfr
文件 405 2008-10-14 09:35 INFR2310 Assignment 3\opengltest\Debug\Keyfr
文件 472 2008-10-14 09:35 INFR2310 Assignment 3\opengltest\Debug\Keyfr
............此处省略142个文件信息
- 上一篇:MFC简易计算器含加减乘除,平方,立方,开方,三角函数
- 下一篇:GUN C库手册
评论
共有 条评论