|
How can i solve it?(draw_bitmap) |
foretion
Member #17,091
June 2019
|
1movement_character(user_player._player, pos_x+50, pos_y+50, player_direction, action_idx); // user_player._player is ALLEGRO_BITMAP* and initialized with al_load_bitmp(..);
1void movement_character(ALLEGRO_BITMAP* bitmap, int dx, int dy, int action_type, int action_idx) {
2 al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
3 int sx = character_movement[action_type][action_idx][0] * 16;
4 int sy = character_movement[action_type][action_idx][1] * 16;
5 int sw = character_movement[action_type][action_idx][2] * 16;
6 int sh = character_movement[action_type][action_idx][3] * 16;
7
8 //al_draw_bitmap_region(bitmap, sx, sy, sw, sh, dx, dy, 0);
9 ALLEGRO_COLOR tint = al_map_rgb(255, 255, 255);
10 al_draw_tinted_scaled_rotated_bitmap_region(bitmap, sx, sy, sw, sh, tint, 0, 0, dx, dy, GAME_SCALE, GAME_SCALE, 0, 0); // on error
i wrote code. -------- Program: ...nts\projects\nginx\x64\Debug\allegro-debug-5.2.dll Expression: src For information on how your program can cause an assertion what should i check? |
Edgar Reynaldo
Major Reynaldo
May 2007
|
For some reason your bitmap is NULL. Make sure it loaded correctly, and that you're not destroying it early. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
foretion
Member #17,091
June 2019
|
1void movement_character(ALLEGRO_BITMAP* bitmap, int dx, int dy, int action_type, int action_idx) {
2 al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
3 int sx = character_movement[action_type][action_idx][0] * 16;
4 int sy = character_movement[action_type][action_idx][1] * 16;
5 int sw = character_movement[action_type][action_idx][2] * 16;
6 int sh = character_movement[action_type][action_idx][3] * 16;
7
8 //al_draw_bitmap_region(bitmap, sx, sy, sw, sh, dx, dy, 0);
9 ALLEGRO_COLOR tint = al_map_rgb(255, 255, 255);
10 al_draw_tinted_scaled_rotated_bitmap_region(al_load_bitmap("gfx/character.png"), sx, sy, sw, sh, tint, 0, 0, dx, dy, GAME_SCALE, GAME_SCALE, 0, 0); // direct al_load_bitmap
11}
the same problem occurs in the this code. ----------- but, in sock_client_framework.c ( error )
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Most likely you're using a shadowed variable instead of an extern one. Show more code, like where you declare and define the bitmap objects. EDIT If the bitmap is NULL on loading, then you have a problem with the current working directory or filename. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
foretion
Member #17,091
June 2019
|
sock_client_framework.c 1// receive packet . . ..
2else if (strcmp(ContentType, "PLAYER") == 0)
3 {
4 const char* userName = json_string_value(json_array_get(pData, 0));
5 if (strcmp(user_player.cName, userName) == 0)
6 {
7 // get player data from jsonData
8 const int action_type = json_integer_value(json_array_get(pData, 1));
9 const int player_direction = json_integer_value(json_array_get(pData, 2));
10 const int action_idx = json_integer_value(json_array_get(pData, 3));
11 const int pos_x = json_integer_value(json_array_get(pData, 4));
12 const int pos_y = json_integer_value(json_array_get(pData, 5));
13 const int hp = json_integer_value(json_array_get(pData, 6));
14 const int armor = json_integer_value(json_array_get(pData, 7));
15 const int buf = json_integer_value(json_array_get(pData, 8));
16
17 ALLEGRO_BITMAP* user_bitmap = al_load_bitmap("gfx/character.png");
18 //ALLEGRO_BITMAP* hit_efftect = al_load_bitmap("gfx/hit_effect.png");
19
20 movement_character(al_load_bitmap("gfx/character.png"), pos_x+50, pos_y+50, player_direction, action_idx);
on ERROR. but main.c 1user_player._player = al_load_bitmap("gfx/character.png");
2// iPos_x, iPos_y .. other parameters initialized too.
3movement_character(user_player._player, user_player.iPos_x, user_player.iPos_y, user_player.iPlayer_direction, user_player.iAction_idx);
worked. and currently movement_character function in player.c 1void movement_character(ALLEGRO_BITMAP* bitmap, int dx, int dy, int action_type, int action_idx) {
2 al_set_target_bitmap(al_get_backbuffer(al_get_current_display()));
3 int sx = character_movement[action_type][action_idx][0] * 16;
4 int sy = character_movement[action_type][action_idx][1] * 16;
5 int sw = character_movement[action_type][action_idx][2] * 16;
6 int sh = character_movement[action_type][action_idx][3] * 16;
7
8 al_draw_bitmap_region(bitmap, sx, sy, sw, sh, dx, dy, 0);
9 //ALLEGRO_COLOR tint = al_map_rgb(255, 255, 255);
10 //al_draw_tinted_scaled_rotated_bitmap_region(bitmap, sx, sy, sw, sh, tint, 0, 0, dx, dy, GAME_SCALE, GAME_SCALE, 0, 0);
11}
------------ so...Could this be a problem? 1// receive packet . . ..
2else if (strcmp(ContentType, "PLAYER") == 0)
3 {
4 const char* userName = json_string_value(json_array_get(pData, 0));
5 if (strcmp(user_player.cName, userName) == 0)
6 {
7 // get player data from jsonData
8 const int action_type = json_integer_value(json_array_get(pData, 1));
9 const int player_direction = json_integer_value(json_array_get(pData, 2));
10 const int action_idx = json_integer_value(json_array_get(pData, 3));
11 const int pos_x = json_integer_value(json_array_get(pData, 4));
12 const int pos_y = json_integer_value(json_array_get(pData, 5));
13 const int hp = json_integer_value(json_array_get(pData, 6));
14 const int armor = json_integer_value(json_array_get(pData, 7));
15 const int buf = json_integer_value(json_array_get(pData, 8));
16
17 ALLEGRO_BITMAP* user_bitmap = al_load_bitmap("gfx/character.png");
18 //ALLEGRO_BITMAP* hit_efftect = al_load_bitmap("gfx/hit_effect.png");
19
20 movement_character(al_load_bitmap("gfx/character.png"), pos_x+50, pos_y+50, player_direction, action_idx);
code is in void __cdecl RecvThread(void* p); and RecvThread called with beginthread. 1_beginthread(RecvThread, 0, (void*)serv_sock);
|
Edgar Reynaldo
Major Reynaldo
May 2007
|
Can you post a zip file of your source code and resources please? It's failing an assertion inside transformations.c in al_copy_transform where the source transform is NULL. I need to debug this to know exactly why. I'm guessing it's something to do with threading and displays but I can't say for sure. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
foretion
Member #17,091
June 2019
|
Oh i solved that. I fixed that implement Without Thread. But i have other problem.....:( |
Edgar Reynaldo
Major Reynaldo
May 2007
|
You can make another post or you can just add it here. My Website! | EAGLE GUI Library Demos | My Deviant Art Gallery | Spiraloid Preview | A4 FontMaker | Skyline! (Missile Defense) Eagle and Allegro 5 binaries | Older Allegro 4 and 5 binaries | Allegro 5 compile guide |
|