U++ framework
Do not panic. Ask here before giving up.

Home » Community » Newbie corner » smoother drawing
Re: smoother drawing [message #27691 is a reply to message #27682] Thu, 29 July 2010 16:42 Go to previous messageGo to previous message
cullam is currently offline  cullam
Messages: 8
Registered: July 2010
Location: St. John's Canada
Promising Member
Aha! This is looking much more promising!

So, I'm looking through the code in the example, but without any comments in it, I'm not entirely sure what I'm seeing.


Examples.h


#ifndef _PainterExamples_Examples_h_

#define _PainterExamples_Examples_h_



#include <CtrlLib/CtrlLib.h>

#include <Painter/Painter.h>



using namespace Upp;



#define IMAGECLASS TestImg

#define IMAGEFILE <PainterExamples/Test.iml>

#include <Draw/iml_header.h>



#define LAYOUTFILE <PainterExamples/Examples.lay>

#include <CtrlCore/lay.h>



void RegisterExample(const char *name, void (*ex)(Painter& pw));



struct App : TopWindow {

virtual void Paint(Draw& w);



SplitterFrame split;

ArrayCtrl list;

FrameBottom< WithCtrlLayout<StaticRect> > ctrl;



typedef App CLASSNAME;



void DoPaint0(Painter& sw);

void DoPaint(Painter& sw);

void Print();

void Benchmark();

void Sync();

void ToSlider(EditDouble *e, SliderCtrl *slider);

void ToEdit(EditDouble *e, SliderCtrl *slider);

void Pair(EditDouble& e, SliderCtrl& slider);

void ToSlider();

void Reset();

void Serialize(Stream& s);



App();

~App();

};

#endif


All the drawing classes in this example appear to take a reference to a Painter object, but I'm not quite sure where I get this object in the first place. In my app, my main is just:

#include "VectorsGUI.h"

#define VERSION "2010070801"
#define FILE_BASE "SQX-Drive"
#define FILE_TITLE String( FILE_BASE )


GUI_APP_MAIN
{
VectorsGUI(FILE_TITLE, FILE_BASE, VERSION ).Run();
}


... with everything of interest happening in my other classes. I believe the Paint() function I'm using came from inheriting my most important class from WithVectorsGUILayout<TopWindow>. What do I need to modify/do/include to be able to use Painter() instead? Is it some way of getting a Painter& to pass into Paint(), rather than a Draw&?

Thanks for the help. And it is very helpful to know that what I'm looking to do CAN be done simply! Now I just need to figure out how...
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to adjust the height of an InfoCtrl frame’s height.
Next Topic: Initial settings for U++ application
Goto Forum:
  


Current Time: Fri May 29 17:35:06 GMT+2 2026

Total time taken to generate the page: 0.03106 seconds