36 lines
		
	
	
		
			914 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			914 B
		
	
	
	
		
			C++
		
	
	
	
	
	
#pragma once
 | 
						|
 | 
						|
#include <SDL3/SDL.h>
 | 
						|
#include <string>
 | 
						|
 | 
						|
#include "gfx/types.h"
 | 
						|
 | 
						|
class LoginScreen {
 | 
						|
public:
 | 
						|
  LoginScreen(int screen_width, int screen_height);
 | 
						|
  ~LoginScreen(void);
 | 
						|
 | 
						|
  void update(float dt);
 | 
						|
  void render(const RenderContext& context) const;
 | 
						|
  void handle_event(const SDL_Event* event);
 | 
						|
 | 
						|
  bool is_login_attempted(void)  const { return _login_attempted; }
 | 
						|
  std::string get_username(void) const { return _username_input; }
 | 
						|
  std::string get_password(void) const { return _password_input; }
 | 
						|
  std::string get_hostname(void) const { return _hostname_input; }
 | 
						|
 | 
						|
private:
 | 
						|
  /* UI State. */
 | 
						|
  std::string _username_input;
 | 
						|
  std::string _password_input;
 | 
						|
  std::string _hostname_input;
 | 
						|
 | 
						|
  bool _login_attempted   = false;
 | 
						|
  bool _is_new_account    = true;
 | 
						|
  int _active_field       = 0; /* 0: username, 1: password, 2: hostname. */
 | 
						|
 | 
						|
  /* Screen dimensions. */
 | 
						|
  int _screen_width;
 | 
						|
  int _screen_height;
 | 
						|
};
 |