[m-users.] STATE_VARIABLE_IO_0 has instantiatedness ddgame.m:042: mostly_unique
emacstheviking
objitsu at gmail.com
Fri Aug 16 23:38:01 AEST 2019
...but I can't see what I have done wrong!!!! I have this in my graphics
window: the intenttion is to create an SDL window and render and then hand
back the graphics state and yes or no, making the basic_window `det`.
:- pred basic_window(
string::in, int::in, int::in, int::in, int::in,
gfx_state::in, {gfx_state, bool}::out,
io::di, io::uo) is det.
basic_window(Title, X, Y, W, H, GIn, {GOut, yes}, !IO) :-
sdl_createwindow(Title, X, Y, W, H, [resizable], yes(Wnd), !IO),
sdl_createrenderer(Wnd, -1, [accelerated], yes(_), !IO),
GOut = GIn ^ gfx_wnd := maybe.yes(Wnd).
basic_window(Title, X, Y, W, H, GIn, {GIn, no}, !IO).
And calling it from my "execute" predicate int he game controller....
:- pred execute(gfx_state::in, io::di, io::uo) is det.
execute(GfxState, !IO) :-
(
basic_window("blah", 0, 0, 400, 200, GfxState, {GfxState1, yes},
!IO)
->
random.init(0, RS),
sdl_getticks(TNow, !IO),
starfield.init(100, Starfield, RS, RS0),
AppState = app_state(
TNow,
GfxState1,
Starfield
),
game_loop(AppState, RS0, !IO)
;
format("basic window failed\n", [], !IO)
),
format("*\n* All over\n*\n", [], !IO).
But on building it I get this and I cannot figure out my error!
*ddgame.m:042: In clause for `execute(in, di, uo)':ddgame.m:042: in
argument 8 of call to predicate `gfx.basic_window'/9:ddgame.m:042: mode
error: variable `STATE_VARIABLE_IO_0' has instantiatednessddgame.m:042:
`mostly_unique',ddgame.m:042: expected instantiatedness was `unique'.*
I can't figure out what "mostly" is doing there...how did the compiler get
to that place ?
TIA
Sean
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurylang.org/archives/users/attachments/20190816/e817f849/attachment.html>
More information about the users
mailing list