#include <xtd/drawing//system_brushes>
#include <xtd/forms/application>
#include <xtd/forms/form>
#include <xtd/forms/user_control>
namespace toggle_light_example {
public:
toggle_light() = default;
protected:
on = !on;
refresh();
}
e.graphics().clear(back_color());
}
private:
bool on = false;
};
class main_form :
public form {
public:
main_form() {
client_size({600, 600});
for (
auto y = 0;
y < num_y; ++
y)
for (
auto x = 0;
x < num_x; ++
x)
toggle_lights[
x][
y].parent(*
this);
}
static void main() {
}
protected:
auto step_x = client_size().width / num_x;
auto step_y = client_size().height / num_y;
for (
auto y = 0;
y < num_y; ++
y)
for (
auto x = 0;
x < num_x; ++
x)
toggle_lights[
x][
y].bounds({
x * step_x,
y * step_y, step_x, step_y});
}
private:
static constexpr int num_x = 20;
static constexpr int num_y = 20;
std::array<std::array<toggle_light, num_y>, num_x> toggle_lights;
};
}
auto main() -> int {
}
static xtd::drawing::solid_brush accent()
Gets a solid_brush that is the color of the accent.
Represents the base class for classes that contain event data, and provides a value to use for events...
Definition event_args.hpp:18
@ y
The Y key.
Definition console_key.hpp:136
@ x
The X key.
Definition console_key.hpp:134
@ e
The E key.
Definition console_key.hpp:96
The xtd::drawing namespace provides access to GDI+ basic graphics functionality. More advanced functi...
Definition actions_system_images.hpp:10
Contains classes that represent ASCII and Unicode character encodings; abstract base classes for conv...
Definition basic_string_builder.hpp:16
The xtd namespace contains all fundamental classes to access Hardware, Os, System,...
Definition abstract_object.hpp:8