Fullscreen within SDL - haskell

I’m writting a program in Haskell with SDL. When I do that:
screen <- trySetVideoMode width height depth [HWSurface,OpenGL]
the program behaves correctly. Now, if I do that :
screen <- trySetVideoMode width height depth [HWSurface,OpenGL,Fullscreen]
the program starts with a black fullscreen mode, then comes back windowed and goes on that way. I add that the resolution used in the application is 1920x1080 – which is also my screen resolution.
Does anyone know why? How can I make it fullscreen?

Related

How to change FlxG width and height, ResizeGame doesn't work

how do i change FlxG width and height in runtime as resizeGame doesn't do anything
i have the project by default set to 1600 x 900 and i have a state for settings where i can change the resolution and have managed to make it so that i can change what the width and height will be on startup however i want to be able to resize it during runtime so it will be higher/lower res.
the problem is since FlxG width and height aren't modifiable directly so resizeGame is the only option but it doesn't do anything, even after calling it and tracing FlxG width and height there is no difference nor is there any visual difference asside from the game being offset to the very top left corner of the window and messing up detecting where the mouse is until i maximise and restore down where it goes back to normal
does anyone have any idea why this isn't working and how i should go about fixing it
i'm compiling to c++ (windows)
edit: it has been a couple of months and i have started mostly rewriting the program and yet this issue is still a thing on a fresh start and i am in serious need of an answer

How can I get the color of a pixel on screen with Node.js or C?

I am trying to get the color of a pixel on my screen using node.js. I want it to be returned in RGB format, e.g. (255, 0, 0). My current solution is to use screenshot-desktop to screenshot my entire screen in JPG format, decode it to get the raw pixel data, and get the color of a given pixel. However, this lags out my entire computer for 1-2 seconds as it is taking the screenshot. This is unusable as I would like to do this multiple times per second. So my question is: How can I get the color of a given pixel on the screen, without taking a full screenshot?
I am using Linux with X11. There is an X11 library for node.js, so I asssume I should use that to get the pixel color, I'm just not sure how. If you could show me how to do it in C then I can easily use node.js to do the same thing.
Thanks!
Oh my gosh I just figured it out after posting this. I was using robotjs for reading the mouse position and I totally forgot it can do screen stuff too! So, the solution would be to do
var robot = require('robotjs');
var color = robot.getPixelColor(x, y);
X11 solution using x11 node library ( I am the author ):
query windows tree with QueryTree starting at the root window
get every child geometry using GetGeometry request
if your point is not inside any child, use current window id and get 1x1 pixmap from the current image: GetImage(format, currentWindow, x, y, 1, 1, planeMask) ( 2 for format and 0xffffffff for plane mask should work ). Make sure you calculate relative x y position as you travers windows tree.
if child window covers your point query children for that window and repeat again. Note that QueryTree returns windows in bottom to top stacking order so make sure you pick last one covering your point
Once you have 1x1 pixmap from the topmost window under your point - the buffer should contain only color bytes for your image, RGB order and bit mask might depend on red_mask, green_mask, blue_mask from display.screen[0].depths[visual].
If you cache "topmost window" between requests and only start from root when no match anymore the above solution might be much more performant then the one using robotjs ( although much more low level and complicated ) Good luck!

Splash Screen Shared Element Transition On Bigger Screens

I want to make a splash screen that appears when i open the app and disappears after 3 seconds, with the image being shared with the next activity.
On smaller screens(for example Pixel 2) the animation works without problems, but when i try it on my OnePlus 6 or Pixel 3 XL, the image always clips to like 50dp below it's position right before the transition.
What could be the problem?
For anyone having the same problem.
The issue was that i was setting a color on the splash screen's frame background. If i didn't set any color, it would work fine.
I found a way around it by adding a view that expanded the whole screen and setting the color to the view instead.
I hope this will help someone eventually.

PyQT: clearly displaying number on top of background

I'm trying to display a number on a board with lines (go game). Right now, the number is displayed on top of a cross, so it's not very easy to tell. See the screen shot below
The background is drawn with setBackgroundBrush() on the scene.
The lines are QGraphicsLineItem which are added to the scene after the background.
I've tried to display a small portion of the background below the number but the effect isn't great. Is there a smart way of doing this so that when the number is displayed, the area that's covered by the number only shows the background texture and not the lines?

SDL mouse range on resize

I am developing a SDL OpenGL application on Ubuntu and have noticed a problem with the mouse range when a new window size is set. The initiale size of my application is 600x400 and the mouse range (x,y) reflects this. However, when a user changes the screen to any other size (using given predefined sizes), the mouse range still only reflects a 600x400 screen size and causes issues with mouse location functionality.
To set the new resolution, I call:
SDL_SetVideoMode(Width, Height, 32, SDL_OPENGL); which to my understanding should handle the mouse range resizing but doesn't seem to do so in Linux. Can anyone give me a solution to this problem?
Note: Possible hack seem to be to exit SDL and re-initialize using SDL_Init(SDL_INIT_EVERYTHING);
After some digging, I found the problem was that I was calling SDL_GetMouseState(0,0) later after the size change was made which apparently was interfering with the recalculation of the mouse range. However, I've gone through the SDL source but I can't really determine how this would effect it so. There seems to be some mouse state switching that may be causing it.
Anytime i resize the window, I execute the following to refresh my viewport:
m_ParentWindow = SDL_SetVideoMode( m_width, m_height, m_depth, m_SDL_Vid_Flags );
glViewport(0,0,m_width,m_height);
Clear();
Where Clear calls:
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();

Resources