Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
24 May, 2013, 03:51:25 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: [1]   Go Down
  Print  
Author Topic: EXA: Scale up sprites -  (Read 417 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
Keoni29
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Yesterday at 21:19:09
Date Registered: 15 March, 2011, 16:23:33
Location: The Netherlands
Posts: 1117


Topic starter
Total Post Ratings: +146

View Profile WWW
« on: 31 January, 2012, 12:06:46 »
0

Have you ever wanted to scale up a sprite? Use this AXE subroutine:

1
2
3
4
5
6
7
8
9
10
11
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6^2
Rect(B*r3+r1,A*r4+r2,r3,r4
End
r6/2->r6
End
End
Now use this code to call the subroutine:

1
SPR(x,y,w,h,pic

It uses rectangles of size w,h to display the sprite. I guess this code can be optimized, but it does the job.

For example:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
.SPRITESC
[3C42A581A599423C]->Pic1
ClrDraw
For(A,2,10
SPR(5,5,C,C/2,Pic1
Pause 300
DispGraphClrDraw
End
Pause 1000
Return
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6^2
Rect(B*r3+r1,A*r4+r2,r3,r4
End
r6/2->r6
End
End

I hope you find this information helpful. Please leave suggestions and or questions.
« Last Edit: 31 January, 2012, 12:07:16 by Keoni29 » Logged


Spoiler for Hidden:
Last signature update 10:55 april 22nd 2013
kindermoumoute
LV8 Addict (Next: 1000)
********
Offline Offline

Last Login: 20 May, 2013, 23:02:59
Date Registered: 15 May, 2010, 17:53:56
Posts: 836


Total Post Ratings: +51

View Profile
« Reply #1 on: 15 February, 2012, 14:11:29 »
0

I suppose that's like Pt-Off() command, you can't draw white pixels ?

Why you didn't use BYTEeBIT command ?

1
2
3
4
5
6
7
8
9
10
Lbl SPR
For(A,0,7
{r5+A}->r6
For(B,0,7
If r6eB
Rect(B*r3+r1,A*r4+r2,r3,r4
End
End
End

e = exp token.
Logged

Projects :

Worms armageddon z80 :
- smoothscrolling Pixelmapping : 100%
- Map editor : 80%
- Game System : 0%

Tutoriel français sur l'Axe Parser
- 1ère partie : en ligne.
- 2ème partie : en ligne.
- 3ème partie : en ligne.
- 4ème partie : 10%
- Annexe : 100%
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 03:20:51
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50227


Total Post Ratings: +2615

View Profile WWW
« Reply #2 on: 16 February, 2012, 07:18:16 »
0

How fast does this runs by the way? I'm curious if it could be used in-game. I made a scaling routine for 8x8 sprites back then, which, however, used 8x8 plain white or black squares and thus, the bottom and right were weird if I remember. It ran at around 10 fps. Not really useable in a real-time animation, but one person could simply pre-render each instance of zoomed up sprite prior the main game loop then temporarily store them into a buffer and displayed when needed.
Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Keoni29
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Yesterday at 21:19:09
Date Registered: 15 March, 2011, 16:23:33
Location: The Netherlands
Posts: 1117


Topic starter
Total Post Ratings: +146

View Profile WWW
« Reply #3 on: 17 February, 2012, 11:13:45 »
0

How fast does this runs by the way? I'm curious if it could be used in-game. I made a scaling routine for 8x8 sprites back then, which, however, used 8x8 plain white or black squares and thus, the bottom and right were weird if I remember. It ran at around 10 fps. Not really useable in a real-time animation, but one person could simply pre-render each instance of zoomed up sprite prior the main game loop then temporarily store them into a buffer and displayed when needed.
I will try to render it 1000 times and see how long it takes.
Logged


Spoiler for Hidden:
Last signature update 10:55 april 22nd 2013
DJ Omnimaga
Retired Omnimaga founder (Site issues must be PM'ed to Netham45, Eeems, Shmibs, Deep Thought and AngelFish, not me.)
Editor
LV15 Omnimagician (Next: --)
*
Offline Offline

Gender: Male
Last Login: Today at 03:20:51
Date Registered: 25 August, 2008, 07:00:21
Location: Québec (Canada)
Posts: 50227


Total Post Ratings: +2615

View Profile WWW
« Reply #4 on: 17 February, 2012, 16:32:27 »
0

Ok here was my routine. From what I remember now, I think I actually drew an extra row of white squares below. It was definitively not very reliable, due to erasing stuff below.

http://www.omnimaga.org/index.php?topic=3419.msg39533#msg39533

Logged

Retired 83+ coder, Omnimaga/TIMGUL founder. Now doing power metal music (formerly did electronica)

Follow me on Bandcamp|Facebook|Reverbnation|Youtube|Twitter|Myspace
Keoni29
LV9 Veteran (Next: 1337)
*********
Offline Offline

Gender: Male
Last Login: Yesterday at 21:19:09
Date Registered: 15 March, 2011, 16:23:33
Location: The Netherlands
Posts: 1117


Topic starter
Total Post Ratings: +146

View Profile WWW
« Reply #5 on: 17 February, 2012, 18:03:00 »
0

My routine is much quicker since it doesn't scale partially.
Logged


Spoiler for Hidden:
Last signature update 10:55 april 22nd 2013
Pages: [1]   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.171 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.