void screeninit(void) { int fmt; int dx, dy; ProcessSerialNumber psn = { 0, kCurrentProcess }; TransformProcessType(&psn, kProcessTransformToForegroundApplication); SetFrontProcess(&psn); fmt = XBGR32; //XRGB32; devRect = max_bounds(); dx = devRect.size.width; dy = devRect.size.height; gscreen = allocmemimage(Rect(0,0,dx,dy), fmt); dataProviderRef = CGDataProviderCreateWithData(0, gscreen->data->bdata, dx * dy * 4, 0); fullScreenImage = CGImageCreate(dx, dy, 8, 32, dx * 4, CGColorSpaceCreateDeviceRGB(), kCGImageAlphaNoneSkipLast, dataProviderRef, 0, 0, kCGRenderingIntentDefault); devRect = CGDisplayBounds(CGMainDisplayID()); kproc("osxscreen", winproc, nil, 0); kproc("osxflush", flushproc, nil, 0); Sleep(&rend, isready, nil); }
bool Element::isPointWithin(glm::vec2 point) noexcept { auto translation = getTransform()->getLocalTranslation(); glm::vec2 min_bounds(translation.x - width / 2.0, translation.y - height / 2.0); glm::vec2 max_bounds(translation.x + width / 2.0, translation.y + height / 2.0); min_bounds -= anchor_point; max_bounds -= anchor_point; if(point.x >= min_bounds.x && point.x <= max_bounds.x && point.y >= min_bounds.y && point.y <= max_bounds.y) { return true; } else { return false; } }