Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class game
- {
- game_loop()
- {
- while (window.isOpen())
- {
- loops = 0;
- while (clock.getElapsedTime().asMilliseconds() > next_tick && loops < MAX_FRAMESKIP)
- {
- next_tick += SKIP_TICKS;
- ++loops;
- m_state.on_update();
- }
- interpolation = static_cast <float> (clock.getElapsedTime().asMilliseconds() + SKIP_TICKS - next_tick) / static_cast <float> (SKIP_TICKS);
- m_state.on_draw();
- }
- }
- game_state m_state; // can be any of the 2
- };
- class game_state
- {
- sf::RenderWindow m_window;
- virtual void on_draw() = 0;
- virtual void on_update() = 0;
- }
- class login_state : public game_state
- {
- // same idea as channel, there is no other state in the game
- }
- class channel_state : public game_state
- {
- channel_state()
- {
- // make sure all the drawing class have a variable to the game_logic class, so they know the current x,y and what animation it is doing
- }
- override void on_draw()
- {
- // handle input
- // handle packets
- m_char.update();
- m_mobs.update();
- m_drop.update();
- // etcetc
- }
- override void on_update()
- {
- m_draw_map.draw();
- m_draw_chars.draw();// etcetc
- }
- map m_map;
- draw_map m_draw_map;
- draw_character m_draw_chars;
- character m_char
- }
- class camera
- {
- // compare the local_character possition in addition to the map, so lets us know what rect the user can actually see
- }
- class map
- {
- std::vector<footholds> m_fh;
- std::unordered_map<ID, drops> m_drops;
- std::unordered_map<ID, character> m_chars; // multyplaer, so there could be 4 players (or more if I ever make it like that )
- }
- class thingie // what is a name for this
- {
- dword m_x, m_y;
- dword m_speed;
- dword m_acc;
- }
- class footholds
- {
- }
- class drop : thingie
- {
- }
- class drops
- {
- std::unoredered_map<ID, drop> m_drops;
- }
- class mob : thingie
- {
- }
- class mobs
- {
- std::unoredered_map<ID, mob> m_mobs;
- }
- class character : thingie
- {
- }
- class local_character : character
- {
- }
- class char_pool
- {
- std::unoredered_map<ID, character> m_chars;
- }
- //////////////////////////////////////////////////
- // different namespace and stuff
- //////////////////////////////////////////////////
- class drawable
- {
- virtual void draw() = 0;
- }
- class draw_map : public drawable
- {
- std::vector<map_regio> m_regions;
- draw()
- {
- // check the camera class to know what map_regions are visible, then draw these
- }
- // load some theme of the map texture_sheet
- // load some specific textures for background? maybe?
- // no need for info about it, map is static.
- }
- class map_region : public drawable
- {
- std::vector<tile> m_tiles;
- const size = 600; // rect of 600x600
- draw()
- {
- // first draw background
- // draw layer 1 tiles
- // draw layer 2 tiles
- }
- }
- class tile
- {
- dword m_x;
- dword m_y;
- }
- class draw_windows : public drawable
- {
- // this class draws all the curent active window/menu and stuff
- // only 1 texutre sheeet needed for this
- draw()
- {
- }
- // make something for this
- }
- class draw_drops : public drawable
- {
- // load texture sheet from all drops - constant (reuse the one from inveotry frmo user)
- draw()
- {
- // draw all items in range, if we need performance, make sure items are in order, so we can use the same texture_sheet
- }
- m_drops m_info;
- }
- class draw_mobs : public drawable
- {
- // load texture for the current monster, so all its moves, walking/ standing/ jumping
- // use some animation class to know which texture to use
- draw()
- {
- // draw mobs in view and determine what texture to use for its current animation
- }
- mobs m_info;
- }
- class draw_characters : public drawable
- {
- // load texture for the character, so all its moves, walking/ standing/ jumping
- // also load textures for the current items people are wearing, DONT LOAD ALL OF THEM INTO A TEXUTRE
- // use some animation class to know which texture to use
- draw()
- {
- // draw all character including the user
- }
- m_char_pool m_info;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement