Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "SGL_Engine.h"
- /*
- TRY TO GET_
- if the button is the window, allow clickable.
- when allowed clickable, get postion.
- */
- #define ESC_KEY 256
- using namespace sgl;
- int main() {
- sgl::RenderWindow window(1000, 1000, "sgl window");
- window.forceDraw();
- sgl::initRender(window.getSizeX(), window.getSizeY());
- sgl::Keyboard key(window.getWindow , sgl::keyCheck);
- int PointSize = 20;
- float Pointvertex[] = { window.getSizeX() / 2 , window.getSizeY() / 2 };
- /* game loop */
- sgl::MouseInput ms;
- ms.isEntered(window.getWindow , sgl::getCursorEntered);
- ms.getPosition(window.getWindow, sgl::getPositionButton);
- ms.getButtonPressed(window.getWindow, sgl::getButtonPressed);
- while (!window.shouldclose(window.getWindow)) {
- window.clear();
- if (sgl::IsCursorEntered) {
- ms.hideCursor(window.getWindow);
- if (sgl::isButtonPressedLEFT) {
- cout << "LEFT===========================================" << endl;
- cout << sgl::getCursorX << "," << sgl::getCursorY << endl;
- cout << "END===========================================" << endl;
- }
- if (sgl::isButtonPressedRIGHT) {
- cout << "RIGHT==========================================" << endl;
- cout << sgl::getCursorX << "," << sgl::getCursorY << endl;
- cout << "END===========================================" << endl;
- }
- if (sgl::isButtonPressedMiddle) {
- cout << "MIDDLE==========================================" << endl;
- cout << sgl::getCursorX << "," << sgl::getCursorY << endl;
- cout << "END===========================================" << endl;
- }
- }
- else {
- ms.CursorShow(window.getWindow);
- }
- // function goes here.
- if (sgl::SGL_KEY == ESC_KEY) {
- window.close();
- // closes window
- }
- if (sgl::SGL_KEY == 73) {
- PointSize++;
- }
- if (sgl::SGL_KEY == 70) {
- PointSize--;
- }
- // drawing should go here.
- sgl::drawPoint dp(2, 0, Pointvertex, 0, 1, PointSize);
- window.swap();
- window.pollevents();
- }
- window.close();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement