Autor Tema: A bug in screen_get ?  (Leído 525 veces)

0 Usuarios y 1 Visitante están viendo este tema.

Conectado Breadcaster

  • Newbie
  • *
  • Mensajes: 27
  • Karma: 2
    • Ver Perfil
A bug in screen_get ?
« en: Junio 09, 2016, 11:01:56 am »
Hello all, hello hello hello.

So I've seen this done a million times in before, and I'm sure you all have as well :) Where ingame, there's a TV screen or a display of some kind which shows exactly what the player's looking at, using the screen_get function. In DIV, this would of originally been screen_copy.

I've got it working just fine in my game at present, except that every now and again, it causes a random crash - the game will quit and I'll get the "blabla has encountered a problem and needs to close" Windows box pop up.

Before the loop/just after the Begin, I have this code:

displayscreen_graph=map_new(73, 55, 16);
playersscreen_graph=screen_get();
map_xput(0, displayscreen_graph, playersscreen_graph, 36, 27, 0, 15, 0);
graph=displayscreen_graph;

and then in the main process loop, this code:

playersscreen_graph=screen_get(); // Crash
map_xput(0, displayscreen_graph, playersscreen_graph, 36, 27, 0, 15, 0);
graph=displayscreen_graph;
Frame;

For some reason, the line I've commented with "Crash" makes the game, well, crash. Commenting it out/removing it and running the game works just fine (except the screen doesn't update beyond the first frame of course).

Has anyone here had any experience with it, any why this might be crashing the game? I've searched the forum and, of course, all the relevant results I can find are in Spanish, haha. Is Screen_copy still in Bennu or has it been replaced entirely by screen_get?

The game's very near completion and it's a blast to play, I'm sure you'll enjoy it when it's done :)

Thank you for your help!!

- Breadcaster

Desconectado Drumpi

  • Hero Member
  • *****
  • Mensajes: 6074
  • Karma: 156
  • Sexo: Masculino
  • Odio el periodo "entre proyectos"
    • Ver Perfil
    • La web de Drumpi
Re:A bug in screen_get ?
« Respuesta #1 en: Junio 12, 2016, 03:45:40 pm »
Just to be sure, did you remember to UNLOAD the captured screen every frame?
The mensaje error "blabla has encountered a problem and needs to close" comes with an exception code. What code is it? just to know if it's an overflow error or access violation or other kind of error.
Hala, como con 1001 procesos sólo va a 9 FPS, vamos a meterle 32 veces más, a ver si revienta.
(Drumpi epic moment)

Conectado Breadcaster

  • Newbie
  • *
  • Mensajes: 27
  • Karma: 2
    • Ver Perfil
Re:A bug in screen_get ?
« Respuesta #2 en: Junio 15, 2016, 05:53:19 am »
I didn't, that fixed it - thank you! I was treating it like screen_copy() from the original DIV, haha. Didn't realise it needed to be unloaded. :)