Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
101 user(s) are online (50 user(s) are browsing Forums)

Members: 3
Guests: 98

gopal, VooDoo, NinjaCyborg, more...

Support us!

Headlines

 
  Register To Post  

Getting DisplayID/ModeID info
Not too shy to talk
Not too shy to talk


See User information
I need to figure out a DisplayID/ModeID width/height,
without opening Picasso or Cybergraphics, only with gfx lib (if possible)

// This is not what I'm looking for
page_w = scr->Width;
page_h = scr->Height;

// with CGFX I can do this
dsp_w = GetCyberIDAttr( CYBRIDATTR_WIDTH, modeid );
dsp_h = GetCyberIDAttr( CYBRIDATTR_HEIGHT, modeid );

// with P96I can do this
dsp_w = p96GetModeIDAttr( modeid, P96IDA_WIDTH );
dsp_h = p96GetModeIDAttr( modeid, P96IDA_HEIGHT );

// Get ModeID size, via gfx v54 if possible
dsp_w = ?
dsp_h = ?

“The best thing about a boolean is even if you are wrong, you are only off by a bit.”
Go to top
Re: Getting DisplayID/ModeID info
Home away from home
Home away from home


See User information
@rwo
This is GetVPModeID to get the modeid, and GetDisplayInfoData to get height and width, small test case:

#include <exec/types.h>
#include <proto/exec.h>
#include <proto/dos.h>
#include <proto/intuition.h>
#include <proto/graphics.h>
#include <intuition/screens.h>
#include <graphics/displayinfo.h>

int main(void)
{
    
struct Library *GraphicsBase     = NULL;
    
struct GraphicsIFace *IGraphics  = NULL;
    
struct Library *IntuitionBase    = NULL;
    
struct IntuitionIFace *IIntuition = NULL;

    
// Open libraries and interfaces
    
if (!(GraphicsBase = IExec->OpenLibrary("graphics.library", 54)) ||
        !(
IGraphics = (struct GraphicsIFace *)IExec->GetInterface(GraphicsBase, "main", 1, NULL)) ||
        !(
IntuitionBase = IExec->OpenLibrary("intuition.library", 51)) ||
        !(
IIntuition = (struct IntuitionIFace *)IExec->GetInterface(IntuitionBase, "main", 1, NULL)))
    {
        
IDOS->Printf("Failed to open required libraries or interfaces.\n");
        goto 
cleanup;
    }

    
struct Screen *scr = IIntuition->LockPubScreen(NULL);
    if (!
scr) {
        
IDOS->Printf("Failed to lock public screen.\n");
        goto 
cleanup;
    }

    
// Get real ModeID using GetVPModeID()
    
ULONG modeid = IGraphics->GetVPModeID(&scr->ViewPort);

    
struct DimensionInfo di;
    if (
IGraphics->GetDisplayInfoData(NULL, (APTR)&di, sizeof(di), DTAG_DIMS, modeid)) {
        
ULONG w = di.Nominal.MaxX - di.Nominal.MinX + 1;
        
ULONG h = di.Nominal.MaxY - di.Nominal.MinY + 1;
        
IDOS->Printf("ModeID: 0x%08lx, Width: %lu, Height: %lu\n", modeid, w, h);
    } else {
        
IDOS->Printf("Failed to get display info for ModeID 0x%08lx\n", modeid);
    }

    
IIntuition->UnlockPubScreen(NULL, scr);

cleanup:
    if (
IIntuition) IExec->DropInterface((struct Interface *)IIntuition);
    if (
IntuitionBase) IExec->CloseLibrary(IntuitionBase);
    if (
IGraphics) IExec->DropInterface((struct Interface *)IGraphics);
    if (
GraphicsBase) IExec->CloseLibrary(GraphicsBase);

    return 
RETURN_OK;
}

Join us to improve dopus5!
AmigaOS4 on youtube
Go to top
Re: Getting DisplayID/ModeID info
Not too shy to talk
Not too shy to talk


See User information
@kas1e

Yes.. this was exactly what I was looking for

Thank you

“The best thing about a boolean is even if you are wrong, you are only off by a bit.”
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project