Jump to content
  • Advertisement
Sign in to follow this  
Davidtse

Allegro, CXX0030: Error: expression cannot be evaluated

This topic is 3598 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I cant seem to see what I am doing wrong, I have never had this problem before. so if anyone could look over my code and see an error that I did not see it would be great, thanks. Main.cpp #include <allegro.h> #include "GameLogic.h" //constant screen dimensions const int ScreenWidth = 640; const int ScreenHeight = 480; const bool FullScreen = false; GameLogic *Game; //timer variable and function and the fixed frames per second volatile int ticks = 0; const int FramesPerSecond = 60; void ticker(){ticks++;} //Function prototypes //------------------- void Initialize(bool fullScreen); int main() { Initialize(FullScreen); bool done = false; while(!done)//main loop { while(ticks == 0) { rest(100 / FramesPerSecond);//rest until a full tick has passed } while(ticks > 0) { int old_ticks = ticks; if(Game->FrameAdvance())//advances frame { done = true; } ticks--; if(old_ticks <= ticks)//logic is taking too long: abort and draw a frame break; } Game->Draw(); } return 0; } END_OF_MAIN(); void Initialize(bool fullScreen) { //setup allegro and install stuff allegro_init(); install_keyboard(); install_timer(); //setup timer LOCK_VARIABLE(ticks); LOCK_FUNCTION(ticker); install_int_ex(ticker, BPS_TO_TIMER(FramesPerSecond)); //set color depth and init graphics set_color_depth(64); if ( FullScreen ) set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, ScreenWidth, ScreenHeight, 0, 0); else set_gfx_mode(GFX_AUTODETECT_WINDOWED, ScreenWidth, ScreenHeight, 0, 0); //inits stuff Game->StartGame(ScreenWidth, ScreenHeight, FullScreen); } GameLogic.h #ifndef _GAMELOGIC_H_ #define _GAMELOGIC_H_ //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include <string> #include <allegro.h> #include <iostream> #include "Defines.h" using namespace std; //----------------------------------------------------------------------------- // Name : GameLogic (Class) // Desc : Controls how the player interacts with the world //----------------------------------------------------------------------------- class GameLogic { public: //------------------------------------------------------------------------- // Constructors & Destructors for This Class. //------------------------------------------------------------------------- GameLogic(); virtual ~GameLogic(); void StartGame(int ScreenWidth, int ScreenHeight, bool FullScreen); bool FrameAdvance(); bool ProcessInput(); void Draw(); int m_ScreenWidth; int m_ScreenHeight; bool m_FullScreen; BITMAP *m_BackBuffer; //temp sprite BITMAP *test; }; #endif //_GAMELOGIC_H_ GameLogic.cpp //----------------------------------------------------------------------------- // Includes //----------------------------------------------------------------------------- #include "GameLogic.h" //----------------------------------------------------------------------------- // Name : GameLogic () (Constructor) // Desc : GameLogic Class Constructor //----------------------------------------------------------------------------- GameLogic::GameLogic() { m_BackBuffer = NULL; test = NULL; m_ScreenWidth = 0; m_ScreenHeight = 0; m_FullScreen = false; } //----------------------------------------------------------------------------- // Name : ~GameLogic () (Destructor) // Desc : GameLogic Class Destructor //----------------------------------------------------------------------------- GameLogic::~GameLogic() { delete m_BackBuffer; m_BackBuffer = NULL; delete test; test = NULL; m_ScreenWidth = 0; m_ScreenHeight = 0; m_FullScreen = false; } //----------------------------------------------------------------------------- // Name : SartGame() // Desc : Starts the game engine //----------------------------------------------------------------------------- void GameLogic::StartGame(int ScreenWidth, int ScreenHeight, bool FullScreen) { m_ScreenWidth = ScreenWidth; m_ScreenHeight = ScreenHeight; m_FullScreen = FullScreen; m_BackBuffer = create_bitmap(ScreenWidth, ScreenHeight); test = load_bitmap("Test.bmp", NULL); } //----------------------------------------------------------------------------- // Name : FrameAdvance() // Desc : Advances the game one frame //----------------------------------------------------------------------------- bool GameLogic::FrameAdvance() { bool quit = ProcessInput(); return quit; } //----------------------------------------------------------------------------- // Name : ProcessInput() // Desc : Precesses Input //----------------------------------------------------------------------------- bool GameLogic::ProcessInput() { if ( key[KEY_F5] )//fullscreen toggle { if ( m_FullScreen ) { set_gfx_mode(GFX_AUTODETECT_WINDOWED, m_ScreenWidth, m_ScreenHeight, 0, 0); m_FullScreen = false; } else { set_gfx_mode(GFX_AUTODETECT_FULLSCREEN, m_ScreenWidth, m_ScreenHeight, 0, 0); m_FullScreen = true; } } if ( key[KEY_ESC] )//quit game ESC { return true; } return false; } //----------------------------------------------------------------------------- // Name : Draw() // Desc : Draws all the shit //----------------------------------------------------------------------------- void GameLogic::Draw() { text_mode(-1); vsync(); -------------------------------------------------NEW ERROR HERE acquire_screen(); //Draw graphics here masked_blit(test, m_BackBuffer, 0, 0, 0, 0, 500, 500); blit(m_BackBuffer, screen, 0, 0, 0, 0, m_ScreenWidth, m_ScreenHeight); clear_bitmap(m_BackBuffer);//we want to clear off the buffer after we draw it to the screen so we can draw on a clean buffer next time around. release_screen(); } debug: - this 0x003d3148 {m_ScreenWidth=640 m_ScreenHeight=480 m_FullScreen=false ...} GameLogic * const - __vfptr 0x00418800 const GameLogic::`vftable' * [0] 0x0041100f GameLogic::`vector deleting destructor'(unsigned int) * m_ScreenWidth 640 int m_ScreenHeight 480 int m_FullScreen false bool - m_BackBuffer 0x00000000 {w=??? h=??? clip=??? ...} BITMAP * w CXX0030: Error: expression cannot be evaluated h CXX0030: Error: expression cannot be evaluated clip CXX0030: Error: expression cannot be evaluated cl CXX0030: Error: expression cannot be evaluated cr CXX0030: Error: expression cannot be evaluated ct CXX0030: Error: expression cannot be evaluated cb CXX0030: Error: expression cannot be evaluated vtable CXX0017: Error: symbol "" not found write_bank CXX0030: Error: expression cannot be evaluated read_bank CXX0030: Error: expression cannot be evaluated dat CXX0030: Error: expression cannot be evaluated id CXX0030: Error: expression cannot be evaluated extra CXX0030: Error: expression cannot be evaluated x_ofs CXX0030: Error: expression cannot be evaluated y_ofs CXX0030: Error: expression cannot be evaluated seg CXX0030: Error: expression cannot be evaluated line 0x00000040 unsigned char * [0] - test 0x00000000 {w=??? h=??? clip=??? ...} BITMAP * w CXX0030: Error: expression cannot be evaluated h CXX0030: Error: expression cannot be evaluated clip CXX0030: Error: expression cannot be evaluated cl CXX0030: Error: expression cannot be evaluated cr CXX0030: Error: expression cannot be evaluated ct CXX0030: Error: expression cannot be evaluated cb CXX0030: Error: expression cannot be evaluated vtable CXX0030: Error: expression cannot be evaluated write_bank CXX0030: Error: expression cannot be evaluated read_bank CXX0030: Error: expression cannot be evaluated dat CXX0030: Error: expression cannot be evaluated id CXX0030: Error: expression cannot be evaluated extra CXX0030: Error: expression cannot be evaluated x_ofs CXX0030: Error: expression cannot be evaluated y_ofs CXX0030: Error: expression cannot be evaluated seg CXX0030: Error: expression cannot be evaluated line 0x00000040 unsigned char * [0] Edit:Added where the new error is [Edited by - Davidtse on December 13, 2008 1:32:58 PM]

Share this post


Link to post
Share on other sites
Advertisement
Thanks, cant believe I did not catch that. but now I have a new error. I edited the first post to show where the new error is, and the new debug info. I think it may have to do with where I initialized allegro, I commented all the code and put in some basic allegro hello world code and it worked fine so Its not the libs or includes, or anything like that.

Thanks, David

Share this post


Link to post
Share on other sites
This might be straying from the topic but you shouldn't use rest() because you are loosing your cpu time. Use interrupt functions instead and play it cool.

Share this post


Link to post
Share on other sites
thanks francoispress, but does anyone know what the problem is, the only thing I can think to do is move all the code out of the gamelogic class and just put in main, thanks

Share this post


Link to post
Share on other sites
Quote:
Original post by Davidtse
thanks francoispress, but does anyone know what the problem is, the only thing I can think to do is move all the code out of the gamelogic class and just put in main, thanks
Use source tags. No one wants to read through all of that and try and re-structure it all in their heads.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!