/ld20

To get this branch, use:
bzr branch http://9ix.org/bzr/ld20

« back to all changes in this revision

Viewing changes to Flock.cpp

  • Committer: Josh C
  • Date: 2011-05-01 23:36:09 UTC
  • Revision ID: josh@9ix.org-20110501233609-vmi3y8e2pb058c8k
instructions

Show diffs side-by-side

added added

removed removed

Lines of Context:
194
194
              velocity = -to_wolf;
195
195
              velocity.Normalize();
196
196
              velocity *= WOLFSPEED;
 
197
 
 
198
              scale.x = SIGN(velocity.x, 1);
197
199
            }
198
200
        }
199
201
 
387
389
  {
388
390
    Scene::Begin();
389
391
 
390
 
    //Graphics::SetBackgroundColor(Color::green * 0.2f);
 
392
    Text *inst1 = new Text("Use arrow keys to move");
 
393
    inst1->position = Vector2(-380, -270);
 
394
    Add(inst1);
 
395
 
 
396
    Text *inst2 = new Text("Press ESC to quit");
 
397
    inst2->position = Vector2(-380, -250);
 
398
    Add(inst2);
391
399
 
392
400
    Input::DefineMaskKey("left", KEY_LEFT);
393
401
    Input::DefineMaskKey("right", KEY_RIGHT);
573
581
      }
574
582
 
575
583
 
 
584
  }// FlockScene::Update
 
585
 
 
586
  Text::Text(const std::string& text, FontAsset* font)
 
587
    : Entity(), text(text)
 
588
  {
 
589
    if (font == NULL)
 
590
      this->font = Assets::RequestFont("LiberationSans-Regular.ttf", 18.0f);
 
591
    else
 
592
      this->font = font;
 
593
  }
 
594
 
 
595
  void Text::Render()
 
596
  {
 
597
    Graphics::PushMatrix();
 
598
 
 
599
    // place text directly relative to camera
 
600
    Graphics::Translate(scene->GetCamera()->position + position);
 
601
 
 
602
    Graphics::SetBlend(BLEND_ALPHA);
 
603
    Graphics::SetColor(Color::white);
 
604
    Graphics::BindFont(font);
 
605
    
 
606
    Graphics::RenderText(*font, text, 0, 0);
 
607
    Graphics::PopMatrix();
576
608
  }
577
609
 
578
610
}