This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Matrix radarTrans = Matrix.CreateScale(0.04f); | |
Matrix radarScreenTrans = Matrix.CreateScale(0.3f); | |
//draw radar background | |
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, radarScreenTrans); | |
spriteBatch.Draw(radar, Vector2.Zero, Color.White); | |
spriteBatch.End(); | |
//draw world entities | |
spriteBatch.Begin(SpriteSortMode.Immediate, null, null, null, null, null, radarTrans); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//creat a list of sprite objects | |
List<Sprite> sprites=new List<Sprite>(); | |
... | |
//populate a list of sprite objects | |
for (int i = 0; i < 50; i++) | |
{ | |
Sprite s = new Sprite(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "FModManager.h" | |
FMOD::System *FModManager::system=0; | |
FMOD::System* FModManager::System(){ | |
if(!system){ | |
FMOD_RESULT result; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#version 120 | |
void main(void) { | |
gl_FragColor= vec4(1.0,1.0,1.0,1.0); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sf::Shader shader; //cretae an SFML shader object | |
//load, compile, link shader code | |
if(!shader.loadFromFile("vertex.glsl","fragment.glsl")){ | |
exit(1); //error has occured | |
} | |
sf::Shader::bind(&shader); //select this shader for use in the pipeline |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void MyTorus(float u,float v,GLfloat fv[]){ | |
const float TWO_PI= 3.141f*2; | |
float r=0.4f; | |
float R=1.3f; | |
float x_u=r*(float)cos(TWO_PI*u)+R; | |
fv[0]=x_u*(float)cos(TWO_PI*v); //x-coordinate | |
fv[1]=r*(float)sin(TWO_PI*u); //y-coordinate | |
fv[2]=x_u*(float)sin(TWO_PI*v); //z-coordinate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public override void Draw(GameTime gametime, Camera camera) | |
{ | |
Matrix orientation = Matrix.CreateFromYawPitchRoll(yawAngle, 0, 0); | |
Matrix world = orientation * Matrix.CreateTranslation(position); | |
foreach (ModelMesh m in model.Meshes) | |
{ | |
foreach (BasicEffect e in m.Effects) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void Draw(GameTime gameTime) | |
{ | |
GraphicsDevice.Clear(Color.CornflowerBlue); | |
// TODO: Add your drawing code here | |
rotation -= 0.03f; | |
Vector2 origin = new Vector2(invader.Width / 2, invader.Height / 2); | |
//spin in place |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if(max1<min2 || max2 <min1) //check for gap | |
return true;// true=no overlap |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FPS | |
{ | |
public: | |
/// @brief Constructor with initialization. | |
/// | |
FPS() : mFrame(0), mFps(0) {} | |
/// @brief Update the frame count. | |
/// |