OSBA OS Update

Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it
Forum rules
Any off topic discussions should go in this forum. Post count is not increased by posting here.
FTP Access status is required to post in this forum. Find out how to get it
Post Reply
ppc_digger
Donator
Posts: 590
Joined: Sat Aug 19, 2006 1:25 am
Location: Israel

OSBA OS Update

Post by ppc_digger »

Over the last few weeks I've been working on oDisplay (OSBA OS' native windowing environment).

To show (off) what oDisplay can already do, here's a sample application that draws the image given as a parameter and displays a "Hello, World!" message:

Code: Select all

#include "oDisplay.h"

int main(int *argc,char *argv[])
{
	unsigned long *image;
	unsigned int width,height;
	odWindow *wnd,*wnd2;

// check that a file was specified
	if ( argc < (int *)2 )
		fatalError(-1,"main","no file specified.");
// initiate oDisplay
	odInit();

// load the specified image
	image = odLoadImage(argv[1],&width,&height);
// if we can't load it, exit with an error message
	if ( ! image )
		fatalError(-1,"main","can't load image.");

// create a window at location 100,100 with the image's width and height, 
// set its parent window to the root window, make it shown by default 
// (first 1) and managed by default (second 1), and make it without an 
// event handler (the NULL)
	wnd = odCreateWindow(100,100,width,height,odGetRootWindow(),1,1,NULL);
// set its transparency to 64 (25%)
	odSetWindowAlpha(wnd,0,0,width,height,64);
// color the root window with a light blue color
	odFill(odGetRootWindow(),0,0,screenWidth,screenHeight,0xFFCCCCFF);
// draw the image
	odDrawBlock(wnd,0,0,width,height,image);

// get the text size
	odGetTextSize("Hello, World!","arial",12,&width,&height);
// create the second window
	wnd2 = odCreateWindow(350,500,width+40,height+10,odGetRootWindow(),1,1,NULL);
// color it white
	odFill(wnd2,0,0,width+40,height+10,0xFFFFFFFF);
// draw the text on the second window, at location 20,5, using font arial size 12, color black and 0xFF opacity
	odDrawTextToWindow(wnd2,20,5,"Hello, World!","arial",12,0xFF000000);

// wait ten seconds
	sleep(10);
// destroy both windows
	odDestroyWindow(wnd);
	odDestroyWindow(wnd2);
// terminate oDisplay and exit with a success code
	odTerminate();
	return 0;
}
this is what this program looks like when run with the Google logo as a parameter:
Image

As you can see, oDisplay already has windowing, text, transparency and image-loading support, and I'm currently working on loadable widget support.

Notice the coding simplicity compared to other low level windowing environments (X11, Win32, ...).

kichimi
User avatar
Donator
Posts: 407
Joined: Tue Aug 22, 2006 3:30 pm
Location: Essex, UK
Contact:

Post by kichimi »

wow, cool looks great, when it gets good enuf ill start using it
The better candies are in the cage

Shrimp
FTP Access
Posts: 114
Joined: Sun Nov 05, 2006 3:41 am
Location: NY

Post by Shrimp »

I used OSBA OS in vmware, and it's actually a pretty good OS, I might install it on my spare PC soon when it gets better

Post Reply