PDA

View Full Version : LICE Drawing Problem


Actium
06-10-2010, 11:53 AM
Hiya, I'm working on developing an extension for Reaper. I'm trying to use the LICE functions to draw onto a dialog.

My problem is that the initial area of the dialog remains the dialog color instead of being drawn upon. It's a little difficult to describe, so here's a screenshot--
http://i.imgur.com/2VQ4J.png

Once I resize the window, I can see the stuff that wdl drew.

I'm basing my window off of sws_wnd so I can use less winapi as I'm not too familiar with it (I'm primarily a *nix developer).

My update function looks like this

{
//ShowConsoleMsg("updating\n");
RECT r;
GetClientRect(m_hwnd,&r);
PAINTSTRUCT ps;
HDC dc = BeginPaint(m_hwnd, &ps);
LICE_Clear(framebuffer, LICE_RGBA(255,255,255,0));
LICE_FillRect(framebuffer,0, 0, 10, framebuffer->getHeight(), LICE_RGBA(255,255,255,0), 1.0f, LICE_BLIT_MODE_COPY);
LICE_DrawText(framebuffer,1,1,"test",LICE_RGBA(255,255,255,0),1,LICE_BLIT_MODE_COPY);
BitBlt(dc,r.left,r.top,r.right,r.bottom,framebuffe r->getDC(),0,0,SRCCOPY);
EndPaint(m_hwnd, &ps);
}

Thanks in advance.

schwa
06-10-2010, 01:02 PM
Hi, is this all within the WM_PAINT handler? If not, it needs to be.

This is most likely just code in progress, but just to mention, the LICE_FillRect is entirely redundant with the LICE_Clear call, and the text won't show up because it's white on white.

Actium
06-10-2010, 01:04 PM
Hi, is this all within the WM_PAINT handler? If not, it needs to be.

This is most likely just code in progress, but just to mention, the LICE_FillRect is entirely redundant with the LICE_Clear call, and the text won't show up because it's white on white.

Thanks for the reply. Yeah I know there are a couple of redundant lice calls, that's just me testing.

Does the drawing code always have to be in the WM_PAINT handler? If I'd like to arbitrarily redraw (such as on keypress or other event) can I call my Update function then?

schwa
06-10-2010, 01:07 PM
Does the drawing code always have to be in the WM_PAINT handler?

WM_PAINT is definitely where the BitBlt needs to be. Anywhere else that you want to push an update, you can call InvalidateRect, which will trigger a WM_PAINT message.

Justin
06-10-2010, 05:48 PM
If you wish to draw into the window at any time, you can use GetDC()/ReleaseDC(), but generally you should try to invalidate/paint as schwa describes when possible.

RRokkenAudio
06-10-2010, 08:40 PM
I need more brain cells.