adjust for macos experience
This commit is contained in:
+16
-4
@@ -1,6 +1,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#define RAYGUI_IMPLEMENTATION
|
#define RAYGUI_IMPLEMENTATION
|
||||||
#include <raygui.h>
|
#include <raygui.h>
|
||||||
@@ -18,12 +19,23 @@
|
|||||||
void switch_mode(Mode mode) {
|
void switch_mode(Mode mode) {
|
||||||
set_mode(mode);
|
set_mode(mode);
|
||||||
|
|
||||||
|
int monitor = GetCurrentMonitor();
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case WINDOW:
|
case WINDOW:
|
||||||
SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
|
SetWindowSize(WINDOW_WIDTH, WINDOW_HEIGHT);
|
||||||
|
SetWindowState(FLAG_WINDOW_TRANSPARENT | FLAG_WINDOW_UNDECORATED);
|
||||||
|
SetWindowOpacity(1);
|
||||||
|
|
||||||
|
// cneter in screen
|
||||||
|
SetWindowPosition((GetMonitorWidth(monitor) / 2) - (WINDOW_WIDTH / 2), (GetMonitorHeight(monitor) / 2) - (WINDOW_HEIGHT / 2));
|
||||||
break;
|
break;
|
||||||
case OVERLAY:
|
case OVERLAY:
|
||||||
|
SetWindowOpacity(0.5);
|
||||||
SetWindowSize(OVERLAY_WIDTH, OVERLAY_HEIGHT);
|
SetWindowSize(OVERLAY_WIDTH, OVERLAY_HEIGHT);
|
||||||
|
SetWindowState(FLAG_WINDOW_TRANSPARENT | FLAG_WINDOW_UNDECORATED | FLAG_WINDOW_TOPMOST);
|
||||||
|
|
||||||
|
// bottom right of screen
|
||||||
|
SetWindowPosition(GetMonitorWidth(monitor) - OVERLAY_WIDTH, GetMonitorHeight(monitor) - OVERLAY_HEIGHT);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@@ -108,11 +120,10 @@ void draw_graph(int x, int y) {
|
|||||||
GuiDisableTooltip();
|
GuiDisableTooltip();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool edit_mode = false;
|
bool edit_mode = true;
|
||||||
|
|
||||||
void render_window() {
|
void render_window() {
|
||||||
ClearBackground(RAYWHITE);
|
ClearBackground(RAYWHITE);
|
||||||
DrawFPS(WINDOW_WIDTH - 50, 10);
|
|
||||||
|
|
||||||
Rectangle text_box_rect = {(WINDOW_WIDTH / 2) - 200, (WINDOW_HEIGHT / 2) - 200, 400, 50};
|
Rectangle text_box_rect = {(WINDOW_WIDTH / 2) - 200, (WINDOW_HEIGHT / 2) - 200, 400, 50};
|
||||||
Vector2 mouse_pos = GetMousePosition();
|
Vector2 mouse_pos = GetMousePosition();
|
||||||
@@ -138,9 +149,8 @@ void render_window() {
|
|||||||
|
|
||||||
void render_overlay() {
|
void render_overlay() {
|
||||||
ClearBackground(BLANK);
|
ClearBackground(BLANK);
|
||||||
DrawFPS(OVERLAY_WIDTH - 50, 10);
|
|
||||||
|
|
||||||
const Rectangle button_rect = {OVERLAY_WIDTH - 100, 10, 100, 25};
|
const Rectangle button_rect = {OVERLAY_WIDTH - 100, OVERLAY_HEIGHT - 30, 100, 25};
|
||||||
int active = 0;
|
int active = 0;
|
||||||
|
|
||||||
if (GuiToggleSlider(button_rect, "Toggle mode", &active)) {
|
if (GuiToggleSlider(button_rect, "Toggle mode", &active)) {
|
||||||
@@ -150,6 +160,7 @@ void render_overlay() {
|
|||||||
GuiSetStyle(DEFAULT, TEXT_SIZE, 75);
|
GuiSetStyle(DEFAULT, TEXT_SIZE, 75);
|
||||||
GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_CHAR);
|
GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, TEXT_WRAP_CHAR);
|
||||||
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
GuiSetStyle(LABEL, TEXT_ALIGNMENT, TEXT_ALIGN_CENTER);
|
||||||
|
GuiSetStyle(LABEL, TEXT_COLOR_NORMAL, ColorToInt(GOLD));
|
||||||
GuiLabel((Rectangle){0, 0, OVERLAY_WIDTH, OVERLAY_HEIGHT}, get_intention());
|
GuiLabel((Rectangle){0, 0, OVERLAY_WIDTH, OVERLAY_HEIGHT}, get_intention());
|
||||||
GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, 0);
|
GuiSetStyle(DEFAULT, TEXT_WRAP_MODE, 0);
|
||||||
}
|
}
|
||||||
@@ -163,6 +174,7 @@ int main(int argc, char *argv[]) {
|
|||||||
|
|
||||||
printf("Welcome to Flowy.adhd\n");
|
printf("Welcome to Flowy.adhd\n");
|
||||||
|
|
||||||
|
SetConfigFlags(FLAG_WINDOW_TRANSPARENT | FLAG_WINDOW_UNDECORATED);
|
||||||
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Flowy.adhd");
|
InitWindow(WINDOW_WIDTH, WINDOW_HEIGHT, "Flowy.adhd");
|
||||||
|
|
||||||
while (!WindowShouldClose()) {
|
while (!WindowShouldClose()) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <stdbool.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <sqlite3.h>
|
#include <sqlite3.h>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user