CL_Surface *sur_logo = CL_TargaProvider::create("logo.tga", NULL) sin_count = 0.0 ypos = 0.0 ydir = 3.0 # Run until someone presses escape while (!CL_Keyboard::get_keycode(CL_KEY_ESCAPE)) { # Clear the display in a dark blue nuance # The four arguments are red, green, blue and alpha # All color nuances in ClanLib are measured in the interval 0.1 Display::clear_display(0, 0, 0.2f, 1.0f) ypos += ydir if (ypos+200 >= Display::get_height() || ypos < 0) { ydir *= -1 } Display::draw_line(0, ypos-1, Display::get_width(), ypos-1, 1, 0, 0) Display::draw_line(0, ypos+198, Display::get_width(), ypos+198, 1, 0, 0) # Show the logo surface. # Use the get_width() and get_height() functions of both # Display and CL_Surface, to show the surface in the bottom right corner sur_logo.put_screen( Display::get_width()-sur_logo.get_width(), Display::get_height()-sur_logo.get_height()) Display::push_clip_rect( ClipRect.new(0, ypos, Display::get_width(), ypos+198)) # Draw a rectangle in the center of the screen # going from (240, 140) . (440, 340) _not_ including the # pixels in the right-most column and bottom-most row (440, 340) Display::fill_rect(240, 140, 440, 340, 1.0f, 1.0f, 1.0f, 1.0f) # Frame the rectangle with red lines Display::draw_line(240, 140, 440, 140, 1.0, 0, 0) Display::draw_line(240, 340, 440, 340, 1.0, 0, 0) Display::draw_line(240, 140, 240, 340, 1.0, 0, 0) Display::draw_line(440, 140, 440, 340, 1.0, 0, 0) # Show a few alpha-blending moving rectangles that moves in circles float x = cos(sin_count)*120 float y = sin(sin_count)*120 sin_count += 0.05 Display::fill_rect(320+x-30, 240+y-30, 320+x+30, 240+y+30, 0, 1, 0, 0.5) x = cos(sin_count+3.14159)*120 y = sin(sin_count+3.14159)*120 Display::fill_rect(320+x-30,240+y-30,320+x+30,240+y+30, 1, 1, 0, 0.5) Display::pop_clip_rect() # Flip the display, showing on the screen what we have drawed # since last call to flip_display() Display::flip_display() # This call updates input and performs other "housekeeping" # call this each frame CL_System::keep_alive()