Skip to content

Commit

Permalink
implement IntelliSense hints for MSVC
Browse files Browse the repository at this point in the history
Signed-off-by: Steven Noonan <steven@uplinklabs.net>
  • Loading branch information
tycho committed Nov 2, 2022
1 parent 985d652 commit ba3c786
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
8 changes: 8 additions & 0 deletions glad/generator/c/templates/base_template.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,11 @@ extern "C" {
{% block commands %}
{{ template_utils.write_function_typedefs(feature_set.commands) }}
{% if not options.mx %}
#ifdef __INTELLISENSE__
{{ template_utils.write_function_definitions(feature_set.commands) }}
#else
{{ template_utils.write_function_declarations(feature_set.commands, debug=options.debug) }}
#endif
{% else %}
typedef struct Glad{{ feature_set.name|api }}Context {
void* userptr;
Expand All @@ -93,9 +97,13 @@ GLAD_API_CALL Glad{{ feature_set.name|api }}Context* glad_{{ feature_set.name }}
#define GLAD_{{ extension.name }} (glad_{{ feature_set.name }}_context->{{ extension.name|no_prefix }})
{% endfor %}

#ifdef __INTELLISENSE__
{{ template_utils.write_function_definitions(feature_set.commands) }}
#else
{% for command in feature_set.commands %}
#define {{ command.name }} (glad_{{ feature_set.name }}_context->{{ command.name|no_prefix }})
{% endfor %}
#endif
{% endif %}

{% endif %}
Expand Down
4 changes: 4 additions & 0 deletions glad/generator/c/templates/wgl.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@
{{ template_utils.write_function_typedefs(feature_set.commands) }}
{# these are already defined in windows.h #}
{% set blacklist = feature_set.features[0].get_requirements(spec, feature_set=feature_set).commands %}
#ifdef __INTELLISENSE__
{{ template_utils.write_function_definitions(feature_set.commands|reject('existsin', blacklist)) }}
#else
{{ template_utils.write_function_declarations(feature_set.commands|reject('existsin', blacklist)) }}
#endif
{% endblock %}


Expand Down

0 comments on commit ba3c786

Please sign in to comment.