delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1997/05/26/05:18:01

From: "Michael L. Smith" <mlsmith AT vax2 DOT rainis DOT net>
Newsgroups: comp.os.msdos.djgpp,comp.lang.basic.misc,alt.lang.basic
Subject: OmniBasic/Allegro
Date: Sun, 25 May 1997 22:11:24 -0500
Organization: Computer Design Lab
Lines: 107
Message-ID: <3388FF5C.3FDD@vax2.rainis.net>
Mime-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp

I have received a number of inquiries as to whether OmniBasic will work
with the Allegro package. I just down loaded it a couple hours ago and
converted the example program called 'ex2.c' from the examples directory
of the Allegro package. Allegro looks like a very nice package. I can
see why there is so much activity involving it on the newgroups.

The folowing is the program converted to OmniBasic which is followed by
a separate macro file used by the program. Enjoy!

* FILE: EX2B.B
 
* Demo of OmniBasic interfaced to Allegro
* Derived from Allegro Example Program 'EX2.C'

#USE allegro.mac

 IncludeAleggro
 SetScreenSize

;BITMAP *memory_bitmap;

 DIM x:LONG
 DIM y:LONG

#lib liballeg.a

 REM Code starts here
 Allegro_Init
 Install_Keyboard
 Set_Gfx_Mode GFX_VGA,ScreenWidth,ScreenHeight,0,0
 Set_Pallete desktop_pallete

 REM make a memory bitmap sized 20x20
;memory_bitmap = create_bitmap(20, 20);

 REM draw some circles onto it
 Clear memory_bitmap

 FOR x=1 TO 16
	Circle memory_bitmap,10,10,x,x
 NEXT x

 REM blit lots of copies of it onto the screen
 FOR y=1 TO ScreenHeight STEP 20
	FOR x=1 TO ScreenWidth STEP 20
		Blit memory_bitmap,screen,0,0,x,y,20,20
	NEXT x
 NEXT y

 REM free the memory bitmap
 Destroy_Bitmap memory_bitmap

 ReadKey\ Keeps screen on until key is struck




* FILE: ALLEGRO.MAC
 
* Macro library for Allegro graphics package

#MACRO IncludeAleggro
;#include <stdlib.h>
;#include <stdio.h>
;#include "allegro.h"
#ENDM

#MACRO Allegro_Init
;allegro_init();
#ENDM

#MACRO Install_Keyboard 
;install_keyboard(); 
#ENDM

#MACRO SetScreenSize
#SET ScreenWidth=320
#SET ScreenHeight=200
#ENDM

#MACRO Set_Gfx_Mode
;set_gfx_mode(~1,~2,~3,~4,~5);
#ENDM

#MACRO Set_Pallete
;set_pallete(~1);
#ENDM

#MACRO Clear
;clear(~1);
#ENDM

#MACRO Blit
;blit(~1,~2,~3,~4,~5,~6,~7,~8);
#ENDM

#MACRO Destroy_Bitmap
;destroy_bitmap(~1);
#ENDM

#MACRO ReadKey
;readkey();
#ENDM

#MACRO Circle
;circle(~1,~2,~3,~4,~5);
#ENDM

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019