raylib icon indicating copy to clipboard operation
raylib copied to clipboard

Implementing GetMonitorWidth/Height for DRM

Open gabriel-marques opened this issue 1 year ago • 4 comments

Hello :)

I would like to propose an implementation for the following functions for the DRM platform :

  • int GetMonitorWidth(int monitor)
  • int GetMonitorHeight(int monitor)
  • int GetMonitorPhysicalWidth(int monitor)
  • int GetMonitorPhysicalHeight(int monitor)
  • const char *GetMonitorName(int monitor)

Although the monitor selection is not supported for the drm platform I kept the argument to avoid having multiple function prototypes.

I hope it complies to your coding rules :)

gabriel-marques avatar May 02 '24 13:05 gabriel-marques

Hello. What would it be good for? In addition to the fact that I can find out these dimensions... At the moment we have encountered such an unpleasant dilemma regarding DRM: https://github.com/raysan5/raylib/issues/3946. Can you please tell me about it?

colesnicov avatar May 02 '24 15:05 colesnicov

I dont know yet. I just tuk here for few days. tests, tests, tests...

colesnicov avatar May 02 '24 16:05 colesnicov

Hello @orcmid :)

Thanks for the suggested changes of consistency, I will apply them :) By the way, there is both GetMonitorCount() and GetCurrentMonitor() which although log that they are not implemented, returns the correct value (because the actual implementation is limited to one screen only)

// Get number of monitors
int GetMonitorCount(void)
{
    TRACELOG(LOG_WARNING, "GetMonitorCount() not implemented on target platform");
    return 1;
}

// Get number of monitors
int GetCurrentMonitor(void)
{
    TRACELOG(LOG_WARNING, "GetCurrentMonitor() not implemented on target platform");
    return 0;
}

gabriel-marques avatar May 02 '24 19:05 gabriel-marques

@gabriel-marques Implementation looks good to me. Please, let me know when this PR is ready for merging!

raysan5 avatar May 05 '24 09:05 raysan5

Hello,

As @orcmid suggested I changed the getMonitorName to return "" as default and also I changed others functions to also evaluate negative monitors.

gabriel-marques avatar May 07 '24 08:05 gabriel-marques

@gabriel-marques Thanks! Implementation looks good to me! Merging!

raysan5 avatar May 07 '24 08:05 raysan5