Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs

screen_refresh

Brings back synchronous drawing into GameMaker: Studio. · By YellowAfterlife

Is this still in development?

A topic by Max Oakland created Oct 17, 2020 Views: 151 Replies: 4
Viewing posts 1 to 4

I’m curious if you’re still planning to update for GMS 2

Developer

No idea, to be honest - 2.3 did finally add DXGI swapchain to os_get_info, but doing ->Present doesn't update the imagery on screen and I have not found time to dig into the possible reasoning yet.

If you'd like to peck at it, here's C++ code

#include "stdafx.h"
#include <stdio.h>
#include <d3d11.h>
#define dllx extern "C" __declspec(dllexport)
#define trace(...) { printf(__VA_ARGS__); printf("\n"); fflush(stdout); }
dllx double screen_refresh_w_raw(IDXGISwapChain* swapchain) {
    if (!swapchain) return false;
    auto hr = swapchain->Present(0, 0);
    if (hr != S_OK) {
        trace("Coudln't present, code %x", hr);
        return false;
    } else return true;
}

And GML

#define screen_refresh_w
/// ():
gml_pragma("global", @'
global.__video_d3d11_swapchain = undefined;
global.__video_d3d11_swapchain_rdy = false;
');
draw_flush();
//surface_getpixel(application_surface, 0, 0);
var _swc;
if (!global.__video_d3d11_swapchain_rdy) {
    global.__video_d3d11_swapchain_rdy = true;
    var _inf = os_get_info();
    _swc = _inf[?"video_d3d11_swapchain"];
    //show_debug_message(_swc);
    global.__video_d3d11_swapchain = _swc;
} else _swc = global.__video_d3d11_swapchain;
return screen_refresh_w_raw(_swc);

The DLL function is to be set up in the extension with a "string" (pointer) argument to receive the address correctly.

Thank you 😀. I don’t have any knowledge about C++ but maybe someone else will be able to work with that

Did you ever get this working again?

Developer

Nope - I do not really have the knowledge required to debug lower-level DirectX issues, and I do not have enough extensions to justify digging into that at the moment.