Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GDI demo #59

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 14 additions & 5 deletions demo/GDI/main.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
#ifdef __MINGW32__
#else
#pragma comment(linker, "/SUBSYSTEM:windows")
#endif

#define WIN32_LEAN_AND_MEAN
#define FPS
#define _ITERATOR_DEBUG_LEVEL 0
#define _SCL_SECURE_NO_WARNINGS
Expand All @@ -8,8 +14,8 @@
#include "renderer.h"

static char logbuf[4096];

static int logbuf_updated = 0;
int running;
static int logbuf_updated = 0;
static float bg[3] = { 90, 95, 100 };
static long logbuf_idx = 0;

Expand Down Expand Up @@ -150,7 +156,7 @@ static void log_window(mu_Context* ctx) {
}

/* input textbox + submit button */
static char buf[128];
static char buf[128] = { 0 };

int submitted = 0;
mu_layout_row(ctx, 2, (int[]) { -70, -1 }, 0);
Expand Down Expand Up @@ -252,16 +258,19 @@ int main() {
mu_init(ctx);
ctx->text_width = text_width;
ctx->text_height = text_height;
printf("Initalized context...");
static char frame_rate[32];

/* main loop */
while (running) {
while (1) {
#ifdef FPS
QueryPerformanceFrequency(&freq);
QueryPerformanceCounter(&qpc_start);
#endif // FPS

if (!running) {
break;
}

r_handle_input(ctx);

/* process frame */
Expand Down
10 changes: 8 additions & 2 deletions demo/GDI/renderer.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,15 @@
static int width = 800;
static int height = 600;

int running;
static int needs_refresh = 1;


#ifdef __MINGW32__
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be

#ifndef __MINGW32__
       int running;
#endif

I've not yet tested it under mingw, but is there any issue while using mingw?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll be honest I cant remember - its been a while since I have looked at this. I do think there was a issue with exiting the window though yes.

#else
/*not sure why mingw does not like this?*/
int running;
#endif

static HWND window;
static HDC dc;

Expand Down Expand Up @@ -279,7 +285,7 @@ void r_handle_input(mu_Context* ctx)
case WM_SYSKEYUP:
{
int down = !((msg.lParam >> 31) & 1);
int ctrl = GetKeyState(VK_CONTROL) & (1 << 15);
//int ctrl = GetKeyState(VK_CONTROL) & (1 << 15);
switch (msg.wParam)
{
case VK_SHIFT:
Expand Down