Skip to content

Commit

Permalink
lab02: draw text to screen in drawing program
Browse files Browse the repository at this point in the history
  • Loading branch information
adammw committed Aug 9, 2012
1 parent 8b6a872 commit 046b6bc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
16 changes: 16 additions & 0 deletions lab02/core_exercises/drawing/src/DrawingController.cpp
Expand Up @@ -23,6 +23,22 @@ void DrawingController::set_controlling(Drawing* drawing) {

void DrawingController::draw() {
_controlling->draw();

const char * text;
switch(_adding){
case DRAWING_ELEMENT_RECTANGLE:
text = "Drawing Rectangles";
break;
case DRAWING_ELEMENT_LINE:
text = "Drawing Lines";
break;
case DRAWING_ELEMENT_ELLIPSE:
text = "Drawing Ellipses";
break;
default:
text = "Drawing Unknown Shape";
}
draw_text_lines_with_font_named(text, color_black, color_transparent, "mavenpro", ALIGN_LEFT, 10, screen_height() - 26, screen_width() - 20, 16);
}

void DrawingController::handle_input() {
Expand Down
2 changes: 2 additions & 0 deletions lab02/core_exercises/drawing/src/main.cpp
Expand Up @@ -25,6 +25,8 @@ int main() {
open_audio();
open_graphics_window("Drawing", 800, 600);
load_default_colors();
load_font_named("mavenpro","maven_pro_regular.ttf",16);


Drawing* drawing = new Drawing();
DrawingController *controller = new DrawingController(drawing);
Expand Down

0 comments on commit 046b6bc

Please sign in to comment.