Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/157.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++快板:当我移动窗口时程序崩溃 我已经建立了一个C++快板地图编辑器。其中一个请求是要有一个日志,所以我将它放在控制台窗口中,用于执行每个动作。。。现在的问题是,控制台窗口位于GFX_AUTODETECT_窗口使用的主窗口下方,但每当我尝试移动该窗口时,它都会使程序崩溃。。我需要能够移动它,将控制台窗口移动到地图编辑器,然后返回地图编辑器。有人有什么想法吗_C++_Crash_Allegro - Fatal编程技术网

C++快板:当我移动窗口时程序崩溃 我已经建立了一个C++快板地图编辑器。其中一个请求是要有一个日志,所以我将它放在控制台窗口中,用于执行每个动作。。。现在的问题是,控制台窗口位于GFX_AUTODETECT_窗口使用的主窗口下方,但每当我尝试移动该窗口时,它都会使程序崩溃。。我需要能够移动它,将控制台窗口移动到地图编辑器,然后返回地图编辑器。有人有什么想法吗

C++快板:当我移动窗口时程序崩溃 我已经建立了一个C++快板地图编辑器。其中一个请求是要有一个日志,所以我将它放在控制台窗口中,用于执行每个动作。。。现在的问题是,控制台窗口位于GFX_AUTODETECT_窗口使用的主窗口下方,但每当我尝试移动该窗口时,它都会使程序崩溃。。我需要能够移动它,将控制台窗口移动到地图编辑器,然后返回地图编辑器。有人有什么想法吗,c++,crash,allegro,C++,Crash,Allegro,这是我的主要代码 #include <allegro.h> #include <string> #include <sstream> #include "Layout.h" #include "System.h" #include "Map.h" #include <iostream> #include <fstream> using namespace std; // Allegro Functions to stabilize

这是我的主要代码

#include <allegro.h>
#include <string>
#include <sstream>
#include "Layout.h"
#include "System.h"
#include "Map.h"
#include <iostream>
#include <fstream>

using namespace std;

// Allegro Functions to stabilize speed
volatile long speed_counter = 0;              
void increment_speed_counter() // A function to increment the speed counter
{speed_counter++; }
END_OF_FUNCTION(increment_speed_counter); 

int main()
{
System system; // Initialising Allegro 
system.Setup();

Map map1; // Creating default map
map1.createMap(); 

BITMAP *buffer = create_bitmap(24,45); // Double buffering

LOCK_VARIABLE(speed_counter); //Used to set the timer - which regulates the game's
LOCK_FUNCTION(increment_speed_counter);//speed.
install_int_ex(increment_speed_counter, BPS_TO_TIMER(8));//Set our BP

/*game looop */
while( !key[KEY_ESC] )
{
        clear_bitmap(buffer); // Clear the contents of the buffer bitmap         
while(speed_counter > 0)
{
    if(mouse_b &1 ){ // On mouse click
          map1.catchMouseEvent(mouse_x, mouse_y);
          while(mouse_b & 1){}   
    }
    speed_counter --;
}
       rectfill(buffer,0,0,25,45,makecol(135,206,250));
       textprintf_ex(buffer, map1.getLayout().getFont(), 0, 0, makecol(255, 255, 255), -1,"%d", map1.getRowVal());
       textprintf_ex(buffer, map1.getLayout().getFont(), 0, 20, makecol(255, 255, 255), -1,"%d", map1.getColVal());

       blit(buffer, screen, 0, 0, 970, 50, 100, 50);     
}

/*Free memory after */
destroy_bitmap( buffer );   
return 0;
allegro_exit();
}
END_OF_MAIN();
而且,它会在不移动窗口的情况下自行随机崩溃。没有具体的原因,它只是在随机时间崩溃


有什么想法吗

如果看不到所有代码,就不可能知道它崩溃的原因或位置。如果您使用调试器,那么发生的事情应该是显而易见的。您应该响应返回代码。e、 例如,加载或创建位图时,请确保它不为NULL

我真的不知道你想用这么小的双缓冲区做什么。通常创建一个与窗口大小相同的缓冲区。请注意,Allegro 4只有在屏幕宽度为4的倍数时才能正常工作。此外,在设置图形模式以实现最大兼容性之前,您应该调用set\u color\u depthdesktop\u color\u depth。\p>为什么在返回0后调用allegro\u exit?