Skip to content

Commit

Permalink
Rewriting of the "Text Display" to demonstrate some of the new features
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexisDrogoul committed Jun 20, 2021
1 parent 4115400 commit f9215c2
Showing 1 changed file with 18 additions and 33 deletions.
Expand Up @@ -9,60 +9,45 @@ model TextDisplay
global {}

experiment Strings {
list<font> fonts <- [font("Helvetica", 36, #plain),font("Times", 24, #plain) ,font("Courier", 30, #plain), font("Arial", 18, #bold),font("Times", 24, #bold+#italic) ,font("Courier", 18, #plain)];

list<font> fonts <- [font("Helvetica", 48, #plain),font("Times", 36, #plain) ,font("Courier", 40, #plain), font("Arial", 24, #bold),font("Times", 36, #bold+#italic) ,font("Courier", 32, #plain)];
map<string, point> anchors <- ["center"::#center, "top_left"::#top_left, "left_center"::#left_center, "bottom_left"::#bottom_left, "bottom_center"::#bottom_center, "bottom_right"::#bottom_right, "right_center"::#right_center, "top_right"::#top_right, "top_center"::#top_center];
font currentFont <- one_of(fonts) update: one_of(fonts);
rgb currentColor <- rnd_color(255) update: rnd_color(255);
float currentDepth <- rnd(8) - 4.0;

font current_font <- one_of(fonts) update: one_of(fonts);
rgb current_color <- rnd_color(255) update: rnd_color(255);
float current_depth <- rnd(16) - 8.0 update: rnd(16) - 8.0;
int y_step <- 5;
image_file g <- image_file("3D Visualization/images/building_texture/texture3.jpg");


output {
layout #split;
display "With antialias" type: opengl antialias: true synchronized: true {
display "With antialias" type: opengl antialias: true synchronized: true draw_env: false show_fps: true {
graphics Strings {
draw world.shape wireframe: true color: #black;
int y <- 5;
float precision <- 0.01;
loop p over: anchors.pairs {
loop p over: anchors.pairs {
draw circle(0.5) at: {50, y} color: #red;
draw p.key + " precision " + precision at: {50, y} anchor: p.value color: currentColor font: currentFont depth: currentDepth precision: precision ;
y <- y + 5;
draw p.key + " ABCDEFGHIJKLMNOPQRSTUVWXYZ 1234567890 " at: {50, y} anchor: p.value color: rnd_color(255) font: current_font depth: 8 precision: precision ;
y <- y + y_step;
precision <- precision * 2;
}

draw circle(0.5) at: {50, y} color: #green;
draw "custom {0.6, 0.1} wireframe" at: {50, y} anchor: {0.6, 0.1} border: currentColor font: currentFont wireframe: true width: 1;
draw "custom {0.6, 0.1} wireframe" at: {50, y} anchor: {0.6, 0.1} border: current_color font: one_of(fonts) wireframe: true width: 2;
draw circle(0.5) at: {50, y + 5} color: #red;
draw "custom {0.2, 0.2} with border" at: {50, y + 5} anchor: {0.2, 0.2} color: currentColor font: currentFont depth: 3 border: currentColor.darker.darker width: 3;
draw "custom {0.2, 0.2} with border" at: {50, y + y_step} anchor: {0.2, 0.2} color: current_color depth: 3 border: rnd_color(255) width: 2;
draw circle(0.5) at: {50, y + 10} color: #red;
draw "custom {0.8, 0.8} with texture" at: {50, y + 2*y_step} anchor: {0.8, 0.8} font: one_of(fonts) depth: 8 texture: g ;
draw circle(0.5) at: {50, y + 10} color: #red;
draw "custom {0.8, 0.8} with texture" at: {50, y + 10} anchor: {0.8, 0.8} font: currentFont depth: 8 texture: g ;
draw "custom {0.8, 0.8} 3D Wireframe" at: {50, y + 3*y_step} anchor: {0.8, 0.8} font: current_font depth: 8 wireframe: true ;
draw circle(0.5) at: {50, y + 15} color: #red;
draw "custom {0.4, 0.1} Flat with border" at: {50, y + 4*y_step} anchor: {0.4, 0.1} font: one_of(fonts) border: #black ;
}

}

display "Without antialias" parent: "With antialias" antialias: false {}

// display "Strings Java2D" type: java2D {
// graphics Strings {
// draw world.shape wireframe: true color: #black;
// int y <- 5;
// loop p over: anchors.pairs {
// draw circle(0.5) at: {50, y} color: #red;
// draw p.key at: {50, y} anchor: p.value color: #black font: my_font;
// y <- y + 5;
// }
//
// draw circle(0.5) at: {50, y} color: #red;
// draw "custom {0.6, 0.1}" at: {50, y} anchor: {0.6, 0.1} color: #black font: my_font;
// draw circle(0.5) at: {50, y + 5} color: #red;
// draw "custom {0.2, 0.2}" at: {50, y + 5} anchor: {0.2, 0.2} color: #black font: my_font;
// draw circle(0.5) at: {50, y + 10} color: #red;
// draw "custom {0.8, 0.8}" at: {50, y + 10} anchor: {0.8, 0.8} color: #black font: my_font;
// }
//
// }
//display "Without antialias" parent: "With antialias" antialias: false {}

}

Expand Down

0 comments on commit f9215c2

Please sign in to comment.