Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Aroth

RPG game programming with no api

This topic is 5455 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My friends and I were thinking about making a 2d rpg type of game like Zelda, and I''m reading "sam''s teach yourself game programming in 24 hrs". They don''t use api''s like DirectX or OpenGl in that book, just windows, and none of the examples has background scrolling so should I stick to regular windows routines or learn OpenGl which I already started learning? and if it is possible in windows, does anyone know how accomplish it or know anywhere I can read about it? ~John L

Share this post


Link to post
Share on other sites
Advertisement
I would suggest using ALLEGRO (http://www.allegro.cc)

It''s a wonderful API for 2d graphics. Very easy to use after you get it installed. The install isn''t too bad, you can download prebuilt binaries for MSVC, etc.

Share this post


Link to post
Share on other sites
It''s possible, but not exactly fast. Also, just to correct you on one minor thing, you''re still using an API, that is to say, the Win32 API. Almost all programming will involve an API of some sort.

As far as scrolling, the first step is to learn how to display bitmaps on the screen. If you can do that, it''s fairly straightforward. Just store the screen position in variables, and draw to the screen like this:


for (int x = screen_x_pos; x < screen_x_pos+SCREEN_WIDTH; x += TILE_WIDTH){
for (int y = screen_y_pos; y < screen_y_pos+SCREEN_HEIGHT; y += TILE_HEIGHT){
DrawTile(map[x/TILE_WIDTH][y/TILE_HEIGHT],x,y);
}
}


You''d also have to remember to invalidate the screen frequently so you can actually draw new stuff on the window. For that, just use InvalidateRect(NULL) when you recieve input.

One final note, this is probably going to run too slow on Windows to be worth spending too much time on. In that case, I''d suggest you do look at some other API. You''ll find, however, that in a lot of cases they operate pretty much the same in regards to how you''d draw tiles.

I couldn''t tell whether you were asking whether you could use the Win32 API, or whether you should use the Win32 API, so I tried to answer both. Could: sure. Should: probably not.

-Arek the Absolute

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!