-- EWS (Eiffel Windowing System) - A small OO windowing system -- Copyright (C) 2004 Daniel F. Moisset, Anthony Lenton -- -- This library is free software; you can redistribute it and/or -- modify it under the terms of the GNU Library General Public -- License as published by the Free Software Foundation; either -- version 2 of the License, or (at your option) any later version. -- -- This library is distributed in the hope that it will be useful, -- but WITHOUT ANY WARRANTY; without even the implied warranty of -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -- Library General Public License for more details. -- -- You should have received a copy of the GNU Library General Public -- License along with this library; if not, write to the -- Free Software Foundation, Inc., 59 Temple Place - Suite 330, -- Boston, MA 02111-1307 USA. -- -- Author's email: dmoisset@grulic.org.ar -- Snail mail address: Pirovano 196, 5000 Cordoba, Argentina -- class FONT_TEST inherit TEXT_CONSTANTS create make feature {NONE} -- Creation d: SDL_DISPLAY c: MOUSE_POINTER new_img (fn: STRING): IMAGE is do create {SDL_IMAGE}Result.make_from_file (fn) end make is local font2: FONT rect: RECTANGLE label: LABEL multi: MULTILINE_LABEL w1: WINDOW_IMAGE marq: HORZ_MARQUEE do -- Init video create {SDL_DISPLAY}d.make (640,480, 16, false) -- Raw Writing - d.set_default_font (create {SDL_BITMAP_FONT}.make ("small_font.png")) create {SDL_BITMAP_FONT}font2.make ("white_font.png") -- Labels rect.set_with_size(5, 420, 190, 50) create label.make(d.root, rect, "Hi! I'm a label") label.set_bg (create {SDL_SOLID_IMAGE}.make (label.width, label.height, 30, 40, 50)) rect.set_with_size(200, 420, 235, 50) create label.make(d.root, rect, "I'm right-bottom aligned with a border") label.set_bg (create {SDL_SOLID_IMAGE}.make (label.width, label.height, 30, 90, 100)) label.set_h_alignment (horz_align_right) label.set_v_alignment (vert_align_bottom) label.set_border_width (4) rect.set_with_size(445, 420, 190, 50) create label.make(d.root, rect, "My own font") label.set_bg (create {SDL_SOLID_IMAGE}.make (label.width, label.height, 100, 200, 50)) label.set_font (font2) rect.set_with_size(480, 390, 40, 20) create label.make(d.root, rect, "I'm too big for my boots") label.set_bg (create {SDL_SOLID_IMAGE}.make (label.width, label.height, 80, 80, 80)) -- Multiline label rect.set_with_size (20, 20, 100, 120) create multi.make (d.root, rect, "This is a very long text that must be splitted over several lines to be displayed.%NLuckily, we have a multiline label to do that") multi.set_h_alignment (0.5) -- Rectangles (background for the marquee too) create w1.make (d.root, 300, 200, create {SDL_SOLID_IMAGE}.make (100, 100, 200,0,0)) create w1.make (d.root, 400, 200, create {SDL_SOLID_IMAGE}.make (150, 100, 0,0,200)) -- Marquee rect.set_with_size(350, 250, 150, 20) create marq.make(d.root, rect, "Hello. I am a Horizontal Marquee. Horizontal Marquees make your life easier allowing you to show extremely long texts in drastically short spaces, with almost no effort. Make you life easier today. Enjoy your own Horizontal Marquee.") -- Make pointer create c.make (new_img ("cursor1.png"), 6, 4) -- Set Pointer d.root.set_pointer (c) -- Main loop d.set_timer_interval (100) d.do_event_loop d.close end end -- class FONT_TEST