Lab5 setup

This commit is contained in:
2022-04-05 10:38:11 -05:00
parent 810e0274b2
commit 71744fb0ac
9 changed files with 882 additions and 0 deletions

48
Lab5/x11context.h Normal file
View File

@@ -0,0 +1,48 @@
#ifndef X11_CONTEXT
#define X11_CONTEXT
/**
* This class is a sample implementation of the GraphicsContext class
* for the X11 / XWindows system.
* */
#include <X11/Xlib.h> // Every Xlib program must include this
#include "gcontext.h" // base class
class X11Context : public GraphicsContext
{
public:
// Default Constructor
X11Context(unsigned int sizex,unsigned int sizey,unsigned int bg_color);
// Destructor
virtual ~X11Context();
// Drawing Operations
void setMode(drawMode newMode);
void setColor(unsigned int color);
void setPixel(int x, int y);
unsigned int getPixel(int x, int y);
void clear();
void drawLine(int x1, int y1, int x2, int y2);
void drawCircle(int x, int y, unsigned int radius);
// Event looop functions
void runLoop(DrawingBase* drawing);
// we will use endLoop provided by base class
// Utility functions
int getWindowWidth();
int getWindowHeight();
private:
// X11 stuff - specific to this context
Display* display;
Window window;
GC graphics_context;
};
#endif