My game has online highscore, and I present this in a page that contains a top row containing a back button and a title. The rest of the page is used for the top 10 scores.
Problem is that in landscape mode the screen only contains 9 of the 10 elements. So I implemented dragging so the user kan drag the list up and down to see the whole list.
But by dragging the list upwards it's items gets under the back button and the title. Can I somehow mask away the list for every item above y=80?
The back button and title is a png with transparent background so it does not look good at all :-/
You can do it by sccisor rectangle clipping or changing your camera viewport...
a. You can change the viewport
GraphicsDevice.Viewport = yourCamera.Viewport;
GraphicsDevice.Viewport = new Viewport(yourClippingArea);
b. You can use an scissor rectangle... setting a rasterizer state with scissor test enabled...
GraphicsDevice.ScissorRectangle = yourClippingArea;
GraphicsDevice.RasterizerState = new RasterizerState( ) { ScissorTestEnabled = true };
Related
I am creating a report in Fastreport 5.
How do I put all records of the detail band within a rectangle
without showing the horizontal lines between the items?
In QuickReport it was simple, just configure the properties of the band frame:
Frame.DrawTop: = True;
Frame.DrawLeft: = True;
Frame.DrawRight: = True;
Frame.DrawBottom: = True;
In this way the band had a contour.
This does not work on FastReport, so I'm drawing the rectangle inside each band, but the detail band does not behave as expected, ie without the lines between the record
A member of Embarcadero named Alan Glei help me with this answer:
You can add a blank text box, enable the Left and Right borders, mark the alignment of the same as client, and send it all back. With this you should have the look you want. Congratulations! It's solved.
I have several icons on my toolbar. One of which (highlighted in red) seem to 'drift' into position when view is rendered as if the flexible space kicks in after the image is rendered. Also, the image kind of moves from the adjacent button's top left corner (the filter icon) into position.
This only happens if the app is launched when an update became available while the app was either terminated or was in the background. While I do not understand why, it seems that rendering the default icon in viewDidLoad, followed by server status check and a change of image is the sequence that causes the issue.
Any thought what might cause this behaviour will be appreciated!
Code is very simple:
if newDataAvailbleOnServer() {
myBarButton.image = cloudWithArrowImage
} else {
myBarButton.image = simpleCloudImage
}
both images are of the same size and density.
my goal: have a background image which occupies the full window of the display. And then on it, place image buttons which will be nicely centered on this window (buttons being arranged in grid).
The image is 1920X1080.
I have other code snippet which follows exactly the same sequence and the image appears in background. So totally baffled. But wanted to understand the logic correctly of this code/instead of relying on luck!..Note that on the other working code, I do both a place and grid of the background_label !. With this code the buttons don't appear at all.
when I use background_label(content....), the image does appear in the background with buttons in front, but in that case the whole display window is not occupied. The image just expands to fill the area occupied by button images.
root = Tk()
root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight()))
content = ttk.Frame(root, padding=(3,3,12,12))
print(root.winfo_screenwidth(), root.winfo_screenheight())
#prints as 1920 & 1080
#old background_image_file='waves1600x926.gif'
background_image_file='Lake.gif' #this is 1080X1920
background_image=PhotoImage(file=background_image_file)
background_label =ttk.Label(root,image=background_image) #tried content instead of root also
background_label.place(x=0, y=0,relwidth=1, relheight=1)
background_label.grid()
logos=['abc','cbs','nbc','fox','cnbc','amc','bet']
logobuttons=defaultdict(str)
logoimgs=defaultdict(str)
for logo in logos:
logoimgs[logo]=PhotoImage(file=LOGODIR+logo+'.gif')
logobuttons[logo]=ttk.Button(content,image=logoimgs[logo])
content.grid(column=0, row=0, sticky=(N,S,E,W))
col=0
row=0
maxcols=5
for logo in logos:
logobuttons[logo].grid(row=row,column=col,pady=5,padx=5)
if col == maxcols:
col=0
row=row+1
else:
col=col+1
root.mainloop()
When you use both place and grid, only the last one you call for a given widget has any effect. Thus, when you call background_label.grid() it totally negates the effect of background_label.place(...). In other words, you need to remove the call to grid for this widget.
If you want a background image, the best solution is to use place with a relative width and height of 1. You should also create the widget that contains the image first, so it is lowest in the stacking order. Though, you can always lower it later.
I'm making a product site in Adobe Edge. I have a circle div that needs to grow in a span of, let's say, 2 seconds when mouseover. Then a text has to appear in it. When mouseout, the text must disappear and do the reverse animation back to normal size. The circle has also to grow from its center, not the top left corner. I'v been trying to do this for hours with jquery and css3 animations but failed to get a satisfying result.
This is very easy with edge animate.
make your circle element.
set a key frame at 00:00 on the timeline for the circles width and height.
press Q (the transform tool) or select the icon at the top left of the screen just to the right of the arrow.
The transform tool scales things based on the origin point, which is repositionable but is automatically in the center of the selected object.
go to 02:00 on the timeline.
resize your circle.
set a keyframe for your text at 0 opacity.
go forward on the timeline.
set another keyframe for your text at 100% opacity.
group the circle and text into a div.
right click on that div and press 'convert to symbol'.
go back to the stage by clicking 'stage' on the top left of the preview window.
select the object that you want to use to trigger the animation.
open the actions for that object.
paste the following code into a mouseover event: var mySymbolObject = sym.getSymbol("INSERT THE NAME OF YOUR SYMBOL").play();
now make a mouseout event and paste this code: var mySymbolObject = sym.getSymbol("INSERT THE NAME OF YOUR SYMBOL").playReverse();
now what should happen is that onMouseOver, the timeline for that symbol plays forward, and onMouseOut, the timeline for that symbol plays in reverse. This way, if the animation is half way through and they mouse out, it will reverse from where it's at back to the beginning.
Probably you would like also to use mouseenter/mouseleave events rather than mouseover/mouseout, if you will nest text div inside circle div.
http://www.bennadel.com/blog/1805-jQuery-Events-MouseOver-MouseOut-vs-MouseEnter-MouseLeave.html
I've written some code which displays a wx.Frame, within which there is a wx.Panel, within which there is a jpg. The jpg is the same size as the frame, so that when the program starts up the user is presented with a picture covering the whole of the window. Overlayed over the top of this picture, and in the centre of the panel I want to put a wx.BoxSizer containing various widgets. So far I've got the sizer visible but, try as I might, I cannot shift it from the uppermost lefthand corner of the panel to the center. No doubt there are many round-about ways of doing this involving grids and borders, but before I set off down this path, I was wondering if I'm missing something simple and there is a command that can be used to position in widget in a specified part of a panel.
ps. I also know I could do this using absolute positioning, but I want to be able to resize the window while keeping the sizer at its centre.
Normally, you can't see a sizer. But regardless, you don't really center a sizer. You center the widgets INSIDE the sizer. So when you add a widget to the sizer, you'd want to do something like this:
mySizer = wx.BoxSizer(wx.VERTICAL)
mySizer.Add(widget, 0, wx.CENTER|wx.ALL, 5)
Now, that will only center it horizontally. If you want it in the very center of the panel, then create another BoxSizer that is oriented horizontally and add the first sizer to the second one, centering it too.
hSizer = wx.BoxSizer(wx.HORIZONTAL)
hSizer.Add(mySizer, 0, wx.CENTER)