void StateEditorMode::EditorModeMouseActivity() { if(GetEvent()->type == ALLEGRO_EVENT_MOUSE_BUTTON_DOWN) { switch(GetEvent()->mouse.button) { case 1: SetLeftMouseDown(true); break; case 2: SetRightMouseDown(true); SetRightMousePos(GetMouseCursorX(),GetMouseCursorY()); GetMap()->SetOldMapXOffset(GetMap()->GetMapXOffset()); GetMap()->SetOldMapYOffset(GetMap()->GetMapYOffset()); break; } } if(GetEvent()->type == ALLEGRO_EVENT_MOUSE_BUTTON_UP) { switch(GetEvent()->mouse.button) { case 1: SetLeftMouseDown(false); break; case 2: SetRightMouseDown(false); break; } } }
void StateGameMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); player1_ = new Player(GetSettings(),GetMap()); player1_->SetGravityY(-9.8); for(int i = 0; i < GetImageLoader()->GetImageSetDictionary().size(); i++) { if(GetImageLoader()->GetImageSetDictionary()[i]->GetImageSetId() == EnumDLL::IMAGESETS::PLAYERIMAGESET) { player1_->SetObjectImageColor(GetImageLoader()->GetImageSetDictionary()[i]->GetImageDictionary()[0]); } } SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }
void StateEditorMode::InitState(ALLEGRO_DISPLAY *display, Settings *settings, Map *currentMap, ImageLoader *imageLoader){ SetImageLoader(imageLoader); SetDisplay(display); SetSettings(settings); SetId(EnumDLL::STATES::EDITORMODE); SetEventQueue(NULL); SetRedraw(true); SetDone(false); SetRunning(true); SetKeyPressReturnVal(EnumDLL::STATES::DEFAULT); SetFont(al_load_font("arial.ttf", 20, 0)); SetTimer(al_create_timer(1.0/60)); SetEventQueue(al_create_event_queue()); SetStateDirection(EnumDLL::STATEDIRECTION::NA); al_register_event_source(GetEventQueue(), al_get_keyboard_event_source()); al_register_event_source(GetEventQueue(), al_get_mouse_event_source()); al_register_event_source(GetEventQueue(), al_get_display_event_source(GetDisplay())); al_register_event_source(GetEventQueue(), al_get_timer_event_source(GetTimer())); SetMouseCursorPos(0,0); SetRightMousePos(0,0); SetRightMouseDown(false); SetLeftMouseDown(false); SetPlayerSelected(false); SetMap(currentMap); editorOverLayController_ = new EditorOverLayController(settings, imageLoader); SetChosenColor(al_map_rgb_f(1,1,1)); al_start_timer(GetTimer()); }