Hello! I'm Looking for some MSX-C examples that uses glib.h for graphical enviroments

Page 1/3
| 2 | 3

By Jin

Resident (37)

Jin's picture

22-05-2018, 20:59

Hello everyone.

I am trying to learn how to draw and move sprites and some other stuff without any success ^_^

can someone tell me where i can find working examples of msx-c 1.2 programs?

i am using the glib.h graphic library and all that o know is drawing pixels and squares and rectangles.

Some examples that ive found with sprites seems to be incomplete (only a part of program, that gives message errors when i try to compile them) even when i include libraries like <_stdio._h> <_glib_.h>

I saw the manuals out there showing the syntaxes but i couldn't write any program only knowing the syntaxe. I miss some examples to test and see how they work.

somebody can help me?

Login or register to post comments

By DarkSchneider

Paladin (769)

DarkSchneider's picture

22-05-2018, 21:34

Hi, take a look at this documentation I think is good for MSX-C.

http://www.fvue.nl/wiki/MSX-C_manual

You can look there all the libs functions. I think that for graphics one you have to initialize them before, with ginit().

For sprites, seems that you need to call inispr(size) before using them.
Also remember that hardware sprites are not like bitmap sprites, they have special rules and format, for color and graphics. Seems that you can define them with sprite() like in BASIC.
Then, draw sprites with the putspr() function. See that it only gets one color data, for single color sprites, this is sprites mode 1 (the MSX1 mode). For sprite mode 2, or multi-color sprites, first you need to call colspr() to set the color data for that plane (plane = sprite number from 0 to 31) and then putspr().

By Jin

Resident (37)

Jin's picture

22-05-2018, 22:13

Thanks for reply DarkSchneider

knowing these syntaxes and how they work helps a lot,

But without a complete example i just dont know how to draw sprite, how to organize a complete program to show them.

that's my problem when i try to study a new language like MSX-C. (a new language for me) ^_^

By Wolverine_nl

Paladin (1000)

Wolverine_nl's picture

22-05-2018, 22:36

Here on the forums are some of my old examples that work, search for msx-c Wink

By Wolverine_nl

Paladin (1000)

Wolverine_nl's picture

22-05-2018, 22:45

https://www.msx.org/forum/msx-talk/development/sprites-msx-c...

B-)
Maybe some interesting reading for you

By Jin

Resident (37)

Jin's picture

22-05-2018, 23:00

edited message.

the first example finally worked XD

thank you very much for your help Wolverine Big smile

now is time to understand how this example works and create my own sprites.

Thanks a lot!

By Wolverine_nl

Paladin (1000)

Wolverine_nl's picture

22-05-2018, 23:01

Ok, did my example at least work? It uses the glib.h, you might want to also adjust one thing in that example i mention a little bit lower. It should work fine if both .h files are in the same directory as the .c file

By Wolverine_nl

Paladin (1000)

Wolverine_nl's picture

22-05-2018, 23:02

Just read your edited ply, good for you! Have fun, it is worth the time ;-)

By Jin

Resident (37)

Jin's picture

22-05-2018, 23:41

Some of examples that i have testd so far:

https://www.youtube.com/watch?v=en7tVEXkhFQ&feature=youtu.be

By Grauw

Enlighted (7790)

Grauw's picture

23-05-2018, 00:22

Nice! Big smile

By Jin

Resident (37)

Jin's picture

23-05-2018, 02:50

Hello all! and Wolverine_nl

Now i have another question Big smile

I Just realized that the sprite example just created a "scanlined" 16x16 sprite

8 lines colored and 8 lines black. How to correct this?

Page 1/3
| 2 | 3
My MSX profile