Author Topic: Why doesnt this work...  (Read 229 times)

b1tsh1ft3r

  • Newbie
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Why doesnt this work...
« on: October 17, 2020, 03:48:48 am »
This seems fairly straight forward and SHOULD work. Is there something i am missing here? The idea was to have a global integer variable
that could change what was drawn in the draw_screen function.

vars.h
Code: [Select]
#ifndef __VARS_H__
#define __VARS_H__

typedef struct
{
   int test; 
} _vars;

extern _vars vars;

#endif

main.c
Code: [Select]
#include <jo/jo.h>
#include "vars.h"

void draw_screen(void)
{
jo_clear_screen();

if(vars.test == 1)
{
jo_printf_with_color(15, 5, JO_COLOR_INDEX_White, "test 1");
}

if(vars.test == 2)
{
jo_printf_with_color(15, 5, JO_COLOR_INDEX_White, "test 2");
}
}

void initialize(void)
{
jo_core_init(JO_COLOR_Black);
jo_core_add_callback(draw_screen);
jo_core_run();
}

void jo_main(void)
{
initialize();
vars.test = 2;
}
« Last Edit: October 17, 2020, 07:34:51 pm by b1tsh1ft3r »

b1tsh1ft3r

  • Newbie
  • *
  • Posts: 19
  • Karma: +1/-0
    • View Profile
Re: Why doesnt this work...
« Reply #1 on: October 18, 2020, 08:36:02 pm »
Nvermind, figure out jo_core_run() is a blocking function

 

Sitemap 1 2 3 4 5 6 7 8 9 10