- [NEW] view(x,y,w,h) Creates a clipped viewport that also translates origin.
-[NEW] view() Resets the viewport to all the window.
This commit is contained in:
17
mini.cpp
17
mini.cpp
@@ -382,8 +382,8 @@ void simple_pset(int x, int y, uint8_t color) {
|
||||
}
|
||||
|
||||
void cls(uint8_t color) {
|
||||
for (int y=ds::clip[1]; y<ds::clip[3];++y) {
|
||||
for (int x=ds::clip[0]; x<ds::clip[2];++x) {
|
||||
for (int y=ds::clip[1]+ds::cam[1]; y<ds::clip[3]+ds::cam[1];++y) {
|
||||
for (int x=ds::clip[0]+ds::cam[0]; x<ds::clip[2]+ds::cam[0];++x) {
|
||||
simple_pset(x,y,color);
|
||||
}
|
||||
}
|
||||
@@ -656,6 +656,19 @@ void camera(int x, int y) {
|
||||
ds::cam[1] = y;
|
||||
}
|
||||
|
||||
void view(int x, int y, int w, int h) {
|
||||
ds::cam[0] = -x;
|
||||
ds::cam[1] = -y;
|
||||
ds::clip[0] = x; ds::clip[1] = y; ds::clip[2] = w+x; ds::clip[3] = h+y;
|
||||
ds::clp[0] = x; ds::clp[1] = y; ds::clp[2] = w-1; ds::clp[3] = h-1;
|
||||
}
|
||||
|
||||
void view() {
|
||||
ds::cam[0] = ds::cam[1] = 0;
|
||||
ds::clip[0] = ds::clip[1] = 0; ds::clip[2] = screen_width; ds::clip[3] = screen_height;
|
||||
ds::clp[0] = ds::clp[1] = 0; ds::clp[2] = screen_width-1; ds::clp[3] = screen_height-1;
|
||||
}
|
||||
|
||||
void _drawcirc(int xc, int yc, int x, int y) {
|
||||
pset(xc+x, yc+y);
|
||||
pset(xc-x, yc+y);
|
||||
|
||||
Reference in New Issue
Block a user