home *** CD-ROM | disk | FTP | other *** search
Wrap
{-----------------------------FEATURES.ORL------------------------------ This program displays many of Oriel's features using simple routines. For example, there's a routine to move a bitmap across the screen and another to display different types of message boxes. -----------------------------------------------------------------------} {Set variable} Set Delay = 2000 {Maximize the window and set the caption} SetWindow(MAXIMIZE) UseCaption("Oriel Features") {Set up the window text} Set_Text: UseBackground(TRANSPARENT,255,255,128) DrawBackground UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0) DrawText(76,5,"Oriel") UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0) DrawText(75,5,"Oriel") DrawBitmap(115,7,"ORIELIC3.BMP") UseFont("Tms Rmn",0,10,BOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(35,30,"The Graphics-Based Batch Language") DrawText(92,45,"for") DrawText(60,60,"Microsoft Windows 3.0") UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,255) DrawText(55,80,"Select a Menu Option") DrawText(35,95,"to Explore the Power of Oriel!") {Set up the menu} Menu: Gosub Menu_Init {Establish default environment} SetMenu("&Features",IGNORE, "&Bitmaps",Bitmap, "&Color, Brush, Font",Shape, "&Flood an Area",Flood_Area, "&Keyboard/Mouse Control",Mouse_Control, "&Messages",Msg, "&Read Mouse Coordinates",Read_Mouse, "&Animation",Animate, ENDPOPUP, "&Exit!",Bye, ENDPOPUP) Wait_for_Input: WaitInput() {Bitmaps} Bitmap: SetMenu() {Reset the menu} UseBackground(TRANSPARENT,0,255,128) DrawBackground UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0) DrawText(76,5,"Oriel") UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0) DrawText(75,5,"Oriel") DrawBitmap(115,9,"ORIELIC4.BMP") UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0) UseBackground(TRANSPARENT,0,255,128) DrawText(30,30,"allows you to load and size") DrawText(30,40,"Windows bitmap (.BMP) files,") DrawText(30,50,"like this Oriel bitmap...") DrawBitmap(1,90,"ORIELIC4.BMP") WaitInput(Delay) Set DrawFactor = 20 Set DrawCol = 10 Set DrawEndCol = DrawCol + DrawFactor Set DrawRow = 85 Set DrawEndRow = DrawRow + DrawFactor Size_It: DrawSizedBitmap(DrawCol,DrawRow,DrawEndCol,DrawEndRow, "ORIELIC4.BMP") WaitInput(Delay) Set DrawFactor = DrawFactor + 10 Set DrawRow = DrawRow - 5 Set DrawCol = DrawEndCol Set DrawEndCol = DrawCol + DrawFactor Set DrawEndRow = DrawRow + DrawFactor If DrawFactor > 60 Then Goto End_Draw Goto Size_It End_Draw: SetKeyboard("C",Set_Text, "c",Set_Text, 13,Set_Text) UsePen(SOLID,1,0,0,0) DrawRoundRectangle(80,125,120,140,2,2) SetMouse(80,125,120,140,Set_Text,TEMP,TEMP) UseFont("SYSTEM",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0) DrawText(89,130,"C") UseFont("SYSTEM",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(92,130,"ontinue") WaitInput() {Color, Brush, Font} Shape: SetMenu() UseBackground(TRANSPARENT,0,255,128) DrawBackground UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0) DrawText(76,5,"Oriel") UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0) DrawText(75,5,"Oriel") DrawBitmap(115,9,"ORIELIC4.BMP") UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0) UseBackground(TRANSPARENT,0,255,128) DrawText(20,25,"draws a variety of graphic images.") DrawText(20,45,"As this demonstration shows, you can") DrawText(20,57,"control the background color, the") DrawText(20,69,"brush color and fill pattern, the") DrawText(20,81,"line pattern and color, as well as") DrawText(20,93,"the font style and color...") WaitInput(6000) SetWaitMode(FOCUS) Run("ORIEL COLBRFONT.ORL") WaitInput(1) Goto Set_Text {Flood an Area} Flood_Area: UseBackground(OPAQUE,255,255,255) {White background} DrawBackground {Set up the menu, mouse, and shapes} Flood_Menu: Setmenu("&Brush Color",IGNORE, "&White", Brush_White, "&Gray", Brush_Gray, "&Red", Brush_Red, "&Yellow", Brush_Yel, "Gree&n", Brush_Grn, "&Light Blue", Brush_Ltblu, "&Blue", Brush_Blue, "&Pink", Brush_Pink, "Blac&k", Brush_Black, ENDPOPUP, "&Exit!", Flood_Bye, ENDPOPUP) SetMouse(0,0,10000,10000,Mouse_Hit,Mouse_x,Mouse_y) {Draw random shapes for flooding} UseFont("System",0,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(5,5,"Click within an area to fill it with the selected color") UseCoordinates(METRIC) UseBrush(NULL,0,0,0) UsePen(SOLID,3,0,0,0) DrawRectangle(0,15,1000,1000) DrawEllipse(10,20,90,100) DrawEllipse(34,20,118,95) DrawEllipse(30,30,150,150) DrawEllipse(140,50,180,200) DrawEllipse(90,110,130,300) DrawRectangle(20,40,50,150) DrawRectangle(70,20,180,150) DrawRoundRectangle(80,70,120,120,10,10) UseCoordinates(PIXEL) UseBrush(SOLID,255,0,0) {Start with red brush} Wait_for_hit: WaitInput() Mouse_Hit: DrawFlood(Mouse_x,Mouse_y,0,0,0) Goto Wait_for_Hit Brush_White: UseBrush(SOLID,255,255,255) Goto Wait_for_Hit Brush_Gray: UseBrush(SOLID,192,192,192) Goto Wait_for_Hit Brush_Red: UseBrush(SOLID,255,0,0) Goto Wait_for_Hit Brush_Yel: UseBrush(SOLID,255,255,0) Goto Wait_for_Hit Brush_Grn: UseBrush(SOLID,0,255,0) Goto Wait_for_Hit Brush_Ltblu: UseBrush(SOLID,0,255,255) Goto Wait_for_Hit Brush_Blue: UseBrush(SOLID,0,0,255) Goto Wait_for_Hit Brush_Pink: UseBrush(SOLID,255,0,255) Goto Wait_for_Hit Brush_Black: UseBrush(SOLID,0,0,0) Goto Wait_for_Hit Flood_Bye: SetMouse() SetKeyboard() UseCoordinates(METRIC) UseBrush(SOLID,255,255,255) UsePen(SOLID,1,0,0,0) Goto Set_Text {Keyboard/Mouse Control} Mouse_Control: {Initialize variables} Set x1=10 Set x2=25 Set Red=127 Set Green=63 Set Blue=63 Set Rate=200 Set Display_secs=2 SetMenu() SetMouse() UseBackground(TRANSPARENT,255,255,255) DrawBackground UseBrush(SOLID,192,192,192) UsePen(SOLID,1,0,0,0) DrawRoundRectangle(88,50,114,60,2,2) DrawRoundRectangle(88,100,114,110,2,2) UseBrush(SOLID,255,255,255) DrawRectangle(90,75,102,83) UseFont("System",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0) DrawText(93,52,"F") UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(96,52,"aster") DrawNumber(92,76,Display_secs) DrawText(103,76,"seconds") UseFont("System",0,0,NOBOLD,NOITALIC,UNDERLINE,0,0,0) DrawText(93,102,"S") UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(96,102,"lower") UseBackground(OPAQUE,255,255,255) UsePen(NULL,1,0,0,0) {Setup the menu, mouse, and keyboard} SetMenu("&Exit!",Leave_it, ENDPOPUP) SetMouse(88,50,114,60,Faster,Temp,Temp, 88,100,114,110,Slower,Temp,Temp) SetKeyboard("F",Faster, "f",Faster, "S",Slower, "s",Slower) Wait: WaitInput(Rate) Past_Wait: UseBrush(SOLID,Red,Green,Blue) If x1>145 Then Set x1=10 | Set x2=25 | Goto Past_Wait Set x1=x1+15 Set x2=x1+15 DrawRectangle(x1,10,x2,25) Set Red=Red+64 If Red<=255 Then Goto Wait Set Red=63 Set Green=Green+64 If Green<=255 Then Goto Wait Set Green=63 Set Blue=Blue+64 If Blue<=255 Then Goto Wait Set Blue=63 Goto Wait Faster: If Display_secs = 1 Then Beep | Goto Wait Set Display_secs=Display_secs-1 If Display_secs <> 9 Then Goto Draw_No UseBrush(SOLID,255,255,255) DrawRectangle(91,76,101,81) Goto Draw_No Slower: If Display_secs = 10 Then Beep | Goto Wait Set Display_secs=Display_secs+1 Draw_No: DrawNumber(92,76,Display_secs) Set Rate=Display_secs*100 Goto Wait Leave_it: UsePen(SOLID,1,0,0,0) Goto Set_Text {Messages} Msg: SetMenu() UseBackground(TRANSPARENT,255,0,255) DrawBackground UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,64,0,0) DrawText(76,5,"Oriel") UseFont("Roman",0,20,BOLD,NOITALIC,NOUNDERLINE,255,0,0) DrawText(75,5,"Oriel") DrawBitmap(115,9,"ORIELIC5.BMP") UseFont("Tms Rmn",0,12,BOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(30,25,"allows you to create a variety") DrawText(30,35,"of Windows message boxes...") WaitInput(4000) MessageBox(OK,1,INFORMATION,"Oriel allows you to create informational messages, like this one...","F.Y.I.",null_var) MessageBox(OK,1,EXCLAMATION,"Or you can be more emphatic about sharing information...","This is exciting!",null_var) MessageBox(OKCANCEL,1,STOP,"Sometimes, you may need to be the bearer of bad tidings...","You cannot do this!",Resp1) If Resp1 = 2 Then MessageBox(OK,1,INFORMATION,"Although Oriel will permit you to cancel the program, we'll continue with our demonstration...","",Null_var) MessageBox(YESNOCANCEL,1,QUESTION,"And perhaps you may want to ask a question or two?","We await your response...",Resp2) If Resp2 = 1 Then MessageBox(OK,1,EXCLAMATION,"So you can appreciate the value of Oriel!","Thanks for your response!",Null_var) If Resp2 = 2 Then MessageBox(OK,1,EXCLAMATION,"But the ability to get user input is very, very important...","",Null_var) If Resp2 = 3 Then MessageBox(OK,1,EXCLAMATION,"You've selected CANCEL, but we would like to continue with our demonstration anyway...","Cancel?",Null_var) Goto Set_Text {Read Mouse Coordinates} Read_Mouse: SetMenu() UseBackground(TRANSPARENT,255,255,255) DrawBackground {Set up the mouse hit testing area and where to branch on a click} SetMenu("&Exit!",Mouse_Kill, ENDPOPUP) SetMouse(0,0,1000,1000,Draw_Coord,Mouse_x,Mouse_y) UseFont("System",0,0,BOLD,NOITALIC,NOUNDERLINE,0,0,0) DrawText(5,5,"Click the mouse anywhere in the window to see the x,y coordinates") Wait_Mouse: WaitInput() {Draw the x-coordinate} Draw_Coord: DrawNumber(Mouse_x,Mouse_y,Mouse_x) {Increase the x-coordinate by 3 millimeters for each digit in Mouse_x} If Mouse_x>=100 Then Set x=Mouse_x+9 | Goto Draw_Comma {3 digits} If Mouse_x>=10 Then Set x=Mouse_x+6 | Goto Draw_Comma {2 digits} {Else} Set x=Mouse_x+3 {1 digit only} {Draw the comma} Draw_Comma: DrawText(x,Mouse_y,",") {Increase x by 2 and draw the y-coordinate} Set x=x+2 DrawNumber(x,Mouse_y,Mouse_y) Goto Wait_Mouse Mouse_Kill: SetMenu() SetMouse() Goto Set_Text {Animation} Animate: SetMenu() UseBackground(TRANSPARENT,255,0,100) DrawBackground {Define coordinates of a rectangle} Set upper_row=50 Set upper_col=0 Set lower_row=90 Set lower_col=30 Set upper_txt_col=8 Set times=0 {Print text in the window} UseFont("System",0,0,NOBOLD,NOITALIC,NOUNDERLINE,0,0,255) DrawText(10,20,"This is an example of how you can create simple") DrawText(10,30,"animation with Oriel, the graphics-based batch") DrawText(10,40,"language for Windows 3.0...") Draw: If times = 0 Then Goto Branch1 UseBrush(SOLID,255,0,100) {Erase existing rectangle} UsePen(NULL,1,255,0,100) Set lower_row_temp=lower_row+1 DrawRectangle(upper_col,upper_row,lower_col,lower_row_temp) Set upper_col=upper_col + 5 Set lower_col=lower_col + 5 Set upper_txt_col=upper_txt_col + 5 Branch1: Set times=times + 1 UseBrush(SOLID,0,255,255) {Draw new rectangle} UsePen(SOLID,1,255,0,100) DrawRectangle(upper_col,upper_row,lower_col,lower_row) DrawText(upper_txt_col,65,"Hello!") WaitInput(100) If upper_col <= 210 Then Goto Draw Goto Set_Text {Re-initialize the menu, keyboard, and mouse} Menu_Init: SetMenu() SetMouse() SetKeyboard() Return {Exit!} Bye: End