Help with creating new header / modifying rp6502-vscode example(s) (for novices) #65
-
Hey again RP6502 community, Something that was bothering me yesterday was that there wasn't a "complete doofus with goldfish memory" sort of library/header for us to use when doing the initialization of various graphical modes. Given the examples from both github and video, it'd be nice if you could 'just' call a function for any given init work, and what would be having 5-10 lines of specific init code in a certain order and values would be simplified to one or two calls. I tried making something really basic, base off of the provided examples but VSCode / Cmake isn't being helpful in seeing the new header file, that's right next to the base (rp6502.h) one in the folder. Here's the code so far: hello.c modified
New rp6502_easy_gfx.h file in rp6502-vscode/include
Long story short: It'd be nice to understand how header files are properly made, and how not to do XYZ as well, but getting to debugging the header file is hard when said file can't be seen. I've never edited CMAKE configs either, so any advice (and why it doesn't look through all of include folder) would be nice |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 1 reply
-
I've been referencing Tetricks https://github.com/orgs/picocomputer/discussions/54 Additionally, they seem to have all the init code not 'abstracted' away to a header, and have it in its normal form in the C file. Compilation for the 'header' in the src directory and properly found by the compiler/hello.c is giving plenty of errors as I don't know how to properly set it up, lol. |
Beta Was this translation helpful? Give feedback.
-
I already did all this work. Check out the bitmap_graphics_library |
Beta Was this translation helpful? Give feedback.
-
In response to your original post at the top:
Rather, try:
...Those are multi-pass include protections unnecessary on a *.c source file. c. Change the two following from:
to:
d. Remove all those single backslashes (if they are indeed single backslashes and not editor artifacts / issues in your post) at the end of every line of your two function definitions. If you want comments in c, be sure to either use two consecutive backslashes as: d. Remember to declare your two new c-functions near the top of your file, before the 1st function define:
Moreover, expanding on what vruumllc said concisely above... The above should allow you to better accomplish what you desired. (I didn't try this on my dev system; I'm just reading your code posted.) Hope this helps. |
Beta Was this translation helpful? Give feedback.
-
Thanks LOL Last time I coded in a C variant was a mixture of C and OpenCL two years ago, and the definitions and methods of sharing data can be quite different because of how detached and stupid the GPU is. But the bitmap library and its lack of "fully stuffed" headers made me realize how things work a bit differently and how to actually make functions of working code that you can recall, as I had expected them to work based on my cluelessness haha |
Beta Was this translation helpful? Give feedback.
In response to your original post at the top:
It appears C isn't your native language. /grin.
And IDEs like vscode with Cmake tend to hide users with all their "magic performed under-the-hood".
(Hence your comment about difficulty-to-debug header-file since the IDE isn't following your as written C-syntax.) /grin.
For include files in main.c there is a difference between:
#include <rp6502_easy_gfx.h>
and
#include "./rp6502_easy_gfx.h"
Or try:
#include "rp6502_easy_gfx.h"
For your new rp6502_easy_gfx.h file:
There are a couple new-to-C isssues...
The two new functions you've attempted to define are syntactically problematic. As currently written, the compiler pre-pass is interpreting…