IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Rock Ridge Farm (Larry) on January 30, 2006, 07:41:27 AM

Title: Window background
Post by: Rock Ridge Farm (Larry) on January 30, 2006, 07:41:27 AM
I want to add a background to an Aurora window.
Anyone with an idea on how to do this?
Title: Re: Window background
Post by: Zen on January 30, 2006, 07:55:40 AM
I dont think there are Aurora functions yet to load and manage graphics. If you take a look at peasleas Skeleton Code example you will see he has loaded and displayed some pictures using the windows API. Its not that hard apart from you have to use the classname.m_hwnd instead of just the class name for specifying windows and dialogs

Lewis
Title: Re: Window background
Post by: sapero on January 30, 2006, 01:13:59 PM
SetBitmap(path) sets the bitmap as background
Maybe replacing and not resizing m_hBitmap window class member is bad, but it works ;D

class CImageWindow : window
{
declare OnClose(),int;
declare SetBitmap(string *path);
}

global sub main()
{
CImageWindow win;

win.Create(0x80000000,0x80000000,0x80000000,0x80000000,AWS_VISIBLE|AWS_OVERLAPPEDWINDOW|AWS_AUTODRAW,0,"",null);

win.SetWindowColor(0); // image background is black
win.SetBitmap("D:\\IBpro\\temp\\twenty-four-bit.bmp");
win.DrawMode(TRANSPARENT);//text
win.FrontPen(0xFFFFFF);//text
win.SetFont("Arial", 30,100);//text
win.WriteText(100, 300, "yahooo :)");//text

while win.m_hwnd<>0{wait();}
return;
}

import int LoadImage alias LoadImageA(int hInstance,string *lpszName,
int uType,int cxDesired,int cydesired,int fuLoad);

import int DeleteObject(int obj);
import int GetObject alias GetObjectA(int hgdiobj, int cbBuffer, void *lpvObject);

import int BitBlt(int hdcDest,int nXDest,int nYDest,int nWidth,
int nHeight,int hdcSrc,int nXSrc,int nYSrc,int dwRop);

struct BITMAP
{
  int   bmType;
  int   bmWidth;
  int   bmHeight;
  int   bmWidthBytes;
  int   bmPlanes;
  int   bmBitsPixel;
  void *bmBits;
}

CImageWindow :: SetBitmap(string *path)
{
BITMAP bm;
DeleteObject(m_hBitmap);
m_hBitmap = LoadImage(0, path, 0,0,0,16);
GetObject(m_hBitmap, len(BITMAP), bm);
int dc = GetHDC();
BitBlt(dc, 0,0,bm.bmWidth,bm.bmHeight,dc,0,0,0x00CC0020);
ReleaseHDC(dc, true);
return;
}

CImageWindow :: OnClose(),int
{
Destroy();
return true;
}